1

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?

Sharun
  • 3,022
  • 6
  • 30
  • 59
  • @LordNeckbeard Do you also have the impression that questions here rarely get migrated over (and at some point, the close votes expire)? Actually, you could just answer here, too—no harm done, I suppose. – slhck Feb 12 '15 at 20:47
  • @slhck Yes, it seems to me that migration rarely occurs because they don't get enough votes (maybe 5 is too high?), and the number of Close Votes in review is so high. Sometimes if a moderator with enough permissions sees it then it will be migrated. – llogan Feb 12 '15 at 21:00

1 Answers1

7

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.

Community
  • 1
  • 1
slhck
  • 36,575
  • 28
  • 148
  • 201