FFMPEG конвертировать поток rtp в rtmp - привязать ошибочный адрес, который уже используется - PullRequest
0 голосов
/ 10 апреля 2020

Я устанавливаю сервер с шлюзом Janus и использую плагин videoroom. Я пытаюсь локально переслать поток rtp, используя порт 5002 для аудио и 5004 для видео. Это конфигурация плагина videoroom

    room-1234: {
        description = "Demo Room"
        secret = "adminpwd"
        publishers = 6
        bitrate = 128000
        fir_freq = 1
        #fir_freq = 10
        audiocodec = "opus"
        videocodec = "vp8"
        #videocodec = "h264"
        record = false
        #rec_dir = "/path/to/recordings-folder"
}

После пересылки RTP я хотел бы преобразовать видео в rtmp для удаленного получения видео с помощью OBS Studio, и я настроил сервер nginx с плагином rtmp. Используя ffmpeg, я пытаюсь сделать это преобразование, и я создал файл sdp с таким содержанием:

v=0
o=- 0 0 IN IP4 127.0.0.1
s=RTP Video
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 58.29.100
m=audio 5002 RTP/AVP 111
a=rtpmap:111 OPUS/48000/2
m=video 5004 RTP/AVP 100
a=rtpmap:100 VP8/90000
a=fmtp:100

И затем я запустил команду

ffmpeg -protocol_whitelist rtp,udp,file -loglevel trace -analyzeduration 300M -probesize 300M -i config.sdp -c:v copy -c:a aac -ar 16k -ac 1 -preset ultrafast -tune zerolatency rtmp://127.0.0.1/live/1234

Но я получил ошибку Не удалось связать адрес, который уже используется. Ниже полного вывода

built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Splitting the commandline.
Reading option '-protocol_whitelist' ... matched as AVOption 'protocol_whitelist' with argument 'rtp,udp,file'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'.
Reading option '-analyzeduration' ... matched as AVOption 'analyzeduration' with argument '300M'.
Reading option '-probesize' ... matched as AVOption 'probesize' with argument '300M'.
Reading option '-i' ... matched as input url with argument 'config.sdp'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '16k'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '1'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'.
Reading option '-tune' ... matched as AVOption 'tune' with argument 'zerolatency'.
Reading option 'rtmp://127.0.0.1/live/1234' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input url config.sdp.
Successfully parsed a group of options.
Opening an input file: config.sdp.
[NULL @ 0x5594280] Opening 'config.sdp' for reading
Probing sdp score:50 size:205
[sdp @ 0x5594280] Format sdp probed with size=2048 and score=50
[sdp @ 0x5594280] sdp: v='0'
[sdp @ 0x5594280] sdp: o='- 0 0 IN IP4 127.0.0.1'
[sdp @ 0x5594280] sdp: s='RTP Video'
[sdp @ 0x5594280] sdp: c='IN IP4 127.0.0.1'
[sdp @ 0x5594280] sdp: t='0 0'
[sdp @ 0x5594280] sdp: a='tool:libavformat 58.29.100'
[sdp @ 0x5594280] sdp: m='audio 5002 RTP/AVP 111'
[sdp @ 0x5594280] sdp: a='rtpmap:111 OPUS/48000/2'
[sdp @ 0x5594280] audio codec set to: opus
[sdp @ 0x5594280] audio samplerate set to: 48000
[sdp @ 0x5594280] audio channels set to: 2
[sdp @ 0x5594280] sdp: m='video 5004 RTP/AVP 100'
[sdp @ 0x5594280] sdp: a='rtpmap:100 VP8/90000'
[sdp @ 0x5594280] video codec set to: vp8
[sdp @ 0x5594280] sdp: a='fmtp:100'
[udp @ 0x5597980] bind failed: Address already in use
[AVIOContext @ 0x559d580] Statistics: 205 bytes read, 0 seeks
config.sdp: Invalid data found when processing input

Я сделал много поисков и попыток, но я действительно не могу понять, что не так. Не могли бы вы помочь мне понять ошибку?

Спасибо!

...