Converting pictures to video

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting pictures to video

Anwuli Okwuashi
Hello,
Newbie alert!
I am unable to recreate an animation I found on stata blog
https://blog.stata.com/2014/03/24/how-to-create-animated-graphics-using-stata/
 .

local GraphPath "C:\Users\jch\AnimatedGraphics\example\"
winexec "C:\Program Files\FFmpeg\bin\ffmpeg.exe" -i `GraphPath'graph_%03d.png
    -b:v 512k `GraphPath'graph.mpg

 My code: ran without errors but no video was created
local GraphPath "C:\Users\analyst\Desktop\STATA\projects\animation\"
winexec "C:\FFmpeg\bin\ffmpeg.exe" -i `GraphPath'i_diff_%.png -b:v
`GraphPath'graph.mpg.

Any idea why mine isn't working? I use windows 10.
Thank you,
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
gga
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

gga

On 5/12/19 18:11, Anwuli Okwuashi wrote:

> Hello,
> Newbie alert!
> I am unable to recreate an animation I found on stata blog
> https://blog.stata.com/2014/03/24/how-to-create-animated-graphics-using-stata/
>   .
>
> local GraphPath "C:\Users\jch\AnimatedGraphics\example\"
> winexec "C:\Program Files\FFmpeg\bin\ffmpeg.exe" -i `GraphPath'graph_%03d.png
>      -b:v 512k `GraphPath'graph.mpg
>
>   My code: ran without errors but no video was created
> local GraphPath "C:\Users\analyst\Desktop\STATA\projects\animation\"
> winexec "C:\FFmpeg\bin\ffmpeg.exe" -i `GraphPath'i_diff_%.png -b:v
> `GraphPath'graph.mpg.
>
> Any idea why mine isn't working? I use windows 10.
I have no idea about stata, but do you realize you posted two different
commands?  Also, the second command is missing the value for -b:v.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

Anwuli Okwuashi
Thank you,

Yes, the first command is the stata blog extrat, the second is mine.
Previous attempts had the value for the -b:v but still did not work.
I have 20 png files created using stata, I just need to convert them to
video/animation. With that, I'll appreciate any help.


On Thu, Dec 5, 2019, 5:49 PM gga <[hidden email]> wrote:

>
> On 5/12/19 18:11, Anwuli Okwuashi wrote:
> > Hello,
> > Newbie alert!
> > I am unable to recreate an animation I found on stata blog
> >
> https://blog.stata.com/2014/03/24/how-to-create-animated-graphics-using-stata/
> >   .
> >
> > local GraphPath "C:\Users\jch\AnimatedGraphics\example\"
> > winexec "C:\Program Files\FFmpeg\bin\ffmpeg.exe" -i
> `GraphPath'graph_%03d.png
> >      -b:v 512k `GraphPath'graph.mpg
> >
> >   My code: ran without errors but no video was created
> > local GraphPath "C:\Users\analyst\Desktop\STATA\projects\animation\"
> > winexec "C:\FFmpeg\bin\ffmpeg.exe" -i `GraphPath'i_diff_%.png -b:v
> > `GraphPath'graph.mpg.
> >
> > Any idea why mine isn't working? I use windows 10.
> I have no idea about stata, but do you realize you posted two different
> commands?  Also, the second command is missing the value for -b:v.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
gga
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

gga

On 5/12/19 21:07, Anwuli Okwuashi wrote:
> Thank you,
>
> Yes, the first command is the stata blog extrat, the second is mine.
> Previous attempts had the value for the -b:v but still did not work.
> I have 20 png files created using stata, I just need to convert them to
> video/animation. With that, I'll appreciate any help.

ffmpeg prints out a lot of information upon running, which can help in
debugging your problem.  If stata does not print any output (it means it
is swallowing the stdout/stderr output), I suggest you first try the
command from a command line prompt.  If you don't know what that is,
search for cmd.exe.  The variables are specified with set commands and
referred with %var% syntax. With that, you should be able to run ffmpeg
from cmd.exe and see the output for it.  Send the output and command to
the mailing list.


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
gga
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

gga
In reply to this post by Anwuli Okwuashi

On 5/12/19 21:07, Anwuli Okwuashi wrote:

> Thank you,
>
> Yes, the first command is the stata blog extrat, the second is mine.
> Previous attempts had the value for the -b:v but still did not work.
> I have 20 png files created using stata, I just need to convert them to
> video/animation. With that, I'll appreciate any help.
>
>
> On Thu, Dec 5, 2019, 5:49 PM gga <[hidden email]> wrote:
>
>> On 5/12/19 18:11, Anwuli Okwuashi wrote:
>>> Hello,
>>> Newbie alert!
>>> I am unable to recreate an animation I found on stata blog
>>>
>> https://blog.stata.com/2014/03/24/how-to-create-animated-graphics-using-stata/
>>>    .
>>>
>>> local GraphPath "C:\Users\jch\AnimatedGraphics\example\"
>>> winexec "C:\Program Files\FFmpeg\bin\ffmpeg.exe" -i
>> `GraphPath'graph_%03d.png
>>>       -b:v 512k `GraphPath'graph.mpg
>>>
>>>    My code: ran without errors but no video was created
>>> local GraphPath "C:\Users\analyst\Desktop\STATA\projects\animation\"
>>> winexec "C:\FFmpeg\bin\ffmpeg.exe" -i `GraphPath'i_diff_%.png -b:v
>>> `GraphPath'graph.mpg.
>>>
>>> Any idea why mine isn't working? I use windows 10.
>> I have no idea about stata, but do you realize you posted two different
>> commands?  Also, the second command is missing the value for -b:v.

Also, the second command is missing the frame specifier.  You only have
%.png instead of %03d.png (for 3 padded digits) or %d.png (for single
digits).


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

Anwuli Okwuashi
In reply to this post by gga
I renamed the images and used the full path in the command line but it
still doesn't work. See attached the error report and below my code.
Thank you,
. winexec "C:\FFmpeg\bin\ffmpeg.exe"  -report  -i
"C:\Users\analyst\Desktop\STATA\projects\animation3\graph%02d.png"  -b:v
2048k  "C:\Users\analyst\Desktop\STATA\projects\animation3\map_video.mpg"



On Thu, 5 Dec 2019 at 19:32, gga <[hidden email]> wrote:

>
> On 5/12/19 21:07, Anwuli Okwuashi wrote:
> > Thank you,
> >
> > Yes, the first command is the stata blog extrat, the second is mine.
> > Previous attempts had the value for the -b:v but still did not work.
> > I have 20 png files created using stata, I just need to convert them to
> > video/animation. With that, I'll appreciate any help.
>
> ffmpeg prints out a lot of information upon running, which can help in
> debugging your problem.  If stata does not print any output (it means it
> is swallowing the stdout/stderr output), I suggest you first try the
> command from a command line prompt.  If you don't know what that is,
> search for cmd.exe.  The variables are specified with set commands and
> referred with %var% syntax. With that, you should be able to run ffmpeg
> from cmd.exe and see the output for it.  Send the output and command to
> the mailing list.
>
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

ffmpeg-20191206-100851 report.txt (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

Moritz Barsnick
On Fri, Dec 06, 2019 at 10:19:19 -0600, Anwuli Okwuashi wrote:
> I renamed the images and used the full path in the command line but it
> still doesn't work. See attached the error report and below my code.
> Thank you,
> . winexec "C:\FFmpeg\bin\ffmpeg.exe"  -report  -i
> "C:\Users\analyst\Desktop\STATA\projects\animation3\graph%02d.png"  -b:v
> 2048k  "C:\Users\analyst\Desktop\STATA\projects\animation3\map_video.mpg"
[...]
> [image2 @ 000001d077c4a440] Could find no file with path 'C:\Users\analyst\Desktop\STATA\projects\animation3\graph%02d.png' and index in the range 0-4

You apparently have no file
C:\Users\analyst\Desktop\STATA\projects\animation3\graph00.png
or
C:\Users\analyst\Desktop\STATA\projects\animation3\graph01.png
or
C:\Users\analyst\Desktop\STATA\projects\animation3\graph02.png
or
C:\Users\analyst\Desktop\STATA\projects\animation3\graph03.png
or
C:\Users\analyst\Desktop\STATA\projects\animation3\graph04.png

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
gga
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

gga
In reply to this post by Anwuli Okwuashi

On 6/12/19 13:19, Anwuli Okwuashi wrote:
> I renamed the images and used the full path in the command line but it
> still doesn't work. See attached the error report and below my code.
> Thank you,
> . winexec "C:\FFmpeg\bin\ffmpeg.exe"  -report  -i
> "C:\Users\analyst\Desktop\STATA\projects\animation3\graph%02d.png"  -b:v
> 2048k  "C:\Users\analyst\Desktop\STATA\projects\animation3\map_video.mpg"

If you see your report, you will see this line:

[image2 @ 000001d077c4a440] Could find no file with path
'C:\Users\analyst\Desktop\STATA\projects\animation3\graph%02d.png' and
index in the range 0-4

That tells you it is not finding the images.  Either the path, name,
extesion, frame padding or start frame is wrong.  Without seeing the
directory it is impossible for me to say what of that is wrong.


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

Dan Bridges
On 7/12/2019 11:49 am, Anwuli Okwuashi wrote:
> [image2 @ 000001d077c4a440] Could find no file with path
> 'C:\Users\analyst\Desktop\STATA\projects\animation3\graph%02d.png' and
> index in the range 0-4


I created a 1500x1000 1000-image set: Sequence_000.png ->
Sequence_999.png. This loads fine using at the start of the command line:

ffmpeg -i Sequence_%03d.png

This will also work if the sequence numbers are inside the filename:

ffmpeg -i 0191107-154%03d-214.png

But if you rename the first 5 files to:  _Sequence_000.png ... 
_Sequence_004.png it will fail because the first file starting with
Sequence is now Sequence_005.png.

Renaming _Sequence_004.png -> Sequence_004.png  will allow the remaining
995 files in the sequence to load.

If you can not batch rename the sequence to start from 00 or if it is a
non-contiguous list because you deleted some damaged/missing images, you
can tell FFMPEG to load a list of filenames. This has to be in a
particular 1 or 2-line format (if including  image duration).

For example, I've deleted the first 83 images, substituted a
Replacement.png, and the remaining image names jump by 3. Then I created
a list of filenames.

To create such a list in Windows, I use create_list.bat, here designed
to look in the "Sequence Directory", beneath the current directory
("C:\test directory"), where the images files are situated, create a
2-line name-sorted list where the 2nd line is the duration in secs (1
frame at 25fps = 40ms), and then load this list in the associated text
editor so you can delete or move blocks, change durations etc., if required.

@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 first 4 files in the list:

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

If you decrease the duration below 0.04 @25fps FFMPEG will start to drop
frames. Conversely, if you go above 0.04, it will start to replicate frames.

To use this list:

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


Dan.











*
*

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

Anwuli Okwuashi
Thank you everyone for your valuable feedback and apologies for the late
response, I could not access my files over the weekend.
I am a step closer. The video is saved now but empty, length is 00:00:00.

@[hidden email] I included a second line command with your suggestion but
still did not work.
winexec "C:\FFmpeg\bin\ffmpeg.exe" -report -i
"C:\Users\analyst\Desktop\STATA\projects\animation3\graph_%d.png" -b:v
2048k "C:\Users\analyst\Desktop\STATA\projects\animation3\map_video.mpg"
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"

Thank you,

On Sat, 7 Dec 2019 at 00:43, Dan Bridges <[hidden email]> wrote:

> On 7/12/2019 11:49 am, Anwuli Okwuashi wrote:
> > [image2 @ 000001d077c4a440] Could find no file with path
> > 'C:\Users\analyst\Desktop\STATA\projects\animation3\graph%02d.png' and
> > index in the range 0-4
>
>
> I created a 1500x1000 1000-image set: Sequence_000.png ->
> Sequence_999.png. This loads fine using at the start of the command line:
>
> ffmpeg -i Sequence_%03d.png
>
> This will also work if the sequence numbers are inside the filename:
>
> ffmpeg -i 0191107-154%03d-214.png
>
> But if you rename the first 5 files to:  _Sequence_000.png ...
> _Sequence_004.png it will fail because the first file starting with
> Sequence is now Sequence_005.png.
>
> Renaming _Sequence_004.png -> Sequence_004.png  will allow the remaining
> 995 files in the sequence to load.
>
> If you can not batch rename the sequence to start from 00 or if it is a
> non-contiguous list because you deleted some damaged/missing images, you
> can tell FFMPEG to load a list of filenames. This has to be in a
> particular 1 or 2-line format (if including  image duration).
>
> For example, I've deleted the first 83 images, substituted a
> Replacement.png, and the remaining image names jump by 3. Then I created
> a list of filenames.
>
> To create such a list in Windows, I use create_list.bat, here designed
> to look in the "Sequence Directory", beneath the current directory
> ("C:\test directory"), where the images files are situated, create a
> 2-line name-sorted list where the 2nd line is the duration in secs (1
> frame at 25fps = 40ms), and then load this list in the associated text
> editor so you can delete or move blocks, change durations etc., if
> required.
>
> @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 first 4 files in the list:
>
> 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
>
> If you decrease the duration below 0.04 @25fps FFMPEG will start to drop
> frames. Conversely, if you go above 0.04, it will start to replicate
> frames.
>
> To use this list:
>
> ffmpeg.exe -f concat -safe 0 -i "C:\test directory\mylist.txt" -maxrate
> 30000k -y "C:\test directory\Sequence directory"\map_video6.mpg
>
>
> Dan.
>
>
>
>
>
>
>
>
>
>
>
> *
> *
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

ffmpeg-20191209-114347 report.txt (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Converting pictures to video

Dan Bridges
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.*
*

*
*

**






_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".