在RTSP流结束时使用FFMPEG进行搜索

时间:2019-03-27 12:05:27

标签: ffmpeg rtsp

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

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

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,我可以看到有一条寻求消息,但是无论是暂停还是播放,都不会真正进行搜索。

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

是否有一种无需重新加载流即可减轻这种情况的方法?

1 个答案:

答案 0 :(得分:0)

这是FFMPEG中的错误。我在Windows和OSX中看到的所有使用ffmpeg的播放器中都有它。据报告here。对于我面临的特定问题,我不得不在本地保存/记录流并在本地播放视频,而不是使用RTSP播放。