【问题标题】:Seeking with FFMPEG at the end of an RTSP stream在 RTSP 流的末尾使用 FFMPEG 搜索
【发布时间】:2019-03-27 12:05:26
【问题描述】:

我正在使用 ffmpeg 在应用程序中播放 RTSP 流。我遇到了一个问题,一旦到达 RTSP 流的末尾,我就无法再看到流中的任何位置。

我正在编写的程序使用 LGPL 共享库,但使用 GPL 版本的 ffplay 可以看到相同的行为。

ffplay.exe "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"

在播放视频时,我可以使用 ffplay 的键盘快捷键(左/右箭头键)向前或向后搜索。一旦流到达末尾,就不可能了,并且流被暂停或播放,搜索不再起作用。我在共享库中看到错误,但在 ffplay 中,除非我使用 s 键(这可能是我无法寻找的意义),否则我看不到错误。在其他流中,我看到了流长于报告长度的问题,并且一旦缓冲/下载了额外的视频,就无法搜索。关于这里发生了什么的任何指导?

使用ffplay.exe(也使用较新的版本进行验证):

C:\Users\kealist\Downloads\ffmpeg-20180526-63c4a4b-win64-static\bin>ffplay "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"
ffplay version N-91158-g63c4a4b0d6 Copyright (c) 2003-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --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. 18.102 / 56. 18.102
  libavcodec     58. 19.104 / 58. 19.104
  libavformat    58. 17.100 / 58. 17.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 24.100 /  7. 24.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[udp @ 0000023ce71807c0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0000023ce7174ac0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0000023ce71a6f40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0000023ce7174bc0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[rtsp @ 0000023ce717d900] UDP timeout, retrying with TCP 0B f=0/0
Input #0, rtsp, from 'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov':
  Metadata:
    title           : BigBuckBunny_115k.mov
  Duration: 00:09:56.48, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: aac (LC), 12000 Hz, stereo, fltp
    Stream #0:1: Video: h264 (Constrained Baseline), yuv420p(progressive), 240x160, 24 fps, 24 tbr, 90k tbn, 48 tbc
rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov: error while seeking
rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov: error while seeking
 596.27 A-V:-32.424 fd=1290 aq=    0KB vq=    0KB sq=    0B f=1/1

-v trace 可以看到有一条 Seek 消息,但无论是暂停还是播放,都没有真正发生搜索。

video: delay=0.000 A-V=0.173265
Seek to 37% ( 0:03:38) of total duration ( 0:09:56)       B f=1/1
Seek to 83% ( 0:08:14) of total duration ( 0:09:56)       B f=1/1
Seek to 57% ( 0:05:42) of total duration ( 0:09:56)       B f=1/1
Seek to 78% ( 0:07:41) of total duration ( 0:09:56)       B f=1/1
Seek to 85% ( 0:08:24) of total duration ( 0:09:56)       B f=1/1
Seek to 92% ( 0:09:06) of total duration ( 0:09:56)       B f=1/1
    Last message repeated 1 times
Seek to 92% ( 0:09:08) of total duration ( 0:09:56)       B f=1/1
    Last message repeated 1 times
 597.08 A-V:-34.561 fd= 312 aq=    0KB vq=    0KB sq=    0B f=1/1

有没有办法在不重新加载流的情况下缓解这种情况?

【问题讨论】:

    标签: ffmpeg rtsp


    【解决方案1】:

    这是 FFMPEG 中的一个错误。它存在于我在 Windows 和 OSX 中看到的所有使用 ffmpeg 的播放器中。据报道here。对于我面临的具体问题,我必须在本地保存/录制流并在本地播放视频,而不是使用 RTSP 播放。

    【讨论】:

      猜你喜欢
      • 2015-10-05
      • 2012-05-29
      • 2012-03-04
      • 2016-03-15
      • 2015-08-24
      • 2019-07-14
      • 2020-06-05
      • 2016-10-22
      • 1970-01-01
      相关资源
      最近更新 更多