[FFmpeg-user] Converting pictures to video

Dan Bridges dosdan at gmail.com
Tue Dec 10 06:26:55 EET 2019


On 10/12/2019 5:09 am, Anwuli Okwuashi wrote:
> winexec "C:\FFmpeg\bin\ffmpeg.exe" -report -f concat -safe 0 -i
> "C:\Users\analyst\Desktop\STATA\projects\animation3\graph_%d.png" -maxrate
> 30000k -y
> "C:\Users\analyst\Desktop\STATA\projects\animation3\map_video1.mpg"

When you use the concat demuxer , after "-i", (the input file(s)
option), don't use: *graph_%d.png*

Instead, use the name of the text file you've created that contains
either 1- or 2 entries for every image filename you wish to load. This
way, the group of image filenames does not need to be contiguous in its
numbering or start its numbering within 0-4 of the index value.

https://trac.ffmpeg.org/wiki/Concatenate

If you look at my post you will see that I have presented a batchfile
called *create_list.bat*:

@echo off SETLOCAL EnableDelayedExpansion if exist mylist.txt del
mylist.txt for %%I in ("Sequence Directory\*.png") do (echo file '%%~fI'
>> mylist.txt & echo duration 0.04 >> mylist.txt) start /i mylist.txt

The way it is currently written, it looks a directory-level down from
the current directory for a sub-directory called "Sequence directory".
This is just an example. You could alter it to suit yourself.

In my example, I had create_list.bat and ffmpeg.exe in "C:\test
directory". So, when executing create_list.bat from there, it is looking
for all the .png files I've placed in "C:\test directory\Sequence
directory" and then creating a name-sorted list in the current directory
("C:\test directory") called *mylist.txt*. Finally, it was loading this
text file in the Windows-associated  program, notepad.exe., for
examination and modification*.  *This final step is an optional process.*
*

In my example, the first 4 image files in this sorted list which would
be read by the concat demuxer and loaded into ffmpeg were:

file 'C:\test directory\Sequence directory\Replacement.png' duration
0.04 file 'C:\test directory\Sequence directory\Sequence_0083.png'
duration 0.04 file 'C:\test directory\Sequence
directory\Sequence_0086.png' duration 0.04 file 'C:\test
directory\Sequence directory\Sequence_0089.png' duration 0.04

Once you have created your list of image filenames, you use it this way
(an example):*
*

*ffmpeg.exe -f concat -safe 0 -i "C:\test directory\mylist.txt" -maxrate
30000k -y "C:\test directory\Sequence directory"\map_video6.mpg*

In your case your directory structure appears not to be separating your
working directory from your data (image) directory. This is OK if you
only a few image files, but gets messy when you have thousands of images.

Assuming you want create_list.bat to operate from the "animation3"
directory you would alter its contents to:

@echo off SETLOCAL EnableDelayedExpansion if exist mylist.txt del
mylist.txt for %%I in (*.png") do (echo file '%%~fI' >> mylist.txt &
echo duration 0.04 >> mylist.txt) start /i mylist.txt


And then your ffmpeg.exe command line would be:

***winexc "C:\Users\analyst\Desktop\STATA\projects\animation3\mylist.txt"
-maxrate 30000k -y
"C:\Users\analyst\Desktop\STATA\projects\animation3\map_video1.mpg"*

Dan.*
*

*
*

**








More information about the ffmpeg-user mailing list