[Ffmpeg-devel] Frames outputted on 1 fps do not match the correct frame

PJLive pjlive
Wed Sep 13 19:12:49 CEST 2006


On 13-Sep-06, at 09:55, Michel Bardiaux wrote:

> PJLive wrote:
> Maybe > For example, to output individual frames of a short mpeg1  
> clip (17s) I
>> do the following:
>> $ ffmpeg -i mpeg1video.mpg x%05d.png
>> FFmpeg version SVN-r6230, Copyright (c) 2000-2004 Fabrice Bellard
>>   configuration:
>>   libavutil version: 49.0.0
>>   libavcodec version: 51.14.0
>>   libavformat version: 50.5.0
>>   built on Sep 12 2006 06:47:21, gcc: 4.0.2 20051125 (Red Hat  
>> 4.0.2-8)
>> Input #0, mpeg, from 'mpeg1video.mpg':
>>   Duration: 00:00:11.1, start: 0.500000, bitrate: 679 kb/s
>>   Stream #0.0[0x1e0]: Video: mpeg1video, yuv420p, 320x262, 104857  
>> kb/s, 25.00 fps(r)
>>   Stream #0.1[0x1c0]: Audio: mp2, 44100 Hz, stereo, 128 kb/s
>> Output #0, image2, to 'x%05d.png':
>>   Stream #0.0: Video: png, rgb24, 320x262, q=2-31, 200 kb/s, 25.00  
>> fps(c)
>> Stream mapping:
>>   Stream #0.0 -> #0.0
>> Press [q] to stop encoding
>> frame=  375 q=0.0 Lsize=       0kB time=15.0 bitrate=   0.0kbits/s
>> video:19442kB audio:0kB global headers:0kB muxing overhead  
>> -100.000000%
>> The result of the first 50 frames:
>> $ ls -l x*png|head -n 50
>> -rw-rw-r--  1 pjb pjb 35973 Sep 13 09:47 x00001.png
>> -rw-rw-r--  1 pjb pjb 38551 Sep 13 09:47 x00002.png

[snip]

>> -rw-rw-r--  1 pjb pjb 43932 Sep 13 09:47 x00049.png
>> -rw-rw-r--  1 pjb pjb 47704 Sep 13 09:47 x00050.png
>> So far, so good. However, should I want a single frame every  
>> second, I add a "-r 1" parameter to the command line:
>> $ ffmpeg -i mpeg1video.mpg -r 1 y%05d.png
>> FFmpeg version SVN-r6230, Copyright (c) 2000-2004 Fabrice Bellard
>>   configuration:
>>   libavutil version: 49.0.0
>>   libavcodec version: 51.14.0
>>   libavformat version: 50.5.0
>>   built on Sep 12 2006 06:47:21, gcc: 4.0.2 20051125 (Red Hat  
>> 4.0.2-8)
>> Input #0, mpeg, from 'mpeg1video.mpg':
>>   Duration: 00:00:11.1, start: 0.500000, bitrate: 679 kb/s
>>   Stream #0.0[0x1e0]: Video: mpeg1video, yuv420p, 320x262, 104857  
>> kb/s, 25.00 fps(r)
>>   Stream #0.1[0x1c0]: Audio: mp2, 44100 Hz, stereo, 128 kb/s
>> Output #0, image2, to 'y%05d.png':
>>   Stream #0.0: Video: png, rgb24, 320x262, q=2-31, 200 kb/s,  1.00  
>> fps(c)
>> Stream mapping:
>>   Stream #0.0 -> #0.0
>> Press [q] to stop encoding
>> frame=   17 q=0.0 Lsize=       0kB time=17.0 bitrate=   0.0kbits/s
>> video:851kB audio:0kB global headers:0kB muxing overhead -100.000000%
>> $ ls -l y*png
>> -rw-rw-r--  1 pjb pjb 35973 Sep 13 09:50 y00001.png
>> -rw-rw-r--  1 pjb pjb 38551 Sep 13 09:50 y00002.png

[snip]

>> -rw-rw-r--  1 pjb pjb 46511 Sep 13 09:50 y00016.png
>> -rw-rw-r--  1 pjb pjb 55426 Sep 13 09:50 y00017.png
>> Which *looks* great, but isn't, because:
>> y00001.png == x00001.png (ok)
>> y00002.png == x00002.png (should be x00026.png)
>> y00003.png == x00024.png (should be x00051.png)
>> y00004.png == x00049.png (should be x00076.png)
>> etc.
>> Any comments?
>> Peter
> Maybe -vsync 0 ?
>
> If that works, maybe it should be the default in some cases, but  
> which ones?
>
> Cheers,
> -- 
> Michel Bardiaux

Adding -vsync 0 to the last command results in an even a weirder  
selection of frames. It returns 16 frames (instead of 17) and the  
first 13 frames are the same of the first 13 frames of the videoclip.  
Frame 14 is the same as frame 314, 15 is 339 and 16 is 364. All wrong.

That said, ffmpeg gave many errors during the conversion, like:
	error, non monotone timestamps 1080000 >= 90000

Peter





More information about the ffmpeg-devel mailing list