can you please check this out.

ffmpeg -y -i 21653634-merge.mp4 -i dreamy.mp3 -map 0:0 -map 1:0 -c:v copy -preset ultrafast -async 1 out.mp4

I am trying merge video and audio. It is by the way merging, but what I am trying to achieve is the music should repeat until the video ends. I tried the solution from this posts, but I am getting an error.


As simple as

ffmpeg -y -i 21653634-merge.mp4 -stream_loop -1 -i dreamy.mp3 -map 0:v -map 1:a -c:v copy -shortest -fflags -max_interleave_delta 100M out.mp4

| improve this answer | |
  • Hi, tried the command you commented and it's not stopping. frame= 925 fps=5.5 q=-1.0 size= 99584kB time=01:36:17.53 bitrate= 141.2kbits/ frame= 925 fps=5.5 q=-1.0 size= 99840kB time=01:36:34.64 bitrate= 141.1kbits/ s speed=34.5x – Buu Nov 19 '19 at 15:58
  • Edited cmd..... – Gyan Nov 19 '19 at 16:00
  • Thank you very much! I have lots of questions with ffmpeg. Hope you can help me. :) – Buu Nov 19 '19 at 16:02
  • Here's what I am trying to achieve. Is it possible to create this using ffmpeg superuser.com/questions/1501075/… cheers! – Buu Nov 19 '19 at 16:04
  • Input #1, mp3, from 'assets/music/dreamy.mp3': Metadata: comment : Audio recorded by Yout.com title : 6 Second Music (Loopable, Downloadable) for Vine Videos and other Short Videos encoder : Lavf57.83.100 Duration: 00:00:30.54, start: 0.000000, bitrate: 128 kb/s Stream #1:0: Audio: mp3, 48000 Hz, stereo, s16p, 128 kb/s videos/301432/21653634-final.mp4: Permission denied I am getting a permission denied in the live server. – Buu Nov 20 '19 at 8:32

The easiest ways is to use the concat format for the input: Create a file called dreamy.ffconcat

file "dreamy.mp3"
file "dreamy.mp3"
file "dreamy.mp3"
file "dreamy.mp3"

besides dreamy.mp3. It must have enough lines to make sure you have enough repetitions, but it won't hurt if you have much too many.

Now use ffmpeg -y -i 21653634-merge.mp4 -f concat -i dreamy.ffconcat -map 0:v -map 1:a -c:v copy -preset ultrafast -async 1 -shortest out.mp4

| improve this answer | |
  • Thanks, will try this one too. – Buu Nov 20 '19 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.