Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a folder with PNG images of the following naming scheme:

IMG_0423.png
IMG_0424.png
...
IMG_0509.png

I would like to make an MP4 movie from these images, but I get an error message that ffmpeg cannot find these images:

$ ffmpeg -i IMG_%04d.png -vf "setpts=6*PTS" ../foo.mp4
ffmpeg version 0.7.13, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec 22 2012 12:45:08 with clang 4.1 ((tags/Apple/clang-421.11.65))
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libopenjpeg --enable-libvpx --enable-libspeex --disable-libopencore-amrnb --disable-libopencore-amrwb --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.123. 0 / 52.123. 0
  libavformat  52.111. 0 / 52.111. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
./IMG_%04d.png: No such file or directory

Is there something I am missing about using this naming scheme with ffmpeg? Thanks for your advice.

EDIT

I am adding the output from running a modified command, which only results in the first frame:

Papillion:png alexpreynolds$ ../ffmpeg -start_number 423 -i "IMG_%04d.png" ../foo.mp4
ffmpeg version N-48159-g1501475-tessus Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec 21 2012 22:22:28 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)
  configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --disable-ffserver --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-fontconfig --enable-libfreetype --enable-libass --enable-filters --enable-runtime-cpudetect
  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 81.100 / 54. 81.100
  libavformat    54. 49.102 / 54. 49.102
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 29.100 /  3. 29.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, image2, from 'IMG_%04d.png':
  Duration: 00:00:00.16, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, rgba, 640x480 [SAR 2835:2835 DAR 4:3], 25 fps, 25 tbr, 25 tbn, 25 tbc
File '../foo.mp4' already exists. Overwrite ? [y/N] y
using SAR=1/1
[libx264 @ 0x10202da00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x10202da00] profile High, level 3.0
[libx264 @ 0x10202da00] 264 - core 128 - 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=6 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 '../foo.mp4':
  Metadata:
    encoder         : Lavf54.49.102
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 12800 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
frame=    4 fps=0.0 q=-2.0 Lsize=      54kB time=00:00:00.08 bitrate=5520.7kbits/s    
video:53kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1.554395%
[libx264 @ 0x10202da00] frame I:1     Avg QP:26.72  size: 53541
[libx264 @ 0x10202da00] frame P:1     Avg QP:27.18  size:    27
[libx264 @ 0x10202da00] frame B:2     Avg QP:26.83  size:    40
[libx264 @ 0x10202da00] consecutive B-frames: 25.0%  0.0% 75.0%  0.0%
[libx264 @ 0x10202da00] mb I  I16..4:  3.3% 49.4% 47.2%
[libx264 @ 0x10202da00] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.2%  0.0%  0.0%  0.0%  0.0%    skip:99.8%
[libx264 @ 0x10202da00] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8:  1.0%  0.0%  0.0%  direct: 0.0%  skip:98.9%  L0: 5.2% L1:94.8% BI: 0.0%
[libx264 @ 0x10202da00] 8x8 transform intra:49.3% inter:100.0%
[libx264 @ 0x10202da00] coded y,uvDC,uvAC intra: 90.0% 91.1% 75.6% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x10202da00] i16 v,h,dc,p: 14% 21% 12% 52%
[libx264 @ 0x10202da00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 20% 15%  6%  8%  7%  9%  7% 12%
[libx264 @ 0x10202da00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 22% 13%  7%  8%  9%  8%  6%  9%
[libx264 @ 0x10202da00] i8c dc,h,v,p: 53% 23% 15% 10%
[libx264 @ 0x10202da00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x10202da00] kb/s:2682.40
share|improve this question
add comment

1 Answer

I'm assuming IMG_0423.png is your first image. You have several options (ignoring renaming them) if your images do not start with "1", as in IMG_0001.png for your case.

Use -start_number

You can use the -start_number input option to declare which file should begin the sequence:

ffmpeg -start_number 423 -i IMG_%04d.png … output

Glob pattern

Another option is to use a glob pattern:

ffmpeg -pattern_type glob -i "IMG_*.png" … output

Using a cat

You can pipe images to ffmpeg via cat.

cat *.png | ffmpeg -f image2pipe -c:v png -i - … output

Note that you may have to use a more recent ffmpeg for all of these examples to work. See the FFmpeg Download page for links to builds for Linux, OS X, and Windows.

share|improve this answer
    
I tried a recent static build, but the output only shows the first frame. Still, I'm getting closer with your approach, thanks. –  Alex Reynolds Dec 23 '12 at 4:31
    
@AlexReynolds Can you update your question with the complete ffmpeg console output that results from your ffmpeg command? It's hard to say what might be going on without the output. –  LordNeckbeard Dec 23 '12 at 5:16
    
I edited my question to include the command I am running, along with output. –  Alex Reynolds Dec 23 '12 at 5:29
    
@AlexReynolds Is there a break in your numbering? Have you tried the other methods I listed? Can you provide a sample of the output? –  LordNeckbeard Dec 23 '12 at 20:00
    
No break. Same result using the glob. Did not try cat. I'll try to upload the movie file to Dropbox a little later when I have my laptop again. –  Alex Reynolds Dec 23 '12 at 22:32
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.