从rtp流将FFMPEG转码VP8转换为H264

时间:2020-08-05 13:18:50

标签: ffmpeg youtube-api

我有一个rtp流,服务器正在2个单独的端口上接收音频和视频,视频在VP8中,音频在Opus中。

我的最终目标是将RTP流转换为RTMP,再将其转换为Youtube Live,但是Youtube Live仅支持H264 https://developers.google.com/youtube/v3/live/guides/ingestion-protocol-comparison,因此首先,我希望将我的RTP流转换为H264。

我已经运行了以下命令

ffmpeg -analyzeduration 300M -probesize 300M -protocol_whitelist file,udp,rtp -i test.sdp -c:v libx264  -pix_fmt yuv420p -r 25 -c:a aac -f flv youtube_rtmp_url

我的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 55.2.100
m=audio 50000 RTP/AVP 111
a=rtpmap:111 OPUS/48000
m=video 50002 RTP/AVP 100
a=rtpmap:100 VP8/90000
a=fmtp:100 packetization-mode=1

其中50000和50002是用于接收rtp视频和音频的端口。

日志输出:

ffmpeg version 4.3-3ubuntu1~18.04.sav0 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version='3ubuntu1~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-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray 
--enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d 
--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-librabbitmq --enable-librsvg 
--enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr 
--enable-libspeex --enable-libsrt --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-pocketsphinx --enable-crystalhd --enable-libmfx --enable-libdc1394 --enable-libdrm -- 
enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 -- 
enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
  [sdp @ 0x5649eef4b8c0] 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 'test.sdp':
     Metadata:
       title           : RTP Video
       Duration: N/A, start: 0.000000, bitrate: N/A
         Stream #0:0: Audio: opus, 48000 Hz, mono, fltp
         Stream #0:1: Video: vp8, yuv420p, 90k tbr, 90k tbn, 90k tbc
      [rtmp @ 0x5649eefd87c0] Cannot open connection tcp://a.rtmp.youtube.com:1935
      rtmp://a.rtmp.youtube.com/live2/_______: Immediate exit requested

我增加了'analyzeduration'和'probesize'值,错误没有改变。

0 个答案:

没有答案