{"id":4622,"date":"2014-03-30T14:01:10","date_gmt":"2014-03-30T14:01:10","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/using-ffmpeg-with-decimal-wildcard-collection-of-common-programming-errors\/"},"modified":"2014-03-30T14:01:10","modified_gmt":"2014-03-30T14:01:10","slug":"using-ffmpeg-with-decimal-wildcard-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/using-ffmpeg-with-decimal-wildcard-collection-of-common-programming-errors\/","title":{"rendered":"Using ffmpeg with decimal wildcard-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/175f1d55c73ce5cb1d071dc4d0f1a333?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlex Reynolds<\/p>\n<p>I have a folder with PNG images of the following naming scheme:<\/p>\n<pre><code>IMG_0423.png\nIMG_0424.png\n...\nIMG_0509.png\n<\/code><\/pre>\n<p>I would like to make an MP4 movie from these images, but I get an error message that <code>ffmpeg<\/code> cannot find these images:<\/p>\n<pre><code>$ ffmpeg -i IMG_%04d.png -vf \"setpts=6*PTS\" ..\/foo.mp4\nffmpeg version 0.7.13, Copyright (c) 2000-2011 the FFmpeg developers\n  built on Dec 22 2012 12:45:08 with clang 4.1 ((tags\/Apple\/clang-421.11.65))\n  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\n  libavutil    50. 43. 0 \/ 50. 43. 0\n  libavcodec   52.123. 0 \/ 52.123. 0\n  libavformat  52.111. 0 \/ 52.111. 0\n  libavdevice  52.  5. 0 \/ 52.  5. 0\n  libavfilter   1. 80. 0 \/  1. 80. 0\n  libswscale    0. 14. 1 \/  0. 14. 1\n  libpostproc  51.  2. 0 \/ 51.  2. 0\n.\/IMG_%04d.png: No such file or directory\n<\/code><\/pre>\n<p>Is there something I am missing about using this naming scheme with <code>ffmpeg<\/code>? Thanks for your advice.<\/p>\n<p><strong>EDIT<\/strong><\/p>\n<p>I am adding the output from running a modified command, which only results in the first frame:<\/p>\n<pre><code>Papillion:png alexpreynolds$ ..\/ffmpeg -start_number 423 -i \"IMG_%04d.png\" ..\/foo.mp4\nffmpeg version N-48159-g1501475-tessus Copyright (c) 2000-2012 the FFmpeg developers\n  built on Dec 21 2012 22:22:28 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)\n  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\n  libavutil      52. 12.100 \/ 52. 12.100\n  libavcodec     54. 81.100 \/ 54. 81.100\n  libavformat    54. 49.102 \/ 54. 49.102\n  libavdevice    54.  3.102 \/ 54.  3.102\n  libavfilter     3. 29.100 \/  3. 29.100\n  libswscale      2.  1.103 \/  2.  1.103\n  libswresample   0. 17.102 \/  0. 17.102\n  libpostproc    52.  2.100 \/ 52.  2.100\nInput #0, image2, from 'IMG_%04d.png':\n  Duration: 00:00:00.16, start: 0.000000, bitrate: N\/A\n    Stream #0:0: Video: png, rgba, 640x480 [SAR 2835:2835 DAR 4:3], 25 fps, 25 tbr, 25 tbn, 25 tbc\nFile '..\/foo.mp4' already exists. Overwrite ? [y\/N] y\nusing SAR=1\/1\n[libx264 @ 0x10202da00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX\n[libx264 @ 0x10202da00] profile High, level 3.0\n[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\nOutput #0, mp4, to '..\/foo.mp4':\n  Metadata:\n    encoder         : Lavf54.49.102\n    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\nStream mapping:\n  Stream #0:0 -&gt; #0:0 (png -&gt; libx264)\nPress [q] to stop, [?] for help\nframe=    4 fps=0.0 q=-2.0 Lsize=      54kB time=00:00:00.08 bitrate=5520.7kbits\/s    \nvideo:53kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1.554395%\n[libx264 @ 0x10202da00] frame I:1     Avg QP:26.72  size: 53541\n[libx264 @ 0x10202da00] frame P:1     Avg QP:27.18  size:    27\n[libx264 @ 0x10202da00] frame B:2     Avg QP:26.83  size:    40\n[libx264 @ 0x10202da00] consecutive B-frames: 25.0%  0.0% 75.0%  0.0%\n[libx264 @ 0x10202da00] mb I  I16..4:  3.3% 49.4% 47.2%\n[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%\n[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%\n[libx264 @ 0x10202da00] 8x8 transform intra:49.3% inter:100.0%\n[libx264 @ 0x10202da00] coded y,uvDC,uvAC intra: 90.0% 91.1% 75.6% inter: 0.0% 0.0% 0.0%\n[libx264 @ 0x10202da00] i16 v,h,dc,p: 14% 21% 12% 52%\n[libx264 @ 0x10202da00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 20% 15%  6%  8%  7%  9%  7% 12%\n[libx264 @ 0x10202da00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 22% 13%  7%  8%  9%  8%  6%  9%\n[libx264 @ 0x10202da00] i8c dc,h,v,p: 53% 23% 15% 10%\n[libx264 @ 0x10202da00] Weighted P-Frames: Y:0.0% UV:0.0%\n[libx264 @ 0x10202da00] kb\/s:2682.40\n<\/code><\/pre>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d74877a33438159b34453e6513bb8ff0?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLordNeckbeard<\/p>\n<p>I&#8217;m assuming <code>IMG_0423.png<\/code> is your first image. You have at least four options if your images do not start with &#8220;1&#8221;, as in <code>IMG_0001.png<\/code> for your case.<\/p>\n<h3>Rename your files<\/h3>\n<p>You could rename them, but laziness can be a virtue, so let&#8217;s move on to&#8230;<\/p>\n<h3>Use <code>-start_number<\/code><\/h3>\n<p>Or you can use the <code>-start_number<\/code> input option to declare which file should begin the sequence:<\/p>\n<pre><code>ffmpeg -start_number 423 -i IMG_%04d.png . output\n<\/code><\/pre>\n<h3>Glob pattern<\/h3>\n<p>Another option is to use a glob pattern:<\/p>\n<pre><code>ffmpeg -pattern_type glob -i \"IMG_*.png\" . output\n<\/code><\/pre>\n<h3>Using a <code>cat<\/code><\/h3>\n<p>You can pipe images to <code>ffmpeg<\/code> via <code>cat<\/code>.<\/p>\n<pre><code>cat *.png | ffmpeg -f image2pipe -c:v png -i - . output\n<\/code><\/pre>\n<p>Note that you may have to use a more recent <code>ffmpeg<\/code> for all of these examples to work. See FFmpeg OS X Static Builds by tessus if you do not feel like compiling, but we are Super Users and should not talk of such things as &#8220;not compiling&#8217;.<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Alex Reynolds I have a folder with PNG images of the following naming scheme: IMG_0423.png IMG_0424.png &#8230; 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 &#8220;setpts=6*PTS&#8221; ..\/foo.mp4 ffmpeg version 0.7.13, Copyright (c) 2000-2011 the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4622","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4622"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4622\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}