FFmpeg tool 下载/转推 HLS (.m3u8) 直播流媒体速度慢
Slow HLS Stream Download FFmpeg
I can successfully download a HLS stream from a .m3u8 link. However, the
problem that I am facing is extremely slow download speeds. When using
Streamlink <https://streamlink.github.io/> I can download any stream at
least three times faster than FFmpeg. In Streamlink there is an option,
"--hls-segment-threads <count>", to specify the size of the thread pool used
to download HLS segments. The result is an increased download speed. My
question is, is there something equivalent in FFmpeg or something that I can
do to utilize my full connection speed?
Re: Slow HLS Stream Download FFmpeg
Yes, how about Streamlink then. ;-)
No, honestly, ffmpeg isn't made to download in parallel, as it needs to
process the video sequentially anyway. It *could* buffer, but it
doesn't.
来源:
http://www.ffmpeg-archive.org/Slow-HLS-Stream-Download-FFmpeg-td4678886.html
https://forum.videohelp.com/threads/371484-Optimizing-m3u8-streaming-with-ffmpeg
也就是说, FFmpeg / FFPlay 是以单线程下载 m3u8 的单个切片 ts 文件的,因而特定情况下,相比播放器的下载速度很慢。
更新
查阅文档,发现文档指出 HLS demuxer 支持 http_persistent, http_multiple 两个与 HTTP 连接相关的参数选项
20.9 hls
HLS demuxer
It accepts the following options:
live_start_index
segment index to start live streams at (negative values are from the end).
allowed_extensions
’,’ separated list of file extensions that hls is allowed to access.
max_reload
Maximum number of times a insufficient list is attempted to be reloaded. Default value is 1000.
http_persistent
Use persistent HTTP connections. Applicable only for HTTP streams. Enabled by default.
http_multiple
Use multiple HTTP connections for downloading HTTP segments. Enabled by default for HTTP/1.1 servers.
但是实际使用 fftool (on Windows) 获取 HLS demuxer 的帮助时,发现上述两个 HTTP 参数选项并不在支持的选项列表中。
PS> ffmpeg -h demuxer=hls
Demuxer hls,applehttp [Apple HTTP Live Streaming]:Demuxer hls,applehttp [Apple HTTP Live Streaming]:
hls,applehttp AVOptions:
-live_start_index <int> .D...... segment index to start live streams at (negative values are from the end) (from INT_MIN to INT_MAX) (default -3)
-allowed_extensions <string> .D...... List of file extensions that hls is allowed to access (default "3gp,aac,avi,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav")
-max_reload <int> .D...... Maximum number of times a insufficient list is attempted to be reloaded (from 0 to INT_MAX) (default 1000)
PS>
发表评论