I am trying to achieve partial transcode using ffmpeg. The command I am using currently is:
ffmpeg.exe -ss start-time -i source file -t duration -y -s 640x360 -b:v 1024k -vcodec libx264 -r 29.7 -movflags faststart -pix_fmt yuv420p outputfile
In the ffmpeg documentation, I read about -to parameter:
-to position (output) Stop writing the output at position. position may be a number in seconds, or in hh:mm:ss[.xxx] form.
-to and -t are mutually exclusive and -t has priority.
But when I tried -to in place of "-t" , the output was same, I mean the value after -to is taken as duration of out put video. I thought it would treat the value like end time. Am I missing something?
From the FFmpeg Wiki:
Note that if you specify
-ss
before-i
only, the timestamps will be reset to zero, so -t and -to have the same effect:ffmpeg -ss 00:01:00 -i video.mp4 -to 00:02:00 -c copy cut.mp4 ffmpeg -i video.mp4 -ss 00:01:00 -to 00:02:00 -c copy cut.mp4
Here, the first command will cut from 00:01:00 to 00:03:00 (in the original), whereas the second command would cut from 00:01:00 to 00:02:00, as intended.
So, make sure you put -ss
after the input, so that the timestamps aren't reset.