3

У меня есть два живых аудиопотока, они оба являются потоками MONO. Теперь я хочу, чтобы эти два потока объединялись в один поток и выводились в один новый поток.

Я объединяю два входных потока с помощью следующей команды:

ffmpeg -i rtmp://myIp:1935/live/stream1 -i rtmp://myIp:1935/live/stream2 -codec:a aac -strict -2 -filter_complex "[0:a][1:a]amerge" -f flv rtmp://myIp:1935/live/myStream

Вышеприведенная команда работает, но когда я слушаю новый поток, т.е. myStream , оба потока могут слушать, но в отдельном канале. Означает, что stream1 находится только в левом канале, а stream2 только в правом канале.

Я хочу, чтобы и входной поток stream1, и stream2 были доступны обоим каналам (влево и вправо).

Я много пробовал, но не смог добиться успеха, и я не очень хорош в ffmpeg . Так есть ли кто-нибудь, кто может помочь мне в этом ???

Вывод моего утешения:

ffmpeg version 1.0.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec  5 2012 21:11:26 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[flv @ 0x7fb85c01e200] max_analyze_duration 5000000 reached at 5008000
[flv @ 0x7fb85c01e200] Could not find codec parameters for stream 0 (Video: none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv @ 0x7fb85c01e200] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'rtmp://192.168.0.62:1935/live/stream1':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: none, 1k tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: nellymoser, 16000 Hz, mono, flt
[flv @ 0x7fb85c01aa00] max_analyze_duration 5000000 reached at 5024000
[flv @ 0x7fb85c01aa00] Could not find codec parameters for stream 0 (Video: none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv @ 0x7fb85c01aa00] Estimating duration from bitrate, this may be inaccurate
Input #1, flv, from 'rtmp://192.168.0.62:1935/live/stream2':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: none, 1k tbr, 1k tbn, 1k tbc
    Stream #1:1: Audio: nellymoser, 16000 Hz, mono, flt
[Parsed_amerge_0 @ 0x7fb85bc21d20] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Output #0, flv, to 'rtmp://192.168.0.62:1935/live/myStream':
  Metadata:
    encoder         : Lavf54.29.104
    Stream #0:0: Audio: aac ([10][0][0][0] / 0x000A), 16000 Hz, stereo, flt, 128 kb/s
Stream mapping:
  Stream #0:1 (nellymoser) -> amerge:in0
  Stream #1:1 (nellymoser) -> amerge:in1
  amerge -> Stream #0:0 (aac)
Press [q] to stop, [?] for help

1 ответ1

4

Измените amerge на amix чтобы смешать входы в один канал. Затем добавьте -ac 2 для получения 2-канального стерео выхода.

ffmpeg -i rtmp://myIp:1935/live/stream1 -i rtmp://myIp:1935/live/stream2 -codec:a aac -strict -2 -filter_complex "[0:a][1:a]amix" -ac 2 -f flv rtmp://myIp:1935/live/myStream

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .