Requirements: ffmpeg 4.3+ for crossfade. All commands tested on
4.4.1-3ubuntu1+20.04
I think that it is required that all videos(maybe audios) need to be the same resolution, framerate and all that. For my use case this is solved by pixabay
My specific goal here is to be able to use a site such as https://pixabay.com videos and mp3s to make long form videos with multiple songs
Obviously, you don't have to use pixabay. You probably don't have to use mp4s or mp3s, untested but ffmpeg should be able to figure it out, the commands do not use any codec specific flags.
The usage is "documented" above, the rest of this document is just to help the search engines
If you have a set of mp3 and some videos
# Convert many mp3s to 1 long mp3
crossfade_many_audio song1.mp3 song2.mp3 song3.mp3
# creates song1-song2-song3.wav
# for each song and video, make a video the same length as the song
extend_loop_to_audio loopvid1.mp4 song1.mp3
# creates loopvid1-for-song1-140.643250s.mp4 where the 140.643250s is the duration of song1 and now the new looped video
extend_loop_to_audio loopvid2.mp4 song2.mp3
extend_loop_to_audio loopvid3.mp4 song3.mp3
# Convert many mp4 to 1 long mp4
merge_videos loopvid1-for-song1-140.643250s.mp4 loopvid2-for-song2-138.579594s.mp4 loopvid3-for-song3-209.606531s.mp4 final.mp4
# creates final.mp4
# Add mp3 to mp4
merge_audio_video song1-song2-song3.wav final.mp4
# creates song1-song2-song3-final.mp4
# Convert many mp3s to 1 long mp3
crossfade_many_audio song1.mp3 song2.mp3 song3.mp3
# creates song1-song2-song3.wav
# make a video the same length as the long song from above
extend_loop_to_audio loopvid1.mp4 song1-song2-song3.wav
# creates loopvid1-for-song1-140.643250s.mp4 where the 140.643250s is the duration of song1 and now the new looped video
# Add mp3 to mp4
merge_audio_video song1-song2-song3.wav loopvid1-for-song1-140.643250s.mp4
# creates song1-song2-song3-loopvid1-for-song1-140.643250s.mp4
ffmpeg loop video for audio duration ffmpeg merge audio and video ffmpeg get duration ffmpeg crossfade audio -> SOURCE: https://romander.github.io/ffmpeg-script-generator/ ffmpeg concat video ffmpeg concat audio