[FFmpeg-devel] [Patch] improve section 3.2 of the faq

Stefano Sabatini stefano.sabatini-lala
Sun Jan 10 11:57:03 CET 2010

On date Friday 2010-01-08 05:31:37 -0500, John Van Sickle encoded:
> Hi,
> The attached patch improves section 3.2 of the faq by providing more
> useful examples and a simple batch
> script to rename images to a numerical sequence. I hope that's not
> beyond the scope of the faq as it has
> helped a few folks in #ffmpeg.

I have only a problem with this patch, that it duplicates some content
currently present in ffmpeg-doc.texi.

My suggestion is to move all the FAQ documentation regarding the
ffmpeg commands to the man page (which already contains a sort of

Also many of those answers are badly outdated, in particular there is
no mention of presets for performing complex conversions.
> This also removes an extra line that was introduced with my previous
> patch. r21033


> Regards,
> John Van Sickle

> Index: doc/faq.texi
> ===================================================================
> --- doc/faq.texi	(revision 21036)
> +++ doc/faq.texi	(working copy)
> @@ -126,18 +126,68 @@
>  @section How do I encode single pictures into movies?
> -First, rename your pictures to follow a numerical sequence.
> -For example, img1.jpg, img2.jpg, img3.jpg,...
> +ffmpeg uses the C printf syntax to denote a numerical sequence in the filename of images for 
> +input and output. The numerical sequence can start with 0, 1, 2 or 3 and should not contain gaps. If 
> +a gap is present, ffmpeg will interpret the last image before the gap as the end of the sequence. 
> +
> +Examples:
> +
> + at file{img%d.jpg} means the sequence @file{img1.jpg}, @file{img2.jpg}, etc...
> +
> + at file{img%03d.jpg} means the sequence @file{img001.jpg}, @file{img002.jpg}, etc...
> +
> + at file{img%05d.jpg} means the sequence @file{img00001.jpg}, @file{img00002.jpg}, etc...
> +
> +Notice that @samp{%d}, @samp{%03d} and @samp{%05d} are replaced by the image number.
> +
> +Now rename your images to follow a numerical sequence, such as img1.jpg, img2.jpg, ... 
>  Then you may run:
>  @example
> -  ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
> +ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
>  @end example
> -Notice that @samp{%d} is replaced by the image number.
> +If you have large number of images to rename, use the following command to ease the burden.
> +The command symbolically links all files in the current directory that match @code{*jpg} to
> +the @file{/tmp} directory in the sequence of @file{img001.jpg}, @file{img002.jpg} and so on. If the
> +filenames are both, upper and lower case, substitute @code{*[JPGjpg]} in place of @code{*jpg}. Also, if

*jpg *JPG

If you want to account also for JPEG variants:

or using find+egrep
find . -type f | egrep -i '.+\.jpe?g'

Also all these commands are assuming the sh syntax, maybe this should
be mentioned somewhere.

> +you want to sequence them by oldest modified first, substitute @code{`ls -r -t *jpg`} in place of @code{*jpg}.
> - at file{img%03d.jpg} means the sequence @file{img001.jpg}, @file{img002.jpg}, etc...
> + at example
> +x=1; for i in *jpg; do counter=`printf %03d $x`; ln "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done
> + at end example
> +Then run:
> +
> + at example
> +ffmpeg -f image2 -i /tmp/img%03d.jpg /tmp/a.mpg
> + at end example
> +


Thanks for the patch, regards.
FFmpeg = Friendly & Faboulous Mournful Pitiful Emblematic God

More information about the ffmpeg-devel mailing list