Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using youtube-dl and ffmpeg (or vlc) to transcode a YouTube live stream to rtsp rtmp udp rtp

I'm trying to use youtube-dl to transcode the YouTube NASA ISS live stream (or any YouTube stream) to rtmp or rtsp. I think I have the right command but for some reason I can't get anything to connect to my newly transcoded stream.

Here's the command I'm using:

youtube-dl -f best "https://youtu.be/RtU_mdL2vBM" -o - | ffmpeg -re -f mp4 -i pipe:0 -ar 44100 -f flv rtmp://localhost:1935/test/test'

The command appears to work and I see information about the stream files opening from YouTube but when I use the command below, vlc reports that it is unable to connect to the stream.

vlc rtmp://localhost:1935/test/test

If I use this next command the stream plays correctly in vlc and I can see that the youtube-dl part is functioning.

youtube-dl -o - "https://youtu.be/RtU_mdL2vBM" | vlc -

or simply just

vlc -vvv https://youtu.be/RtU_mdL2vBM

So it seems that ffmpeg is the issue or maybe I need a streaming server between the transcode and my desired destination (vlc or TouchDesigner). I've also tried using vlc in place of ffmpeg/youtube-dl:

vlc -vvv https://youtu.be/RtU_mdL2vBM --sout '#transcode{vcodec=h264,vb=800,acodec=none}:rtp{sdp=rtsp://:554/test}'

or

youtube-dl -o - "https://youtu.be/RtU_mdL2vBM" | vlc - --sout '#transcode{vcodec=h264,vb=800,acodec=none}:rtp{sdp=rtsp://:554/test}'

and view with

vlc rtsp://localhost:554/test

Unfortunately I haven't been able make either of those methods work. I can't even see the stream in vlc if I try to duplicate it like this:

vlc -vvv https://youtu.be/RtU_mdL2vBM --sout '#duplicate{dst=display,dst="#transcode{vcodec=h264,vb=800,acodec=none}:rtp{,sdp=rtsp://:554/test}"}'

Any advice would be greatly appreciated. Thanks!

EDIT Here's the ffmpeg log as requested. The program continues to run without error so I interrupted it after a about a minute.

ffmpeg version N-91805-g7bb90a9449 Copyright (c) 2000-2018 the FFmpeg developers


built with gcc 8.2.1 (GCC) 20180813
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 19.100 / 56. 19.100
  libavcodec     58. 27.101 / 58. 27.101
  libavformat    58. 18.100 / 58. 18.100
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 26.100 /  7. 26.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[youtube] RtU_mdL2vBM: Downloading webpage
[youtube] RtU_mdL2vBM: Downloading video info webpage
[youtube] RtU_mdL2vBM: Downloading m3u8 information
[youtube] RtU_mdL2vBM: Downloading MPD manifest
[youtube] RtU_mdL2vBM: Downloading MPD manifest
[download] Destination: -
ffmpeg version N-91805-g7bb90a9449 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20180813
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 19.100 / 56. 19.100
  libavcodec     58. 27.101 / 58. 27.101
  libavformat    58. 18.100 / 58. 18.100
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 26.100 /  7. 26.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[hls,applehttp @ 0000025043b5b8c0] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083785/goap/clen%3D82062%3Blmt%3D1536264500502461/govp/clen%3D1207415%3Blmt%3D1536264500502461/dur/5.000/file/seg.ts' for reading
[hls,applehttp @ 0000025043b5b8c0] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083786/goap/clen%3D82114%3Blmt%3D1536264505368820/govp/clen%3D921521%3Blmt%3D1536264505368820/dur/5.000/file/seg.ts' for reading
Input #0, hls,applehttp, from 'https://manifest.googlevideo.com/api/manifest/hls_playlist/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/dover/11/playlist_duration/30/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8':
  Duration: N/A, start: 77339.207089, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 90k tbn, 120 tbc
    Metadata:
      variant_bitrate : 0
Output #0, mpegts, to 'pipe:':
  Metadata:
    encoder         : Lavf58.18.100
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 60 fps, 60 tbr, 90k tbn, 90k tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[https @ 00000250440f9400] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083787/goap/clen%3D82559%3Blmt%3D1536264513336444/govp/clen%3D1159272%3Blmt%3D1536264513336444/dur/5.000/file/seg.ts' for reading
[https @ 00000250440f9400] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083788/goap/clen%3D82284%3Blmt%3D1536264515970806/govp/clen%3D806499%3Blmt%3D1536264515970806/dur/5.000/file/seg.ts' for reading
[https @ 00000250442e6580] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083789/goap/clen%3D86065%3Blmt%3D1536264520896201/govp/clen%3D858826%3Blmt%3D1536264520896201/dur/5.250/file/seg.ts' for reading
[https @ 0000025044549a80] Opening 'https://manifest.googlevideo.com/api/manifest/hls_playlist/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/dover/11/playlist_duration/30/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8' for reading
    Last message repeated 1 times
[https @ 00000250442e6580] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083790/goap/clen%3D84751%3Blmt%3D1536264525099796/govp/clen%3D1149917%3Blmt%3D1536264525099796/dur/5.168/file/seg.ts' for reading
[https @ 0000025044549a80] Opening 'https://manifest.googlevideo.com/api/manifest/hls_playlist/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/dover/11/playlist_duration/30/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8' for reading
[https @ 00000250442e6580] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083791/goap/clen%3D86308%3Blmt%3D1536264531550269/govp/clen%3D1347646%3Blmt%3D1536264531550269/dur/5.250/file/seg.ts' for reading
[https @ 0000025044549a80] Opening 'https://manifest.googlevideo.com/api/manifest/hls_playlist/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/dover/11/playlist_duration/30/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8' for reading
[https @ 00000250442e6580] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083792/goap/clen%3D63862%3Blmt%3D1536264536697249/govp/clen%3D1011009%3Blmt%3D1536264536697249/dur/3.835/file/seg.ts' for reading
[https @ 0000025044549a80] Opening 'https://manifest.googlevideo.com/api/manifest/hls_playlist/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/dover/11/playlist_duration/30/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8' for reading
[https @ 00000250442e6580] Opening 'https://r1---sn-a5meknsd.googlevideo.com/videoplayback/id/RtU_mdL2vBM.2/itag/301/source/yt_live_broadcast/requiressl/yes/ratebypass/yes/live/1/cmbypass/yes/goi/160/sgoap/gir%3Dyes%3Bitag%3D140/sgovp/gir%3Dyes%3Bitag%3D299/hls_chunk_host/r1---sn-a5meknsd.googlevideo.com/playlist_type/DVR/gcr/us/ei/LImRW8WTKNbCkgaX_oXQBQ/initcwndbps/11730/mm/32/mn/sn-a5meknsd/ms/lv/mv/m/pl/20/manifest_duration/30/keepalive/yes/mt/1536264380/disable_polymer/true/ip/76.81.240.50/ipbits/0/expire/1536286092/sparams/ip,ipbits,expire,id,itag,source,requiressl,ratebypass,live,cmbypass,goi,sgoap,sgovp,hls_chunk_host,playlist_type,gcr,ei,initcwndbps,mm,mn,ms,mv,pl/signature/0D92427B34C835DDD58D1ABFA8D1E131151867C1.359F90D7EB3E1E31A3BF19320022B95DF24E959E/key/dg_yt0/playlist/index.m3u8/sq/7083793/goap/clen%3D82043%3Blmt%3D1536264538567230/govp/clen%3D1385870%3Blmt%3D1536264538567230/dur/4.999/file/seg.ts' for reading
Error writing trailer of pipe:: Immediate exit requested.52 bitrate=2034.6kbits/s speed=1.41x
frame= 2670 fps= 86 q=-1.0 Lsize=   11385kB time=00:00:44.49 bitrate=2095.9kbits/s speed=1.44x
video:9580kB audio:695kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 10.808865%
Exiting normally, received signal 2.
[ffmpeg] Interrupted by user
[download] 100% in 00:32
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002c5ceebaa40] moov atom not found
pipe:0: Invalid data found when processing input
Exiting normally, received signal 2.
like image 976
Matthew Wachter Avatar asked Nov 08 '22 02:11

Matthew Wachter


1 Answers

Well, the solution ended up being pretty simple. Here's the correct way to write the command (I was missing a '=' after the --sout option and didn't need the quotes around the parameters; this is different in linux):

youtube-dl -o - "https://www.youtube.com/watch?v=UQt2iLKqBbI" | vlc - --sout=#transcode{vcodec=h264,vb=800,acodec=none}:rtp{sdp=rtsp://:554/test}

Strange thing is that I still haven't been able to get ffmpeg to do the transcode. Maybe I have some incorrect options there?

Also, if I try to get the stream with vlc using the command below, I only get a small cropped section of the top left corner of the image.

vlc -vvv https://youtu.be/RtU_mdL2vBM --sout=#transcode{vcodec=h264}:rtp{sdp=rtsp://:554/test}

I'm curious if anyone knows why I wouldn't be able to get ffmpeg to work or why the image would be cropped when using vlc to get the stream rather than youtube-dl.

EDIT There's another command line tool called livestreamer that seems to be a bit more reliable: http://docs.livestreamer.io

Here's an example of how you might use it:

livestreamer --retry-streams 1 https://www.youtube.com/watch?v=UQt2iLKqBbI best -O | vlc - --sout=#transcode{vcodec=h264,vb=15000,acodec=none}:rtp{sdp=rtsp://:563/test,proto=udp}

You will probably need to edit the youtube plugin if you plan to use it though.

C:\Users[username]\AppData\Local\Programs\Python\Python35\Lib\site-packages\livestreamer\plugins\youtube.py

under _get_stream_info comment out "el": "player_embedded" in the "params" dictionary like so:

    params = {
        "video_id": video_id,
        #"el": "player_embedded"
    }

Thanks!

like image 163
Matthew Wachter Avatar answered Nov 15 '22 21:11

Matthew Wachter