0

Using ffmpeg, I've tried to combine a video file (with audio) and a 7-channel audio file without success.

my command:
ffmpeg -i input0.avi -i input1.wav -c:v copy -map 0:v:0 -map 1:a:0 -preset slow -ar 48000 -ab 1536k -ac 2 output.avi

I got the output.avi file with only 2 stereo audio channels.

What should I do to get all 7 channels in the output files?

2
  • You should try extracting audio from video, combine it with the 7ch audio and merge it back. (This is a suggestion from a noob, but can still work) Commented Aug 16, 2021 at 13:31
  • Copy and paste all of the text from the log.
    – llogan
    Commented Aug 16, 2021 at 17:22

1 Answer 1

0

In your command you explicitly set the audio channels to 2.

Remove the parameter -ac 2 and you are basically done.

Aside from that there are other issues in your command you might want to correct as well.

  • A preset does nothing in compination with copying a video stream. Just leave out -preset slow
  • You don't define the audio codec. ffmpeg falls back to the default which is aac. This is not always bad but you may need something else. It is always recommendable to specify the desired codec by adding -c:a PASTE_CODEC_HERE. So if for compatibility reasons you need ac3, it'd be -c:a ac3.

BTW your command completely dumps the 2-channel audio from the original file. Not sure if that is your intention. Also note you use a deprecated option to set the bitrate. Better replace -ab with -b:a. The functionality is the same, but the latter is the official syntax now.

4
  • Thank you, Malte, for the input.
    – Surin B
    Commented Aug 20, 2021 at 6:36
  • I've removed both '-ac 2' and '-preset slow'. The resolve is still the same, stereo sound not 5.1.
    – Surin B
    Commented Aug 20, 2021 at 6:44
  • Well, you coud try forcing the channel setup with -ac 8, but if ffmpeg automatically sets to 2 channels, indicates the program doesn't recognize more channels in your file. FFmpeg should find the number of channels in the input audio and set the channels for the output correspondingly (ffmpeg.org/ffmpeg.html#AVOptions) . Maybe there is some issue with the input file. Please post more details about that, e.g. what does ffprobe say about it.
    – Malte
    Commented Aug 20, 2021 at 10:40
  • Thank you, Malte. I'd solved the issue by combining them into *.mkv file and it worked.
    – Surin B
    Commented Aug 25, 2021 at 10:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .