我正在尝试使用youtube-dl将YouTube NASA ISS直播(或任何YouTube流)转码为rtmp或rtsp。我认为我有正确的命令但由于某种原因我无法连接到我新转码的流。
这是我正在使用的命令:
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'
该命令似乎有效,我看到有关从YouTube打开的流文件的信息,但是当我使用下面的命令时,vlc报告它无法连接到流。
vlc rtmp://localhost:1935/test/test
如果我使用下一个命令,流在vlc中正确播放,我可以看到youtube-dl部分正在运行。
youtube-dl -o - "https://youtu.be/RtU_mdL2vBM" | vlc -
或者只是
vlc -vvv https://youtu.be/RtU_mdL2vBM
所以似乎ffmpeg是问题,或者我需要在转码和我想要的目的地(vlc或TouchDesigner)之间的流媒体服务器。我也尝试使用vlc代替ffmpeg / youtube-dl:
vlc -vvv https://youtu.be/RtU_mdL2vBM --sout '#transcode{vcodec=h264,vb=800,acodec=none}:rtp{sdp=rtsp://:554/test}'
要么
youtube-dl -o - "https://youtu.be/RtU_mdL2vBM" | vlc - --sout '#transcode{vcodec=h264,vb=800,acodec=none}:rtp{sdp=rtsp://:554/test}'
并查看
vlc rtsp://localhost:554/test
不幸的是,我无法使这些方法中的任何一个起作用。如果我尝试像这样复制它,我甚至无法在vlc中看到流:
vlc -vvv https://youtu.be/RtU_mdL2vBM --sout '#duplicate{dst=display,dst="#transcode{vcodec=h264,vb=800,acodec=none}:rtp{,sdp=rtsp://:554/test}"}'
任何建议将不胜感激。谢谢!
编辑这是请求的ffmpeg日志。程序继续运行没有错误,所以我在大约一分钟后打断它。
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.
好吧,解决方案最终非常简单。这是编写命令的正确方法(我在--sout选项之后缺少'='并且不需要参数周围的引号;这在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}
奇怪的是,我仍然无法让ffmpeg进行转码。也许我有一些不正确的选择?
此外,如果我尝试使用下面的命令使用vlc获取流,我只会得到图像左上角的一个小裁剪部分。
vlc -vvv https://youtu.be/RtU_mdL2vBM --sout=#transcode{vcodec=h264}:rtp{sdp=rtsp://:554/test}
我很好奇,如果有人知道为什么我不能让ffmpeg工作或为什么在使用vlc获取流而不是youtube-dl时会裁剪图像。
编辑还有另一个名为livestreamer的命令行工具似乎更可靠:http://docs.livestreamer.io
以下是如何使用它的示例:
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}
如果您打算使用它,则可能需要编辑youtube插件。
C:\用户[名] \ AppData \本地\程序\ Python的\ Python35 \ LIB \站点包\ livestreamer \插件\ youtube.py
在_get_stream_info下注释“el”:“params”字典中的“player_embedded”如下:
params = {
"video_id": video_id,
#"el": "player_embedded"
}
谢谢!