3

There is a webm file that contains no audio. I want to merge an audio file with this video. I've tried the following command:

ffmpeg -i /home/test.mp3  -i /home/output.webm -vcodec copy -acodec copy /home/newtest.webm

And received the error:

Could not write header for output file #0 (incorrect codec parameters ?):         Invalid argument.
MiningSam
  • 583
  • 2
  • 7
  • 22
showkey
  • 482
  • 42
  • 140
  • 295
  • 1
    Do you want the output file to have .mp3 audio? Or would you prefer vorbis (or perhaps opus)? -acodec copy suggests you're trying to maintain the audio codec, but mp3 in webm is not a valid combination, and I guess the error is a direct result of that. Removing "-acodec copy" might well fix it, or using "-strict experimental". Extra bonus points for using newer syntax: -c:v copy instead of -vcodec copy (http://superuser.com/a/277667). – Ronald S. Bultje Aug 05 '15 at 19:18
  • Full console output please? – rogerdpack Aug 11 '15 at 16:06

2 Answers2

5
ffmpeg -y -i vFilePath -i aFilePath -map 0:0 -map 1:0 -c copy oFilename

Where:

  • vFilePath: path of the video file
  • aFilePath: path of the audio file
  • oFilePath: path of the output file
llogan
  • 121,796
  • 28
  • 232
  • 243
not-a-robot
  • 321
  • 1
  • 14
  • 2
    `[0:0]` and `[1:0]` may refer to any stream type, depending on the stream order. Better to use `[0:v]` and `[1:a]`. See [`-map` option documentation](https://ffmpeg.org/ffmpeg.html#Advanced-options). – llogan Aug 12 '15 at 15:38
1

If you're fine with using a UI, you can get VLC. Then under Media -> Save/Convert add both files. In the following menu's it should ask which audio and video streams to put into the new file, as well as the format for the file, which would probably be webm again.

VLC also has a command line interface, if you want automation.

Berserker
  • 1,112
  • 10
  • 26