gpt4 book ai didi

ffmpeg - 使用 youtube-dl 和 ffmpeg(或 vlc)将 YouTube 直播流转码为 rtsp rtmp udp rtp

转载 作者:行者123 更新时间:2023-12-03 05:16:24 29 4
gpt4 key购买 nike

我正在尝试使用 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:\Users[用户名]\AppData\Local\Programs\Python\Python35\Lib\site-packages\livestreamer\plugins\youtube.py

在 _get_stream_info 下注释掉“参数”字典中的“el”:“player_embedded”,如下所示:
    params = {
"video_id": video_id,
#"el": "player_embedded"
}

谢谢!

关于ffmpeg - 使用 youtube-dl 和 ffmpeg(或 vlc)将 YouTube 直播流转码为 rtsp rtmp udp rtp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52195246/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com