[FFmpeg-user] extracting a subclip, -ss and -t options do not work as expected
belcampo
belcampo at zonnet.nl
Mon Aug 15 16:05:06 CEST 2011
On 08/15/2011 03:45 PM, Michael Woywod wrote:
> Hello,
>
> I want to trim a video via ffmpeg cli.
> First obstacle, I detected was the order of parameters. Now I place -ss
> and -t before the -i option and get a valid output at least. This output
> still is not the subclip, i want to extract from the input file.
>
> I got a recent build of ffmpeg -> ffmpeg -version:
> ffmpeg N-31774-g6c4e9ca
> libavutil 51. 11. 1 / 51. 11. 1
> libavcodec 53. 9. 1 / 53. 9. 1
> libavformat 53. 6. 0 / 53. 6. 0
> libavdevice 53. 2. 0 / 53. 2. 0
> libavfilter 2. 28. 0 / 2. 28. 0
> libswscale 2. 0. 0 / 2. 0. 0
> libpostproc 51. 2. 0 / 51. 2. 0
>
> The input is a 10 seconds video h264, created with ffmpeg via:
> ffmpeg -i original.mov -y -r 25 -vcodec libx264 -s 640x360 -sameq
> -maxrate 1500k -bufsize 500k first_transcode.mp4
>
> following calls produce results:
>
> ffmpeg.exe -ss 5 -t 2 -i first_transcode.mp4 -y -vcodec copy -acodec
> copy first_trimmed_5_2.mp4
> -> 7 seconds subclip, starting from 00:00:00 of the input-clip
> ffmpeg.exe -ss 00:00:05.000 -t 00:00:02.000 -i first_transcode.mp4 -y
> -vcodec copy -acodec copy first_trimmed_5_2.mp4
> -> same result
> When playing around with numbers, the result seems to be more like: -ss
> 0 -t (ss+t). This even works, if the values for -ss are negative (-ss -6
> -t 8 returns a 2sec clip, starting from 0 of the input file)
>
> Without -ss, the -t option seems to work fine, but i have no option to
> trim the first part of the clip. I'm looking for a sollution to
> precisely trim my clips via ffmpeg CLI for a while now but don't get it
> working. Any help would be greatly apreciated. I didn't find information
> regarding known bugs or useful examples for CLI usage yet.
Trimming is done at key-frame/I-frame point. The standard parameter for
distance between key-frames/GOP-size is 250 if used with x264 as
encoding codec. So if the source is 10 seconds at a framerate of 25 per
sec. then there will be only 1 key-frame, the 1st frame.
If you want frame exact trimming, your source has to be a key-frame-only
file, gop-size=1
>
> Best Regards
> Michael
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
More information about the ffmpeg-user
mailing list