title: Use FFMPEG to restream RTMP source to YouTube - no video stream in output
body: <p>I am attempting to grab the .m3u8 file from an nginx-rtmp server and pass it along to YouTube rtmp. I believe this to be possible (for example here: <a href="https://stackoverflow.com/a/11978820/1552594">https://stackoverflow.com/a/11978820/1552594</a> although this is on the same host). The command I am using is:</p>
  <pre><code>ffmpeg -analyzeduration 0 -i \
  http://source.rtmp.server/hls/stream.m3u8 -pix_fmt yuv420p \ 
  -f flv rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx
  </code></pre>
  <p>However the output contains only audio and YouTube doesn't like it. The command produces following:</p>
  <p><a href="https://i.stack.imgur.com/mff1R.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mff1R.jpg" alt="NOOO VIDEOOOO" /></a></p>
  <p>As you can see no Video stream in output metadata, stream mapping shows only audio and the trace shows 0kb of Video for 651kb of Audio</p>
  <p>Any help much appreciated</p>
  <h3>MORE INFO</h3>
  <p>Improved version of the command lifted from this article:</p>
  <p><a href="https://judge2020.com/restreaming-a-m3u8-hls-stream-to-youtube-using-ffmpeg/" rel="nofollow noreferrer">https://judge2020.com/restreaming-a-m3u8-hls-stream-to-youtube-using-ffmpeg/</a></p>
  <p>&quot;Restreaming a m3u8 HLS stream to Youtube using FFMPEG&quot; AKA exactly what I am trying to do.</p>
  <p>The command I am sending is now:</p>
  <pre><code>ffmpeg -re -i &quot;http://source.rtmp.server/hls/stream.m3u8&quot; \ 
  -strict -2 -c:v copy -c:a aac -ar 44100 -ab 128k -ac 2 -flags \ 
  +global_header -bsf:a aac_adtstoasc -bufsize 3000k -f flv \ 
  &quot;rtmp://a.rtmp.youtube.com/live2/xxx-xxxx-xxxx-xxxx&quot;
  </code></pre>
  <p>I got pretty much exactly the same response except with the Audio being read and output using <code>aac</code> codec.</p>
  <p><a href="https://i.stack.imgur.com/NVR0f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NVR0f.png" alt="enter image description here" /></a></p>
  <h3>MORE MORE INFO</h3>
  <p>I have found that adding a mapping can force the video stream into the output:</p>
  <pre><code>ffmpeg -re -i &quot;http://source.rtmp.server/hls/stream.m3u8&quot; \
  -strict -2 -c:v copy -c:a -map 0:0 -map 0:1 -ar 44100 -ab 128k -ac 2 \ 
  -flags +global_header -bsf:a aac_adtstoasc -bufsize 1000k \
  -f flv &quot;rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx&quot;
  </code></pre>
  <p>This throws up the error that has presumably been resulting in the video stream being silently dropped:</p>
  <p><a href="https://i.stack.imgur.com/LW5iL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LW5iL.png" alt="enter image description here" /></a></p>