Merge video clips together with FFMPEG’s concat, where some clips have no audio

I have a grouping of files in a videos.txt file:

file 'title.mp4'
file 'welcome.mp4'
file 'introductions_slide.mp4'
file 'introductions.mp4'
file 'presentation_part_1_slide.mp4'
file 'presentation_part_1.mp4'
file 'presentation_part_2_slide.mp4'
file 'presentation_part_2a.mp4'
file 'presentation_part_2b.mp4'
file 'questions_and_answers_slide.mp4'
file 'questions_and_answers.mp4'

Some of these files (title.mp4, introductions_slide.mp4, presentation_part_1_slide.mp4, presentation_part_2_slide.mp4 and questions_and_answers_slide.mp4) are generated from PowerPoint’s export to MP4 files and do not contain an audio stream.

I tried to follow this thread to add an audio stream to title.mp4, but when I then run the concat command, it’s full of errors in the input stream. The resulting file is a silent one with no audio stream.

I know it’s possible to merge a mixed silent-noise audio video files together because I was able ot achieve it in QuickTime. However, I am trying to figure out how to do it using ffmpeg.

Here’s my current concat command:

ffmpeg -f concat -i videos.txt -c:v copy -c:a copy output.mp4

How can I run concat so that it will include the audio where audio is present, but maintain silence where it isn’t?

Read more here: Source link