Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
931 views
in Technique[技术] by (71.8m points)

ffmpeg - How to merge 2 streams and send the stream to youtube?

Trying to merge 2 rtmp url from one youtube account and sending the merged stream to another youtube account

Details:

  1. We enabled 2 youtube account with Go Live feature

  2. Used the larix Broadcaster mobile application to send the stream to the first youtube account

  3. This worked fine and we were able to see the stream on youtube

  4. We brought up the other youtube account and captured it's rtmp url

  5. We used the following command to take the stream broadcasted on the first account to stream to the other youtube account

    ffmpeg -re -i rtmp://a.rtmp.youtube.com/live2/{StreamKey 1} -i rtmp://a.rtmp.youtube.com/live2/{Stream Key1} -strict -2 -f flv rtmp://a.rtmp.youtube.com/live2/{Stream Key 2}

However, we are getting a response server validation failed on

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --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-nvenc --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
[rtmp @ 0x55e577487340] Server response validating failed
rtmp://a.rtmp.youtube.com/live2/{StreamKey 1}: Input/output error

Please clarify why the merging of 2 rtmp url is failing. Should we setup our own rtmp server to capture the input stream and then send the output stream to youtube?

question from:https://stackoverflow.com/questions/65851837/how-to-merge-2-streams-and-send-the-stream-to-youtube

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You cannot use an RTMP URL to receive a live stream (or a video-on-demand video) from YouTube.

URLs of the form rtmp://a.rtmp.youtube.com/live2/{StreamKey 1} are meant for you to push / publish a video stream to YouTube and not for you to receive a live stream from YouTube.

Therefore, you couldn't even use that rtmp://a.rtmp.youtube.com/live2/{StreamKey 1} as a single -i argument when you merely wanted to re-encode the video to a local file. It will not work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...