0

I need to concatenate some MP4 files. Only one of them has audio. The other ones hasn't.

MyList.txt contains: file1.mp4 without audio and 5s length File2.mp4 without audio and 5s length File3.mp4 without audio and 5s length File4.mp4 with audio and Ns length

I need an output that cotains the 4 mp4 files and when file4.mp4 starts I want to hear its audio.

If I set the file4.mp4 as the first video to concat, the output video has audio, but If I set the file4.mp4 in another position, the output video hasn't audio.

What I'm doing wrong? What I have to modify in my code?

ffmpeg -f concat -safe 0 -i myList.txt -c:v copy -c:a copy output.mp4
Pimager
  • 169
  • 1
  • 3
  • 12

1 Answers1

0

Have you tried generating a silent track for your mp4 files without any sound and then concatenating them?

ffmpeg -i "clip.mp4" -f lavfi -i aevalsrc=0 -shortest -y "new_clip.mp4"

This does the following:

  • Take clip.mp4 (which is the video clip without audio) (-i "clip.mp4")
  • Generate the minimum silence required (-f lavfi -i aevalsrc=0 -shortest)
  • Output the result (-y "new_clip.mp4")

Same problem but asked on stack exchange: Link

Broader explanation can be found here: second link

Lloyd
  • 1,119
  • 10
  • 29