ffprobe无法在m3u8中将超时参数转移到ts url

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ffprobe无法在m3u8中将超时参数转移到ts url相关的知识,希望对你有一定的参考价值。

我使用ffprobe检查我的m3u8文件,我在本地安装nginx,在mtml文件夹中放一个m3u8文件,内容是:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:4
#EXTINF:1.928
http://127.0.0.1:8888/test.ts
#EXT-X-ENDLIST

然后使用'nc -l 8888'打开一个端口等待ffprobe连接,但不会响应任何内容。

我使用此命令来运行ffprobe:

./ffprobe2.6 -timeout 20000000 -analyzeduration 2147483647 -probesize 2147483647 │dragon@dragon-virtual-machine ~/Desktop $ nc -l 8888 -v error http://localhost/test.m3u8

最后,这个命令在20秒后无法退出,使用gdb并找到堆栈:

#0  0x0000000001647cd8 in poll ()
#1  0x000000000050f227 in ff_network_wait_fd (fd=4, write=0) at libavformat/network.c:78
#2  0x000000000050f2a1 in ff_network_wait_fd_timeout (fd=4, write=0, timeout=0, int_cb=0x2897c10) at libavformat/network.c:90
#3  0x00000000005851b9 in tcp_read (h=0x2897be0, buf=0x28962d0 "GET /test.ts HTTP/1.1
User-Agent: Lavf/56.40.101
Accept: */*
Connection: close
Host: 127.0.0.1:8888
Icy-MetaData: 1


", size=4096)
    at libavformat/tcp.c:194
#4  0x0000000000441456 in retry_transfer_wrapper (h=0x2897be0, buf=0x28962d0 "GET /test.ts HTTP/1.1
User-Agent: Lavf/56.40.101
Accept: */*
Connection: close
Host: 127.0.0.1:8888
Icy-MetaData: 1


", 
    size=4096, size_min=1, transfer_func=0x585169 <tcp_read>) at libavformat/avio.c:333
#5  0x0000000000441578 in ffurl_read (h=0x2897be0, buf=0x28962d0 "GET /test.ts HTTP/1.1
User-Agent: Lavf/56.40.101
Accept: */*
Connection: close
Host: 127.0.0.1:8888
Icy-MetaData: 1


", size=4096)
    at libavformat/avio.c:364
#6  0x0000000000487cf4 in http_getc (s=0x28962c0) at libavformat/http.c:524
#7  0x0000000000487d89 in http_get_line (s=0x28962c0, line=0x7ffc23e235f0 "", line_size=4096) at libavformat/http.c:544
#8  0x0000000000489342 in http_read_header (h=0x2896220, new_location=0x7ffc23e25744) at libavformat/http.c:957
#9  0x000000000048a075 in http_connect (h=0x2896220, path=0x7ffc23e25750 "/test.ts", local_path=0x7ffc23e25750 "/test.ts", hoststr=0x7ffc23e27b50 "127.0.0.1:8888", auth=0x7ffc23e27f50 "", proxyauth=0x7ffc23e28350 "", 
    new_location=0x7ffc23e25744) at libavformat/http.c:1134
#10 0x0000000000486e9f in http_open_cnx_internal (h=0x2896220, options=0x7ffc23e28cc0) at libavformat/http.c:218
#11 0x0000000000486f48 in http_open_cnx (h=0x2896220, options=0x7ffc23e28cc0) at libavformat/http.c:238
#12 0x0000000000487ba4 in http_open (h=0x2896220, uri=0x2896268 "http://127.0.0.1:8888/test.ts", flags=1, options=0x7ffc23e28cc0) at libavformat/http.c:494
#13 0x0000000000440e92 in ffurl_connect (uc=0x2896220, options=0x7ffc23e28cc0) at libavformat/avio.c:208
#14 0x00000000004413ab in ffurl_open (puc=0x2893d28, filename=0x2895050 "http://127.0.0.1:8888/test.ts", flags=1, int_cb=0x2890810, options=0x7ffc23e28cc0) at libavformat/avio.c:310
#15 0x000000000047e93d in open_url (c=0x2892aa0, uc=0x2893d28, url=0x2895050 "http://127.0.0.1:8888/test.ts", opts=0x28929e0) at libavformat/hls.c:649
#16 0x0000000000480355 in open_input (c=0x2892aa0, pls=0x2892c60, seg=0x2895080) at libavformat/hls.c:1118
#17 0x0000000000480d69 in read_data (opaque=0x2892c60, buf=0x28a2ac0 "", buf_size=32768) at libavformat/hls.c:1323
#18 0x000000000044323a in fill_buffer (s=0x2893c60) at libavformat/aviobuf.c:482
#19 0x00000000004435c7 in avio_read (s=0x2893c60, buf=0x28959f0 "8020602", size=2048) at libavformat/aviobuf.c:569
#20 0x0000000000470e68 in av_probe_input_buffer2 (pb=0x2893c60, fmt=0x7ffc23e29f90, filename=0x2895050 "http://127.0.0.1:8888/test.ts", logctx=0x0, offset=0, max_probe_size=1048576) at libavformat/format.c:288
#21 0x0000000000471051 in av_probe_input_buffer (pb=0x2893c60, fmt=0x7ffc23e29f90, filename=0x2895050 "http://127.0.0.1:8888/test.ts", logctx=0x0, offset=0, max_probe_size=0) at libavformat/format.c:342
#22 0x0000000000481ac8 in hls_read_header (s=0x2890360) at libavformat/hls.c:1625
#23 0x000000000058ee13 in avformat_open_input (ps=0x7ffc23e2a0a0, filename=0x7ffc23e2a644 "http://localhost/test.m3u8", fmt=0x0, options=0x26ae150) at libavformat/utils.c:473
#24 0x00000000004122b0 in open_input_file (fmt_ctx_ptr=0x7ffc23e2a108, filename=0x7ffc23e2a644 "http://localhost/test.m3u8") at ffprobe.c:2478
#25 0x000000000041269c in probe_file (wctx=0x288d940, filename=0x7ffc23e2a644 "http://localhost/test.m3u8") at ffprobe.c:2562
#26 0x0000000000414878 in main (argc=10, argv=0x7ffc23e2a278) at ffprobe.c:3247

我们可以在func中看到timeout = 0

ff_network_wait_fd_timeout (fd=4, write=0, timeout=0, int_cb=0x2897c10) at libavformat/network.c:90

任何人都可以提供帮助

答案

该部分文档已过时。 http协议不再具有该选项。您可以使用-rw_timeout 20M,它适用于所有协议。

以上是关于ffprobe无法在m3u8中将超时参数转移到ts url的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 ffprobe 从 HLS/M3U8 文件中检测视频比特率

视频下载下来后格式是m3u8和ts且无法播放该怎么解决?

如何将m3u8的ts文件合并到mp4?

.ts视频采用m3u8方式,已知是 AES-128 为加密方式,求教

python 爬虫下载视频 并 安装使用 ffmpeg 合并ts视频文件 使用16进制 修改文件头类型

如何合并m3u8及ts文件