<p>Besides the workaround in my comment, you should be able to use this syntax from the ffmpeg <a href="http://ffmpeg.org/ffmpeg.html#Video-and-Audio-file-format-conversion">documentation</a>:</p>

<pre><code>ffmpeg -f image2 -pattern_type glob -i '*.png' out.avi
</code></pre>

<p>The quotes are important, you need ffmpeg to see the <code>*</code>, not have the shell expand it.</p>

CC BY-SA 3.0
2013-03-05T20:14:52.263Z
Doesn't work for me, but it's probably because I have an older build.  I'm accepting this one because it's most likely to help future users.
Brigand
CC BY-SA 3.0
2013-03-05T22:06:44.067Z
According to the [ffmpeg documentation](http://ffmpeg.org/ffmpeg.html#Video-and-Audio-file-format-conversion) you should use '*.png' instead of %04d.png with the glob pattern type.
Friend Of George
CC BY-SA 3.0
2013-03-06T07:09:49.533Z
That would then select all the pngs present in the folder, besides 00xx.png, whereas the OP wants to queue only the %04d pngs without worrying about numbering continuity.
Gyan
CC BY-SA 3.0
2013-03-06T20:15:51.380Z
Did you actually test this command? I don't think `-pattern_type glob` works with `%04d.png` and will probably result in `Could not open file : %04d.png`.
llogan
CC BY-SA 3.0
2013-03-07T05:26:26.340Z
I haven't tested it. I just checked the syntax for glob @ http://www.jedit.org/users-guide/globs.html and it seems that %04d won't work. However, %?%?%?%?.png should work.
Gyan
CC BY-SA 3.0
2013-04-05T09:03:42.250Z
I'm *pretty sure* that you need to put `*.png` in single-quotes (so `'*.png'`) to avoid it being expanded by Unix-style shells (so, OSX and linux etc).
evilsoup
CC BY-SA 3.0
2015-01-15T10:12:57.643Z
And probably by whatever portability layer ffmpeg on windows is compiled with.  The ffmpeg docs example has it quoted.
Peter Cordes
CC BY-SA 3.0
2015-01-27T13:01:00.910Z
Sadly the ffmpeg developers make file globbing support an *option*! The standard windows builds don't include it.
Timmmm
CC BY-SA 4.0
2021-10-29T09:28:47.673Z
This isn't working, error: Pattern type 'glob' was selected but globbing is not supported by this libavformat build
C:\Users\francois.kruger\Documents\tf_global_local\dev\tf_ffmpeg\ffmpeg_examples\renders\img.*.exr: Function not implemented
Frank
CC BY-SA 4.0
2021-10-29T11:54:35.770Z
Globbing is not supported on Windows.
Gyan
CC BY-SA 3.0
2013-03-05T14:15:40.223Z
2015-01-16T09:32:29.713Z
2015-01-16T09:32:29.713Z
Gyan
<p>From <a href="http://www.ffmpeg.org/faq.html">http://www.ffmpeg.org/faq.html</a>:
If you have large number of pictures to rename, you can use the following command to ease the burden. The command, using the bourne shell syntax, symbolically links all files in the current directory that match *jpg to the ‘/tmp’ directory in the sequence of ‘img001.jpg’, ‘img002.jpg’ and so on.</p>

<p><code>
x=1; for i in *jpg; do counter=$(printf %03d $x); ln -s "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done
</code></p>

CC BY-SA 3.0
2018-04-23T06:37:54.577Z
For me this didn't work until I replaced `for i in *jpg` with `for i in /full/path/*jpg`, because all the symlinks were broken
Jezzamon
CC BY-SA 3.0
2014-03-03T03:45:09.887Z
I used this to combine multiple sequences `seqA-[0001-n].png`, `seqB-[0001-n].png`, etc. Much easier than messing around with image2 globbing and the concat filter.
z0r
CC BY-SA 3.0
2013-10-21T08:11:15.173Z
2013-10-21T08:11:15.173Z
Nikhil
<p>I would actually suggest the same thing Mulvya suggested.  Whenever I've needed to do stuff like this when dealing with 3D animation renderings, I've renamed the files to make them sequential.  It's just easier to work with that way in a lot of different software unless you need to preserve the file names for some reason.  Total Commander is also a great tool for multi-renaming.</p>

CC BY-SA 3.0
2013-03-05T20:16:28.720Z
I ended up doing something similar (a Python renaming script).
Brigand
CC BY-SA 3.0
2013-03-04T15:27:51.780Z
2013-03-04T15:27:51.780Z
AJ Henderson
<p>For the missing sequence part, I used 2 liner</p>

<pre><code>CONCAT=$(echo $(ls *.png | sort -n -t _ -k 2) | sed -e "s/ /|/g")
ffmpeg -framerate 25 -i "concat:$CONCAT" -c:v libx264 -profile:v high -pix_fmt yuv420p output.mp4
</code></pre>

<p>Hope this will help someone in future</p>

CC BY-SA 4.0
2018-09-24T20:03:39.387Z
2018-09-24T20:03:39.387Z
Shakil Ahmed
<p>If the images are dated, <code>exiftool</code> can be used to rename the source files to yyyy-mm-dd_hhmm pattern. Then a bash script can create an input file for <code>ffmpeg</code>.</p>
<p>Here is a script that shows the idea:
<a href="https://github.com/leobard/timelapse-prepare-and-run-ffmpeg.sh/blob/main/timelapse-prepare-and-run-ffmpeg.sh" rel="nofollow noreferrer">https://github.com/leobard/timelapse-prepare-and-run-ffmpeg.sh/blob/main/timelapse-prepare-and-run-ffmpeg.sh</a></p>

CC BY-SA 4.0
2021-07-18T15:29:45.230Z
2021-07-18T15:29:45.230Z
leobard
<p><strong>For recent versions of ffmpeg, see <a href="https://video.stackexchange.com/a/7320/3894">Gyan's answer</a> instead</strong></p>
<p><em>Original answer:</em></p>
<hr />
<p>with ffmpeg 0.11.1 it's as easy as:</p>
<pre><code>ffmpeg -f image2 -i %*.png out.avi
</code></pre>
<p>From the <code>man</code> page, in an example under &quot;Video and Audio file format conversion&quot;:</p>
<blockquote>
<p>When importing an image sequence, <code>-i</code> also supports expanding shell-like wildcard patterns (globbing) internally. To lower the chance of interfering with your actual file names and the shell's glob expansion, you are required to activate glob meta characters by prefixing them with a single <code>%</code> character, like in <code>foo-%*.jpeg</code>, <code>foo-%?%?%?.jpeg</code> or <code>foo-00%[234%]%*.jpeg</code>.</p>
</blockquote>
<p>Update per comments: on recent versions you should now use <code>-i '*.png'</code> syntax.</p>

CC BY-SA 3.0
2013-09-12T19:24:32.817Z
This hasn't been working for me using ffmpeg or avconv in Ubuntu 13.04
hellocatfood
CC BY-SA 3.0
2015-01-27T12:59:52.287Z
This appears to not be an option any more.
Timmmm
CC BY-SA 3.0
2015-01-27T18:01:50.283Z
It seems they deprecated this syntax at some point.  The updated documentation was committed 8-Aug-2012 but I can't tell what version that equates to across the multiple branches.  See http://git.videolan.org/?p=ffmpeg.git;a=commit;h=7794ddeae3edba09fbf3e5badfedf5ea20a9a1f6
rymo
CC BY-SA 3.0
2015-09-07T22:03:27.790Z
The `glob_sequence` pattern type is deprecated, but the `glob` pattern type is not. The answer by Mulvya and Peter Cordes works.
dr. Sybren
CC BY-SA 3.0
2017-02-07T16:17:51.263Z
`Pattern type 'glob_sequence' is deprecated: use pattern_type 'glob' instead`
Serge Stroobandt
CC BY-SA 3.0
2017-12-18T05:38:18.713Z
Just as clarification, since this page is currently the top result in Google for that warning message (`Pattern type 'glob_sequence' is deprecated`...): the command given by rymo above (specifically, `-i %*.png`) will _cause_ the warning. To eliminate it, use the slightly-different syntax in Peter Cordes answer (`-i '*.png'`).
James
CC BY-SA 4.0
2021-03-02T18:13:55.277Z
"Could find no file with path '%*.jpg' and index in the range 0-4" This does not work with ffmpeg 4.1.3
Tomáš Zato
CC BY-SA 4.0
2013-04-04T16:00:03.457Z
2021-03-09T15:35:27.607Z
2021-03-09T15:35:27.607Z
rymo
<p>I have a bunch of images, that follow this pattern.</p>

<pre><code>0001.png
0004.png
0007.png
0010.png
0013.png
0016.png
0019.png
...
</code></pre>

<p>They're in the correct order, but FFMPEG ignores anything after the first file, because it can't find a <code>0002.png</code>.  How can I get it to join these files?</p>

<p>I tried</p>

<pre><code>ffmpeg -i %04d.png out.avi
</code></pre>

CC BY-SA 3.0
2013-03-04T15:25:36.740Z
How about temporarily renaming them, making the AVI and then renaming them back to the (3x-2).png scheme? Bulk Rename Utility @ http://www.bulkrenameutility.co.uk/Main_Intro.php is a free, umm, bulk renamer.
Gyan
<ffmpeg><linux>
How to get FFMPEG to join non-sequential image files? (skip by 3s)
Brigand
# How to get FFMPEG to join non-sequential image files? (skip by 3s)

(Asked by: username_0 on 2013-03-04)

I have a bunch of images, that follow this pattern.
0001.png
0004.png
0007.png
0010.png
0013.png
0016.png
0019.png
...

They're in the correct order, but FFMPEG ignores anything after the first file, because it can't find a 0002.png.  How can I get it to join these files?
I tried
ffmpeg -i %04d.png out.avi

**Tags:** ffmpeg, linux

> **Comments:**
> **username_1**: How about temporarily renaming them, making the AVI and then renaming them back to the (3x-2).png scheme? Bulk Rename Utility @ http://www.bulkrenameutility.co.uk/Main_Intro.php is a free, umm, bulk renamer.  

---

## 6 answers

### Answer by username_14 on 2013-04-04. Score: 30 | Accepted answer

For recent versions of ffmpeg, see username_1's answer instead
Original answer:

with ffmpeg 0.11.1 it's as easy as:
ffmpeg -f image2 -i %*.png out.avi

From the man page, in an example under "Video and Audio file format conversion":

When importing an image sequence, -i also supports expanding shell-like wildcard patterns (globbing) internally. To lower the chance of interfering with your actual file names and the shell's glob expansion, you are required to activate glob meta characters by prefixing them with a single % character, like in foo-%*.jpeg, foo-%?%?%?.jpeg or foo-00%[234%]%*.jpeg.

Update per comments: on recent versions you should now use -i '*.png' syntax.

> **Comments:**
> **username_15**: This hasn't been working for me using ffmpeg or avconv in Ubuntu 13.04  
> **username_6**: This appears to not be an option any more.  
> **username_14**: It seems they deprecated this syntax at some point.  The updated documentation was committed 8-Aug-2012 but I can't tell what version that equates to across the multiple branches.  See http://git.videolan.org/?p=ffmpeg.git;a=commit;h=7794ddeae3edba09fbf3e5badfedf5ea20a9a1f6  
> **username_16**: The `glob_sequence` pattern type is deprecated, but the `glob` pattern type is not. The answer by Mulvya and username_5 works.  
> **username_17**: `Pattern type 'glob_sequence' is deprecated: use pattern_type 'glob' instead`  
> **username_18**: Just as clarification, since this page is currently the top result in Google for that warning message (`Pattern type 'glob_sequence' is deprecated`...): the command given by username_14 above (specifically, `-i %*.png`) will _cause_ the warning. To eliminate it, use the slightly-different syntax in username_5 answer (`-i '*.png'`).  
> **username_19**: "Could find no file with path '%*.jpg' and index in the range 0-4" This does not work with ffmpeg 4.1.3  

---

### Answer by username_1 on 2013-03-05. Score: 25

Besides the workaround in my comment, you should be able to use this syntax from the ffmpeg documentation:
ffmpeg -f image2 -pattern_type glob -i '*.png' out.avi

The quotes are important, you need ffmpeg to see the *, not have the shell expand it.

> **Comments:**
> **username_0**: Doesn't work for me, but it's probably because I have an older build.  I'm accepting this one because it's most likely to help future users.  
> **username_2**: According to the [ffmpeg documentation](http://ffmpeg.org/ffmpeg.html#Video-and-Audio-file-format-conversion) you should use '*.png' instead of %04d.png with the glob pattern type.  
> **username_1**: That would then select all the pngs present in the folder, besides 00xx.png, whereas the OP wants to queue only the %04d pngs without worrying about numbering continuity.  
> **username_3**: Did you actually test this command? I don't think `-pattern_type glob` works with `%04d.png` and will probably result in `Could not open file : %04d.png`.  
> **username_1**: I haven't tested it. I just checked the syntax for glob @ http://www.jedit.org/users-guide/globs.html and it seems that %04d won't work. However, %?%?%?%?.png should work.  
> **username_4**: I'm *pretty sure* that you need to put `*.png` in single-quotes (so `'*.png'`) to avoid it being expanded by Unix-style shells (so, OSX and linux etc).  
> **username_5**: And probably by whatever portability layer ffmpeg on windows is compiled with.  The ffmpeg docs example has it quoted.  
> **username_6**: Sadly the ffmpeg developers make file globbing support an *option*! The standard windows builds don't include it.  
> **username_7**: This isn't working, error: Pattern type 'glob' was selected but globbing is not supported by this libavformat build C:\Users\francois.kruger\Documents\tf_global_local\dev\tf_ffmpeg\ffmpeg_examples\renders\img.*.exr: Function not implemented  
> **username_1**: Globbing is not supported on Windows.  

---

### Answer by username_8 on 2013-10-21. Score: 9

From <http://www.ffmpeg.org/faq.html>:
If you have large number of pictures to rename, you can use the following command to ease the burden. The command, using the bourne shell syntax, symbolically links all files in the current directory that match \*jpg to the ‘/tmp’ directory in the sequence of ‘img001.jpg’, ‘img002.jpg’ and so on.

`x=1; for i in *jpg; do counter=$(printf %03d $x); ln -s "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done`

> **Comments:**
> **username_10**: I used this to combine multiple sequences `seqA-[0001-n].png`, `seqB-[0001-n].png`, etc. Much easier than messing around with image2 globbing and the concat filter.  
> **username_9**: For me this didn't work until I replaced `for i in *jpg` with `for i in /full/path/*jpg`, because all the symlinks were broken  

---

### Answer by username_11 on 2013-03-04. Score: 6

I would actually suggest the same thing Mulvya suggested. Whenever I've needed to do stuff like this when dealing with 3D animation renderings, I've renamed the files to make them sequential. It's just easier to work with that way in a lot of different software unless you need to preserve the file names for some reason. Total Commander is also a great tool for multi-renaming.

> **Comments:**
> **username_0**: I ended up doing something similar (a Python renaming script).  

---

### Answer by username_12 on 2018-09-24. Score: 5

For the missing sequence part, I used 2 liner
CONCAT=$(echo $(ls *.png | sort -n -t _ -k 2) | sed -e "s/ /|/g")
ffmpeg -framerate 25 -i "concat:$CONCAT" -c:v libx264 -profile:v high -pix_fmt yuv420p output.mp4

Hope this will help someone in future


---

### Answer by username_13 on 2021-07-18. Score: 0

If the images are dated, `exiftool` can be used to rename the source files to yyyy-mm-dd\_hhmm pattern. Then a bash script can create an input file for `ffmpeg`.

Here is a script that shows the idea:
<https://github.com/username_13/timelapse-prepare-and-run-ffmpeg.sh/blob/main/timelapse-prepare-and-run-ffmpeg.sh>


---

