[FFmpeg-user] ffmpeg -ss start-time issue

richard heade richard.heade at gmail.com
Fri Mar 28 00:00:57 CET 2014

Two points: 1) the shift is more than 1.874 seconds, much more, and it's
not constant. 2) the info I get from avidemux includes the frame
number/elapsed time and the frame type ... so I can start on my
extracted segments on a key frame. The frame type information is as
important as the elapsed time.

My first 4 segments start at 00:01:19.929 (frame 4791), 00:22:45.899
(frame 81872), 00:34:28.351 (frame 123977) and 00:47:26.963 (frame
170647) ... these numbers according to avidemux. The segments start
before the "indicated" time, and the "desired" frame makes it's
appearance approximately 0:28, 1:14, 2:02 and 2:58 seconds,
respectively, into the segment.

I understand that the two different programs might not agree on the
elapsed time, but shouldn't they agree on the frame count? If so, is
there a way to extract a segment using ffmpeg and specifying the start
position by frame count?

On 03/27/2014 07:31 AM, Henk D. Schoneveld wrote:
> On 27 Mar 2014, at 15:07, richard heade <richard.heade at gmail.com> wrote:
>> I'm a newbie, I've just started using ffmpeg, so I fully expect that I'm
>> doing something wrong and I could use some help.  I'm using "ffmpeg
>> input.mpg -ss 123.456 -t 12.345" to extract a clip from an mpeg 2 file. 
>> It works really well except for one significant problem, ffmpeg and I
>> (or avidemux) don't agree on where 123.456 is.  I use avidemux to
>> determine the start time, 123.456.  Avidemux2_gtk allows me to play the
>> video and at any point it displays the frame number, elapsed time and
>> frame type.
>> I'm running ffmpeg 2.1.1 with gcc 4.7.  It reports the video properties as:
>> Duration: 03:04:56.08, start: 1.874000, bitrate: 10112 kb/s
>>    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 1280x720
>> [SAR 1:1 DAR 16:9], max. 24000 kb/s, 59.94 fps, 59.94 tbr, 90k tbn,
>> 119.88 tbc
>>    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
> Have a close look above which says
> Duration: 03:04:56.08, start: 1.874000
> It doesn’t start at 0.0, maybe add this value to -ss
> Or at that point isn’t a I-frame/Keyframe and the nearest is taken. It’s not possible to cut at an arbitrary frame without re-encoding to an all I-frame/Keyframe file.
>> I'm running Avidemux 2.5.6.  It reports the video properties as:
>> Video:
>> Codec 4CC: MPEG
>> Image Size: 1280x720
>> Aspect Ratio: 1:1
>> Frame Rate: 59.940 fps
>> Frame Count: 624061 frames
>> Total Duration: 02:53:31.428
>> Audio:
>> Codec: AC3
>> Channels: 6
>> Bitrate: 48000 Bps  / 384 kbps
>> Variable Bitrate: No
>> Frequency: 48000 Hz
>> Total Duration: 03:04:55.520
>> File Size: 507.91MB
>> It would unfortunate if avidemux and ffmpeg are just incompatible,
>> though I would accept that, because I haven't found another way to
>> accurately determine the starting position of a clip within a video.  If
>> they are incompatible is there another way, compatible with ffmpeg, to
>> get the frame count, elapsed time, and frame type from a video?

More information about the ffmpeg-user mailing list