I have been trying to use FFMPEG to cut out a specific portion of a sound track. I wanted to cut from 00:07 to 04:33, so I input the ffmpeg command as follows:
bin\ffmpeg -ss 00:07 -t 04:26 -i "input.mp3" -acodec copy "output.mp3"
I used 04:26 for -t, which is [end_time - start_time]. However, the output.mp3 I got was cut from 00:07 to 04:40, and the track was 04:33 long. In order to get the correct output file, I had to use a -t 04:19, which is [end_time - 2*(start_time)].
I tried an alternate command using -to instead of -t
bin\ffmpeg -i "input.mp3" -ss 00:07 -to 04:33 -acodec copy -y "output.mp3"
and this worked as expected, giving the desired output track from 00:07 to 04:33.
The question is, why does the first method require -t to be [end_time - 2* (start_time)]? intuitively, I want to seek 00:07 and then capture the subsequent 04:26, so -ss 00:07 and -t 04:26 makes sense to me. I can't figure out how ffmpeg is interpreting this such that I have to use 04:19 as -t instead.
Since the second method works, I'm not really looking for a solution. I'm just wondering why this happens.
When -ss
and -t
are placed before the input, ffmpeg resorts to fast seek which relies on the index of the input to allow ffmpeg to start and stop seeking. MP3s don't have indices, so ffmpeg estimates duration via bitrate. This can be inaccurate.
When -ss
and -t
are placed after the input, ffmpeg counts demuxed packets. This will be accurate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With