[FFmpeg-user] concatenate png files for different durations?

Tom Evans tevans.uk at googlemail.com
Fri Mar 14 10:49:23 CET 2014


On Fri, Mar 14, 2014 at 1:58 AM, Spencer Graves
<spencer.graves at prodsyse.com> wrote:
>       How can I display a sequence of png files for different time durations
> and mate them with a single audio?
>
>
>       Attached is a toy example:  I want to display tst1.png for 0.5 seconds
> followed by tst2.png for 1.5 seconds and merge that video with the audio in
> tst2.mp2.
>
>
>       If I don't care about the display time for each image, I can merge
> these 2 png and 1 mp2 files with "ffmpeg -y -r 1 -i tst.mp2 -r 2 -i
> tst%d.png -b 300k tst.mp4".
>
>
>       The documentation describes "concat" for filter, demuxer, protocol,
> and raw.  I was unable to see how any of these would solve this problem.
>
>
>       Thanks,
>       Spencer
>
>
> p.s.  I'm using ffmpeg version N-61163-gd1122b7 Copyright (c) 2000-2014 the
> FFmpeg developers built on Mar  7 2014 22:01:29 with gcc 4.8.2 (GCC) under
> Windows 7 Home Edition with a dual core Intel processor, 8 GB RAM, and lots
> of free hard drive.
>

Create a directory and place one png file per the smallest duration
that you want for a single image. Use this duration as your input
frame-rate.

If you want a particular image to repeat for multiple input frames,
put the image in the directory twice. On a more feature-full OS, you
could do this without copying by symlinking the file in place.

Eg, for your example:

mkdir sources
cp tst1.png sources/00001.png
cp tst2.png sources/00002.png
cp tst2.png sources/00003.png
cp tst2.png sources/00004.png

ffmpeg -r 2 -i sources/%05d.png -r 30 -pix_fmt yuv420p out.mp4

Cheers

Tom


More information about the ffmpeg-user mailing list