Аналогично этот вопрос , я пытаюсь транслировать на Youtube / Facebook live (rtmp) через Ffmpeg.
Сервер, на котором установлен ffmpeg, получает поток rtp (источник потока использует Vp8 и opus в качестве кодеков), затем я использую sdp, указанный ниже, в качестве входных данных для команды ffmpeg
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=FFMPEG Test
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 56.15.102
m=audio 10004 RTP/AVP 111
a=rtpmap:111 OPUS/48000/2
m=video 10006 RTP/AVP 100
a=rtpmap:100 VP8/90000
a=fmtp:100 packetization-mode=1
, где 10004 и 10006 являются аудио и видеопорт входного потока rtp.
Я использую следующую команду FFMPEG для потоковой передачи на YouTube / Facebook Live
ffmpeg -protocol_whitelist file,crypto,udp,rtp -i input.sdp -c:a aac -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv "rtmp_url"
Журнал:
ffmpeg version 4.2.2-1build1~18.04.sav0 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/usr --extra-version='1build1~18.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
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
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[sdp @ 0x56083912d340] Could not find codec parameters for stream 1 (Video: vp8, yuv420p): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, sdp, from 'input.sdp':
Metadata:
title : FFMPEG Test
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
Stream #0:1: Video: vp8, yuv420p, 90k tbr, 90k tbn, 90k tbc
Codec AVOption profile () specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption g (set the group of picture (GOP) size) specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption preset (Configuration preset) specified for output file #0 (youtube_rtmp_url) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
Stream #0:0 -> #0:0 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, flv, to 'youtube_rtmp_url':
Metadata:
title : FFMPEG Test
encoder : Lavf58.29.100
Stream #0:0: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.54.100 aac
av_interleaved_write_frame(): Broken pipe 134.5kbits/s speed=2.35x
[flv @ 0x5608391a7040] Failed to update header with correct duration.
[flv @ 0x5608391a7040] Failed to update header with correct filesize.
Error writing trailer of youtube_rtmp_url: Broken pipe
size= 162kB time=00:00:09.86 bitrate= 134.2kbits/s speed=2.32x
video:0kB audio:155kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.493091%
[aac @ 0x5608391a7ac0] Qavg: 247.499
Conversion failed!
I Я проверил, что ffmpeg может читать поток, я использовал другую команду ffmpeg для записи потока, и это работает хорошо. Может кто-нибудь указать, что не так, или ссылку на документацию, которая может помочь?