11

I'm on Arch Linux 4.13.10 and I'd like to combine multiple .MOV files shot with a Canon EOS camera.

I tried to convert the files to transport streams (.ts files) using FFmpeg, as shown here, but sound was missing from the resulting file.

I'd prefer if the resulting file would be .mp4, but this is not strictly required.

How do I do this?

0

2 Answers 2

18

I succeeded merging the files using FFmpeg's demuxing feature. For .mp4 conversion, I had to explicitly convert the audio stream to avoid this error:

Could not find tag for codec pcm_s16le in stream #1, codec not currently supported in container

This is the command combining the files to merged.mp4:

ffmpeg -f concat -i files_to_combine.txt -vcodec copy -acodec aac -strict -2 -b:a 384k merged.mp4

If the output file can be also a .MOV file, the command is:

ffmpeg -f concat -i files_to_combine.txt -vcodec copy -acodec copy merged.MOV

Here's the content of the text file files_to_combine.txt:

file ./first_file.MOV
file ./second_file.MOV

If you get the error

Unsafe file name 'file with spaces.mov' files_to_combine.txt: Operation not permitted

and trust the file names, you can add -safe 0 to get around this error. See FFmpeg's man page:

ffmpeg -safe 0 -f concat ...

Shorter commands

Trying the same task five years later, I also had success with

ffmpeg -f concat -i files_to_combine.txt merged.mov

and

ffmpeg -f concat -i files_to_combine.txt -f mp4 merged.mp4
3
  • From the single MOV, you can use mp4box to get a MP4. mp4box -add merged.mov -new merged.mp4
    – Gyan
    Oct 4, 2017 at 19:42
  • I get: [concat @ 0x55ba4a488b40] Line 1: unknown keyword 'IMG_9847.MOV' files_to_combine.txt: Invalid data found when processing input
    – Nathan B
    Apr 28 at 9:15
  • @NathanB: I'm pretty sure you forgot the keyword "file" in front of your file names in files_to_combine.txt. Apr 28 at 18:55
1
find *.MOV | sed 's:\ :\\\ :g'| sed 's/^/file /' > fl.txt; ffmpeg -f concat -i fl.txt -c copy output.mp4; rm fl.txt
4
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review Jul 24, 2021 at 2:49
  • No, it does many .MOV to single .MP4 conversion
    – Danil
    Jul 25, 2021 at 18:48
  • 2
    I had to change the output to .mov to get it to work, like: find *.MOV | sed 's:\ :\\\ :g'| sed 's/^/file /' > fl.txt; ffmpeg -f concat -i fl.txt -c copy output.mov; rm fl.txt Jan 27, 2022 at 10:45
  • yes the fl.txt file should include in every line the word 'file ' before the file name
    – Nathan B
    Apr 28 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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