[FFmpeg-user] Image Sequence to Video, using each image exactly as one frame

Peter Rennert p.rennert at cs.ucl.ac.uk
Tue Apr 30 16:46:03 CEST 2013


Hi,

I am trying to convert an image sequence to an image to a video. I do 
not care about the framerate at all, I just need to make absolutely sure 
that consecutive frames in the resulting video are exactly the 
consecutive images of the sequence. I do neither want to have images of 
the sequence dropped nor duplicated.

I have an image sequence:

2013-02-19.00-00-00.v0.00000.png
                       - - -
2013-02-19.00-00-00.v0.01760.png

I tried several things, of of them:

$ ffmpeg -f image2 -r 29.97 -i 2013-02-19.00-00-00.v0.%05d.png -c:v 
libx264 test.mp4

(see output below)

I also tried -r 30 after the image2 and after libx264 and both. However, 
I seem (stepping through the video using the ffmpeg python wrapper 
ffvideo) to get a video of only 1753 frames or some other values around. 
How can I fix that?


Thanks,

Peter

ffmpeg output:

ffmpeg version 1.0.5 Copyright (c) 2000-2012 the FFmpeg developers
   built on Mar 10 2013 12:20:58 with gcc 4.7.2 (GCC) 20121109 (Red Hat 
4.7.2-8)
   configuration: --prefix=/usr --bindir=/usr/bin 
--datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg 
--libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 
--optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 
--enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls 
--enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 
--disable-indev=jack --enable-libfreetype --enable-libgsm 
--enable-libmp3lame --enable-openal --enable-libopencv 
--enable-libopenjpeg --enable-libopus --enable-libpulse 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 
--enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc 
--enable-pthreads --disable-static --enable-shared --enable-gpl 
--disable-debug --disable-stripping --shlibdir=/usr/lib64 
--enable-runtime-cpudetect
   libavutil      51. 73.101 / 51. 73.101
   libavcodec     54. 59.100 / 54. 59.100
   libavformat    54. 29.104 / 54. 29.104
   libavdevice    54.  2.101 / 54.  2.101
   libavfilter     3. 17.100 /  3. 17.100
   libswscale      2.  1.101 /  2.  1.101
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
[image2 @ 0x1239560] max_analyze_duration 5000000 reached at 5005005
Input #0, image2, from '2013-02-19.00-00-00.v0.%05d.png':
   Duration: 00:00:58.75, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: png, rgba, 64x64, 29.97 fps, 29.97 tbr, 29.97 
tbn, 29.97 tbc
File 'test.mp4' already exists. Overwrite ? [y/N] y
using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x12c5660] profile High, level 1.0
[libx264 @ 0x12c5660] 264 - core 128 r2223 f6a8615 - H.264/MPEG-4 AVC 
codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - 
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 
threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf 
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 
aq=1:1.00
Output #0, mp4, to 'test.mp4':
   Metadata:
     encoder         : Lavf54.29.104
     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 64x64, 
q=-1--1, 2997 tbn, 29.97 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
frame= 1761 fps=0.0 q=-1.0 Lsize=      69kB time=00:00:58.69 bitrate= 
9.7kbits/s
video:48kB audio:0kB subtitle:0 global headers:0kB muxing overhead 
44.410261%
[libx264 @ 0x12c5660] frame I:8     Avg QP:20.64  size:   166
[libx264 @ 0x12c5660] frame P:531   Avg QP:24.51  size:    45
[libx264 @ 0x12c5660] frame B:1222  Avg QP:28.49  size:    19
[libx264 @ 0x12c5660] consecutive B-frames:  5.1%  4.4%  8.5% 82.0%
[libx264 @ 0x12c5660] mb I  I16..4: 21.9% 71.1%  7.0%
[libx264 @ 0x12c5660] mb P  I16..4:  0.8%  0.4%  0.0%  P16..4: 45.5% 
8.5%  4.2%  0.0%  0.0%    skip:40.6%
[libx264 @ 0x12c5660] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 33.0% 
0.3%  0.0%  direct: 0.0%  skip:66.6%  L0:42.4% L1:57.3% BI: 0.3%
[libx264 @ 0x12c5660] 8x8 transform intra:52.6% inter:84.9%
[libx264 @ 0x12c5660] coded y,uvDC,uvAC intra: 35.7% 33.9% 3.6% inter: 
2.1% 3.3% 0.0%
[libx264 @ 0x12c5660] i16 v,h,dc,p: 52%  2% 11% 35%
[libx264 @ 0x12c5660] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34%  9% 30% 5%  6% 
  5%  5%  3%  4%
[libx264 @ 0x12c5660] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 10% 14% 4%  8% 
10%  5%  4%  2%
[libx264 @ 0x12c5660] i8c dc,h,v,p: 82%  8%  9%  0%
[libx264 @ 0x12c5660] Weighted P-Frames: Y:1.1% UV:0.0%
[libx264 @ 0x12c5660] ref P L0: 64.6%  7.2% 19.6%  8.6%  0.1%
[libx264 @ 0x12c5660] ref B L0: 76.6% 18.3%  5.1%
[libx264 @ 0x12c5660] ref B L1: 88.5% 11.5%
[libx264 @ 0x12c5660] kb/s:6.58
[peter at think tmp]$ ffmpeg -f image2 -r 29.97 -i 
2013-02-19.00-00-00.v0.%05d.png -c:v libx2^Ctest.mp4
[peter at think tmp]$ ffmpeg -i test.mp4
ffmpeg version 1.0.5 Copyright (c) 2000-2012 the FFmpeg developers
   built on Mar 10 2013 12:20:58 with gcc 4.7.2 (GCC) 20121109 (Red Hat 
4.7.2-8)
   configuration: --prefix=/usr --bindir=/usr/bin 
--datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg 
--libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 
--optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 
--enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls 
--enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 
--disable-indev=jack --enable-libfreetype --enable-libgsm 
--enable-libmp3lame --enable-openal --enable-libopencv 
--enable-libopenjpeg --enable-libopus --enable-libpulse 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 
--enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc 
--enable-pthreads --disable-static --enable-shared --enable-gpl 
--disable-debug --disable-stripping --shlibdir=/usr/lib64 
--enable-runtime-cpudetect
   libavutil      51. 73.101 / 51. 73.101
   libavcodec     54. 59.100 / 54. 59.100
   libavformat    54. 29.104 / 54. 29.104
   libavdevice    54.  2.101 / 54.  2.101
   libavfilter     3. 17.100 /  3. 17.100
   libswscale      2.  1.101 /  2.  1.101
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     encoder         : Lavf54.29.104
   Duration: 00:00:58.75, start: 0.000000, bitrate: 9 kb/s
     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 
64x64, 6 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 59.94 tbc
     Metadata:
       handler_name    : VideoHandler
At least one output file must be specified
[peter at think tmp]$ ffmpeg -y -f image2 -r 29.97 -i 
2013-02-19.00-00-00.v0.%05d.png -c:v libx264 test.mp4
ffmpeg version 1.0.5 Copyright (c) 2000-2012 the FFmpeg developers
   built on Mar 10 2013 12:20:58 with gcc 4.7.2 (GCC) 20121109 (Red Hat 
4.7.2-8)
   configuration: --prefix=/usr --bindir=/usr/bin 
--datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg 
--libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 
--optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 
--enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls 
--enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 
--disable-indev=jack --enable-libfreetype --enable-libgsm 
--enable-libmp3lame --enable-openal --enable-libopencv 
--enable-libopenjpeg --enable-libopus --enable-libpulse 
--enable-libschroedinger --enable-libspeex --enable-libtheora 
--enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 
--enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc 
--enable-pthreads --disable-static --enable-shared --enable-gpl 
--disable-debug --disable-stripping --shlibdir=/usr/lib64 
--enable-runtime-cpudetect
   libavutil      51. 73.101 / 51. 73.101
   libavcodec     54. 59.100 / 54. 59.100
   libavformat    54. 29.104 / 54. 29.104
   libavdevice    54.  2.101 / 54.  2.101
   libavfilter     3. 17.100 /  3. 17.100
   libswscale      2.  1.101 /  2.  1.101
   libswresample   0. 15.100 /  0. 15.100
   libpostproc    52.  0.100 / 52.  0.100
[image2 @ 0x1c52560] max_analyze_duration 5000000 reached at 5005005
Input #0, image2, from '2013-02-19.00-00-00.v0.%05d.png':
   Duration: 00:00:58.75, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: png, rgba, 64x64, 29.97 fps, 29.97 tbr, 29.97 
tbn, 29.97 tbc
[libx264 @ 0x1cde660] using cpu capabilities: MMX2 SSE2Fast SSSE3 
FastShuffle SSE4.2 AVX
[libx264 @ 0x1cde660] profile High, level 1.0
[libx264 @ 0x1cde660] 264 - core 128 r2223 f6a8615 - H.264/MPEG-4 AVC 
codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - 
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 
threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf 
mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 
aq=1:1.00
Output #0, mp4, to 'test.mp4':
   Metadata:
     encoder         : Lavf54.29.104
     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 64x64, 
q=-1--1, 2997 tbn, 29.97 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
frame= 1761 fps=0.0 q=-1.0 Lsize=      69kB time=00:00:58.69 bitrate= 
9.7kbits/s
video:48kB audio:0kB subtitle:0 global headers:0kB muxing overhead 
44.410261%
[libx264 @ 0x1cde660] frame I:8     Avg QP:20.64  size:   166
[libx264 @ 0x1cde660] frame P:531   Avg QP:24.51  size:    45
[libx264 @ 0x1cde660] frame B:1222  Avg QP:28.49  size:    19
[libx264 @ 0x1cde660] consecutive B-frames:  5.1%  4.4%  8.5% 82.0%
[libx264 @ 0x1cde660] mb I  I16..4: 21.9% 71.1%  7.0%
[libx264 @ 0x1cde660] mb P  I16..4:  0.8%  0.4%  0.0%  P16..4: 45.5% 
8.5%  4.2%  0.0%  0.0%    skip:40.6%
[libx264 @ 0x1cde660] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8: 33.0% 
0.3%  0.0%  direct: 0.0%  skip:66.6%  L0:42.4% L1:57.3% BI: 0.3%
[libx264 @ 0x1cde660] 8x8 transform intra:52.6% inter:84.9%
[libx264 @ 0x1cde660] coded y,uvDC,uvAC intra: 35.7% 33.9% 3.6% inter: 
2.1% 3.3% 0.0%
[libx264 @ 0x1cde660] i16 v,h,dc,p: 52%  2% 11% 35%
[libx264 @ 0x1cde660] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34%  9% 30% 5%  6% 
  5%  5%  3%  4%
[libx264 @ 0x1cde660] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 10% 14% 4%  8% 
10%  5%  4%  2%
[libx264 @ 0x1cde660] i8c dc,h,v,p: 82%  8%  9%  0%
[libx264 @ 0x1cde660] Weighted P-Frames: Y:1.1% UV:0.0%
[libx264 @ 0x1cde660] ref P L0: 64.6%  7.2% 19.6%  8.6%  0.1%
[libx264 @ 0x1cde660] ref B L0: 76.6% 18.3%  5.1%
[libx264 @ 0x1cde660] ref B L1: 88.5% 11.5%
[libx264 @ 0x1cde660] kb/s:6.58



More information about the ffmpeg-user mailing list