0

As part of my application the user should be able to select a range of images and video, and merge them into a single video. The images are transformed into 5-second long fragments of video. All these can be in different resolutions, and possibly formats as well.

I have some of the parts of the process already:

  • Turn image into video with loop 1 -i image.png -r 1 -t 5 imageAsVideo.mp4

  • Concatenate videos (of possibly different formats): -i movie1.mp4 -i movie2.mp4 -filter_complex "[0:v:0][1:v:0]concat=n=2:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" concatenatedMovies.mp4

However, now I do these steps one after the other, and I don't know how/where to add the scale or scale2ref filters. Keeping the audio for the video streams is yet another concern. I assume I'll have to add a dummy audio stream to the "image" videostreams, but that makes things even more complex.

Is there a way to do all this in one command? What order should the different filters be in?

HDW
  • 308
  • 2
  • 14
  • ffmpeg on the command line is just to get folks up and running ... for the power move when things get complex you can always roll up your sleeves and write code to use ffmpeg as a library ... https://github.com/FFmpeg/FFmpeg ... as with any super useful low level repo people have written wrappers in all the usual suspect languages – Scott Stensland May 14 '20 at 10:55
  • @ScottStensland This is an Android project, so I'm actually using https://github.com/tanersener/mobile-ffmpeg/. But still, your recommendation is to look into one of those libraries from the FFmpeg github as they provide easier-to-use functions? – HDW May 14 '20 at 14:38
  • probably not easier to use functions, no ... alternative forums for ffmpeg questions are https://superuser.com/questions/tagged/ffmpeg and the link called libav-user on https://ffmpeg.org/contact.html#Forums – Scott Stensland May 14 '20 at 15:13
  • 1
    Convert all inputs to the same set of attributes. See duplicate links for examples. As for filter order it does matter as it can make a speed difference. For example, if you are downscaling **and** increasing the frame rate you should use scale filter before fps filter, otherwise fps then scale in this particular situation would be slower. – llogan May 14 '20 at 17:51
  • @llogan Thanks, i'll look into things! – HDW May 15 '20 at 07:21

0 Answers0