Re-Encode - Faster!

Posted at

I've got a long video from YouTube (MP4), which I want to trim to just a two minutes,

this command is accurate, but will take ages since the video is quite lengthy.. so frame-seeking is a nightmare..
ffmpeg -i SOURCE.MP4 -ss 24:30:00 -t 00:02:00.00 TARGET.MP4


this will work very fast, since it won't encode anything, but unpredictable-framing (I/P/B....) will make the video jumpy and heavy on C/GPU
ffmpeg -threads 4 -i SOURCE.MP4 -ss 00:24:30 -t 00:02:00.00 -vcodec copy -acodec copy TARGET.MP4


so a re-encoding is required, nothing fancy:
ffmpeg -i TARGET.MP4 TARGET_FINAL.MP4


regarding video-encoding you might have head of i-frames (a.k.a "intra-", "intra-frames" or "inter-frame" or GOP [in FFMPEG terminalogy] ), by default- every ~12 frames you'll find one, but you can also set the size of the group to 1 using -g 1 in an alternative re-encoding phase:

-g E..V.... set the group of picture (GOP) size (from INT_MIN to INT_MAX) (default 12)

ffmpeg -threads 4 -i TARGET.MP4 -g 1 TARGET_FINAL.MP4


it might benefit you somehow, although I prefer the default of /12/ which is much less choppy..

anyway,
since GOP is quite new in the FFMPEG-terminology replacing that old -intra switch which does not work in new builds, and "Group Of Pictures" is not quite a intermediate leap to i-frames anyway.. hope it saves anyone some searching time :)


although you can always ffmpeg -h full 2>&1 >readme.info for the fun of it ;)
', 'FFMPEG - Cut, Copy