How to cut video files by frame

Does anyone know of a software that could be installed/compiled for linux that is able to cut video by the frame? Thanks.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

ffmpeg can do it. If the video codec is inter-coded and you want precise frame accuracy, you’ll have to re-encode the video. If you need to not re-encode the video, then ffmpeg will cut from the nearest GOP boundary before the specified cut point.

Cut and stream-copy:

ffmpeg -i input -ss T -t D -c copy -fflags +genpts output

-ss T specifies the starting point expressed as timecode in the format of S+[.m...] e.g. 24 or 65.22 or [HH:]MM:SS[.m...] e.g. 02:34:11.644

-t D specifies the duration in the same format.

This won’t be frame accurate if the start point isn’t at a GOP boundary.

Cut and re-encode:

ffmpeg -i input -ss T -t D -fflags +genpts output

Same as above, but this will be frame-accurate.

If you need to specify in and out points by frame numbers:

ffmpeg -i input -vf trim=start_frame=n:end_frame=m -af atrim=start=s:end=t -fflags +genpts output

n and m are the frame numbers of the video in and out points. s and t are the timecodes for the corresponding audio.

The codecs chosen for the re-encoded videos will be according to whichever defaults ffmpeg has set for the output container e.g. H.264 and AAC for MP4.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply