因此,似乎 ffmpeg 在尝试探测流 1 时陷入了某种无限循环。这种情况只发生在一个特定的提供商身上。我从未像其他流那样在日志中看到输入/输出。
我尝试先阅读https://streamlink.github.io/库 - 运行良好,但 ffmpeg 无论如何都不会传输这些数据。我遇到的困难是使用 HLS 进行传输。
我也尝试过使用probesize、max_probe_packets或analyzeduration,但什么也没发生。
任何帮助是极大的赞赏。
编辑命令:
ffmpeg -loglevel debug -re -probesize 10000 -max_probe_packets 10M -analyzeduration 100000 -i - -map a:0 -async 1 -acodec aac -f flv -fflags +discardcorrupt -fflags +fastseek -fflags +nobuffer -fflags +noparse rtmp://localhost:1935/live/edgestream3
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Reading option '-probesize' ... matched as AVOption 'probesize' with argument '10000'.
Reading option '-max_probe_packets' ... matched as AVOption 'max_probe_packets' with argument '10M'.
Reading option '-analyzeduration' ... matched as AVOption 'analyzeduration' with argument '100000'.
Reading option '-i' ... matched as input url with argument '-'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument 'a:0'.
Reading option '-async' ... matched as option 'async' (audio sync method) with argument '1'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+discardcorrupt'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+fastseek'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+nobuffer'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+noparse'.
Reading option 'rtmp://localhost:1935/live/edgestream4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option async (audio sync method) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url -.
Applying option re (read input at native frame rate) with argument 1.
Successfully parsed a group of options.
Opening an input file: -.
[NULL @ 0x7fbb7e80b400] Opening 'pipe:' for reading
[pipe @ 0x7fbb7d908140] Setting default whitelist 'crypto,data'
[mpegts @ 0x7fbb7e80b400] Format mpegts probed with size=2048 and score=50
[mpegts @ 0x7fbb7e80b400] stream=0 stream_type=f pid=66 prog_reg_desc=
[mpegts @ 0x7fbb7e80b400] stream=1 stream_type=15 pid=1000 prog_reg_desc=
[mpegts @ 0x7fbb7e80b400] Before avformat_find_stream_info() pos: 0 bytes read:65536 seeks:0 nb_streams:2
[mpegts @ 0x7fbb7e80b400] parser not found for codec none, packets or times may be invalid.
[mpegts @ 0x7fbb7e80b400] probing stream 0 pp:10000000
[mpegts @ 0x7fbb7e80b400] Probe with size=189, packets=1 detected aac with score=1
[mpegts @ 0x7fbb7e80b400] probing stream 0 pp:9999999
[mpegts @ 0x7fbb7e80b400] Probe with size=381, packets=2 detected aac with score=1
[mpegts @ 0x7fbb7e80b400] probing stream 0 pp:9999998
[mpegts @ 0x7fbb7e80b400] Probe with size=576, packets=3 detected aac with score=51
[mpegts @ 0x7fbb7e80b400] probed stream 0
[mpegts @ 0x7fbb7e80b400] probing stream 1 pp:10000000
[mpegts @ 0x7fbb7e80b400] probing stream 1 pp:9999999
[mpegts @ 0x7fbb7e80b400] probing stream 1 pp:9999998
[mpegts @ 0x7fbb7e80b400] probing stream 1 pp:9999997
[mpegts @ 0x7fbb7e80b400] Continuity check failed for pid 0 expected 11 got 10
[mpegts @ 0x7fbb7e80b400] Continuity check failed for pid 100 expected 15 got 14
[mpegts @ 0x7fbb7e80b400] probing stream 1 pp:9999996
[mpegts @ 0x7fbb7e80b400] probing stream 1 pp:9999995
[mpegts @ 0x7fbb7e80b400] probing stream 1 pp:9999994
[mpegts @ 0x7fbb7e80b400] probing stream 1 pp:9999993
so on so on...
edit2:尝试cmd:
ffprobe stream_url -loglevel debug
经过很长时间才得到响应。我怎样才能强制 ffmpeg 放弃探测?
[mpegts @ 0x7f9155853400] probed stream 1 failed
[mpegts @ 0x7f9155853400] parser not found for codec none, packets or times may be invalid.
[hls @ 0x7f9155813200] max_analyze_duration 5000000 reached at 5013600 microseconds st:2
[hls @ 0x7f9155813200] Could not find codec parameters for stream 1 (Unknown: none ([21][0][0][0] / 0x0015)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[hls @ 0x7f9155813200] Could not find codec parameters for stream 3 (Unknown: none ([21][0][0][0] / 0x0015)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options