[FFmpeg-user] make a slideshow out of images and embed videos in it

mail-login+ffmpeg at protonmail.com mail-login+ffmpeg at protonmail.com
Tue Apr 7 16:12:52 EEST 2020


‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, April 7, 2020 7:02 AM, Moritz Barsnick <barsnick at gmx.net> wrote:

> On Mon, Apr 06, 2020 at 17:23:45 -0500, atticus via ffmpeg-user wrote:
> 

> > Now if I run the command to concatenate the slideshow with the normal video
> > ffmpeg tries to encode a very long output file (over 20 minutes, when I
> > abort) even though the input files only have a duration of less than 15
> > seconds in total. Therefore I thing it might be an issue with the framrerate
> > (even tough I think both, the slideshow and the normal video have a
> > framerate of 25 fps).
> 

> >     Stream #0:0: Video: h264 (High), yuv420p(progressive), 5184x3888, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
> >     

> 

> [...]
> 

> >     Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
> >     

> 

> You can't mix these inputs using the concat demuxer:
> https://trac.ffmpeg.org/wiki/Concatenate#demuxer
> All files must have the same streams (same codecs, same time base,
> etc.) but can be wrapped in different container formats.
> 

> The time bases are different (1k vs. 90k). There are options to adjust
> them though, you might be able to fix your first slideshow command.
> 

> Also, you resolutions are different. This may or may not lead to
> issues. But not this one perhaps. ;-)
> 

> Cheers,
> Moritz

Hi,

thanks for your quick response. It seems that the mkv container cannot have a timeBase thus it's difficult to concat videos from another container with videos of the mkv container.
My solution for this is to put the real video into a mkv container first and concat afterwards. So my steps to create a slideshow with images as well as images in it are:

1) Preprocess the images via a script that uses imagemagick to scale them and set the sampling factor

2) Preprocess the videos (so that they all have the same/right codecs and are in a mkv container)

3) Run this command for a connected sequence of images:
ffmpeg -safe 0 -f concat -i imgList -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 -c:v h264 -vsync vfr -pix_fmt yuv420p -vf fps=25 -shortest slideshow.mkv

4) Run this command to append the slideshow part to the existing output:
ffmpeg -safe 0 -f concat -i vidList -c copy finished.mkv

With the files
imgList: (last image is listed twice)
file /path/to/the/image/1.JPG
duration 2
file /path/to/the/image/2.JPG
duration 2
file /path/to/the/image/3.JPG
duration 2
file /path/to/the/image/4.JPG
duration 2
file /path/to/the/image/4.JPG


and vidList:
file /path/to/the/last/output
file ./slideshow.mkv

Execute the last two steps multiple times and if a Video is to be appended, just execute step 4 to append the Video (you might have to move and remove the outputfiles). And in the end you should have your slideshow with images and videos. (I didn't test this yet)

Thanks for your help (and for the help I finally found). Suggestions are always welcome ;)

With best wishes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: publickey - mail-login+ffmpeg at protonmail.com - 0xF3A8BCD0.asc
Type: application/pgp-keys
Size: 3216 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200407/ec6bc3f3/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 823 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200407/ec6bc3f3/attachment.sig>


More information about the ffmpeg-user mailing list