0

I need make stereo from two wavs and convert result stereo to opus. I do :

ffmpeg -i in.wav -i out.wav -filter_complex "[0:a][1:a]join=inputs=2:channel_layout=stereo[a]" -map "[a]"  stereo.wav  &&  ffmpeg -i stereo.wav   -c:a libopus -ac 1 -ar 16000  -b:a 8k -vbr  constrained  record.opus

But record.opus doesn't look stereo.

If I execute two commands separately result file is stereo.

Dave M
  • 13,250
harp1814
  • 103

1 Answers1

2

There are two options, either join or amerge, but the one for join in the documentation appears not to work (as you've found). Here is an example for two working command lines:

  1. Create two audio test files. I've used sox but you can apparently use ffmpeg

    # 3 seconds each of a 1kHz and 1.5kHz tone
    sox -V -r 48000 -n -b 16 -c 2 left.wav synth 3 sin 1000 vol -10dB
    sox -V -r 48000 -n -b 16 -c 2 right.wav synth 3 sin 1500 vol -10dB
    
  2. Combine as stereo

    You can use join, where I've found that, contrary to the documentation, the map=… part is required:

    ffmpeg -i left.wav -i right.wav -filter_complex 'join=inputs=2:channel_layout=stereo:map=0.0-FL|1.0-FR' stereo.opus
    

    And you can use amerge:

    ffmpeg -i left.wav -i right.wav -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map "[a]" stereo.opus
    
Chris Davies
  • 4,560