[FFmpeg-user] frame extract is not accurate enough
Moritz Barsnick
barsnick at gmx.net
Mon Jul 27 20:43:01 CEST 2015
Hi Gergely,
On Mon, Jul 27, 2015 at 15:46:48 +0000, Lukácsy Gergely wrote:
> I think ffmpeg never outputs the header information regarding duration and such.
I think it does. It doesn't by default output the individual streams'
duration, though.
$ ffmpeg -i out_ffmpeg.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out_ffmpeg.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.11.100
Duration: 00:00:00.57, start: 0.046440, bitrate: 304 kb/s
Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 320x240 [SAR 1:1 DAR 4:3], 80 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 98 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 98 kb/s (default)
Metadata:
handler_name : SoundHandler
Compare with ffrobe, which shows that MP4/MOV presents separate lengths
for container and streams, so at least the former must be from a global
header:
$ FILE=out_ffmpeg.mp4; for detail in format streams; do ffprobe -show_$detail "$FILE" 2>/dev/null | grep -E '(format_name|start_time|duration|codec_type)=' ; done
format_name=mov,mp4,m4a,3gp,3g2,mj2
start_time=-0.046440
duration=0.570000
codec_type=video
start_time=0.000000
duration=0.520000
codec_type=audio
start_time=-0.046440
duration=0.569048
codec_type=audio
start_time=-0.046440
duration=0.569048
Three streams, and none of those lengths matches the "format's" duration.
> Running an empty run with ffmpeg shows me that the video is composed
> of 7423 frames which translates to exactly 296.92 seconds if we
> calulate with 25 fps ( 7423 / 25 = 296.92 ).
Yeah. I was just thinking out load, and wondering whether something
else could be wrong. I suggest you check the stream's length using
"ffprobe -show_streams", perhaps it will show your expected 300
seconds. Again, I'm guessing. :-)
Actually, I think I want to see the exact timestamps for each and
everyone of those 7423 frames, to see if something is fishy. Your
mentioned 5 second drift does make me wonder!
Moritz
More information about the ffmpeg-user
mailing list