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

Michel Bardiaux mbardiaux
Wed Sep 13 09:55:01 CEST 2006


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
> -rw-rw-r--  1 pjb pjb 39477 Sep 13 09:47 x00003.png
> -rw-rw-r--  1 pjb pjb 40320 Sep 13 09:47 x00004.png
> -rw-rw-r--  1 pjb pjb 41379 Sep 13 09:47 x00005.png
> -rw-rw-r--  1 pjb pjb 41802 Sep 13 09:47 x00006.png
> -rw-rw-r--  1 pjb pjb 42836 Sep 13 09:47 x00007.png
> -rw-rw-r--  1 pjb pjb 44053 Sep 13 09:47 x00008.png
> -rw-rw-r--  1 pjb pjb 45840 Sep 13 09:47 x00009.png
> -rw-rw-r--  1 pjb pjb 46160 Sep 13 09:47 x00010.png
> -rw-rw-r--  1 pjb pjb 47220 Sep 13 09:47 x00011.png
> -rw-rw-r--  1 pjb pjb 48438 Sep 13 09:47 x00012.png
> -rw-rw-r--  1 pjb pjb 40774 Sep 13 09:47 x00013.png
> -rw-rw-r--  1 pjb pjb 43271 Sep 13 09:47 x00014.png
> -rw-rw-r--  1 pjb pjb 44645 Sep 13 09:47 x00015.png
> -rw-rw-r--  1 pjb pjb 45514 Sep 13 09:47 x00016.png
> -rw-rw-r--  1 pjb pjb 46476 Sep 13 09:47 x00017.png
> -rw-rw-r--  1 pjb pjb 47584 Sep 13 09:47 x00018.png
> -rw-rw-r--  1 pjb pjb 48484 Sep 13 09:47 x00019.png
> -rw-rw-r--  1 pjb pjb 48345 Sep 13 09:47 x00020.png
> -rw-rw-r--  1 pjb pjb 48846 Sep 13 09:47 x00021.png
> -rw-rw-r--  1 pjb pjb 49031 Sep 13 09:47 x00022.png
> -rw-rw-r--  1 pjb pjb 50193 Sep 13 09:47 x00023.png
> -rw-rw-r--  1 pjb pjb 50879 Sep 13 09:47 x00024.png
> -rw-rw-r--  1 pjb pjb 40850 Sep 13 09:47 x00025.png
> -rw-rw-r--  1 pjb pjb 43329 Sep 13 09:47 x00026.png
> -rw-rw-r--  1 pjb pjb 44978 Sep 13 09:47 x00027.png
> -rw-rw-r--  1 pjb pjb 46765 Sep 13 09:47 x00028.png
> -rw-rw-r--  1 pjb pjb 47954 Sep 13 09:47 x00029.png
> -rw-rw-r--  1 pjb pjb 48919 Sep 13 09:47 x00030.png
> -rw-rw-r--  1 pjb pjb 49770 Sep 13 09:47 x00031.png
> -rw-rw-r--  1 pjb pjb 50326 Sep 13 09:47 x00032.png
> -rw-rw-r--  1 pjb pjb 51082 Sep 13 09:47 x00033.png
> -rw-rw-r--  1 pjb pjb 51402 Sep 13 09:47 x00034.png
> -rw-rw-r--  1 pjb pjb 52270 Sep 13 09:47 x00035.png
> -rw-rw-r--  1 pjb pjb 52361 Sep 13 09:47 x00036.png
> -rw-rw-r--  1 pjb pjb 42308 Sep 13 09:47 x00037.png
> -rw-rw-r--  1 pjb pjb 46484 Sep 13 09:47 x00038.png
> -rw-rw-r--  1 pjb pjb 47800 Sep 13 09:47 x00039.png
> -rw-rw-r--  1 pjb pjb 48955 Sep 13 09:47 x00040.png
> -rw-rw-r--  1 pjb pjb 49943 Sep 13 09:47 x00041.png
> -rw-rw-r--  1 pjb pjb 50734 Sep 13 09:47 x00042.png
> -rw-rw-r--  1 pjb pjb 53693 Sep 13 09:47 x00043.png
> -rw-rw-r--  1 pjb pjb 55246 Sep 13 09:47 x00044.png
> -rw-rw-r--  1 pjb pjb 56139 Sep 13 09:47 x00045.png
> -rw-rw-r--  1 pjb pjb 56736 Sep 13 09:47 x00046.png
> -rw-rw-r--  1 pjb pjb 56968 Sep 13 09:47 x00047.png
> -rw-rw-r--  1 pjb pjb 55461 Sep 13 09:47 x00048.png
> -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
> -rw-rw-r--  1 pjb pjb 50879 Sep 13 09:50 y00003.png
> -rw-rw-r--  1 pjb pjb 43932 Sep 13 09:50 y00004.png
> -rw-rw-r--  1 pjb pjb 46675 Sep 13 09:50 y00005.png
> -rw-rw-r--  1 pjb pjb 54911 Sep 13 09:50 y00006.png
> -rw-rw-r--  1 pjb pjb 51991 Sep 13 09:50 y00007.png
> -rw-rw-r--  1 pjb pjb 58250 Sep 13 09:50 y00008.png
> -rw-rw-r--  1 pjb pjb 54112 Sep 13 09:50 y00009.png
> -rw-rw-r--  1 pjb pjb 57747 Sep 13 09:50 y00010.png
> -rw-rw-r--  1 pjb pjb 53289 Sep 13 09:50 y00011.png
> -rw-rw-r--  1 pjb pjb 53473 Sep 13 09:50 y00012.png
> -rw-rw-r--  1 pjb pjb 50112 Sep 13 09:50 y00013.png
> -rw-rw-r--  1 pjb pjb 58446 Sep 13 09:50 y00014.png
> -rw-rw-r--  1 pjb pjb 61475 Sep 13 09:50 y00015.png
> -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
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/




More information about the ffmpeg-devel mailing list