在 RTSP 流的末尾使用 FFMPEG 寻找
Seeking with FFMPEG at the end of an RTSP stream
我正在使用 ffmpeg 在应用程序中播放 RTSP 流。我一直 运行 遇到一个问题,一旦我到达 RTSP 流的末尾,我就无法再看到流中的任何地方。
我正在编写的程序使用的是 LGPL 共享库,但我可以在使用 GPL 版本的 ffplay 中看到相同的行为。
ffplay.exe "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"
在播放视频时,我可以使用 ffplay 的键盘快捷键(左/右箭头键)向前或向后搜索。一旦流到达末尾,就不可能了,流将暂停或播放,搜索不再有效。我在共享库中看到错误,但在 ffplay 中,我看不到错误,除非我使用 s
键(这可能是我无法查找的原因)。在其他流中,我看到一个问题,即流长于报告的长度,并且一旦多余的视频buffered/downloaded,就无法搜索。关于这里发生的事情的任何指导?
使用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 中的错误。它存在于我在Windows和OSX中看到的所有使用ffmpeg的播放器中。据报道here。对于我遇到的具体问题,我不得不 save/record 在本地播放流并在本地播放视频,而不是使用 RTSP 播放。
我正在使用 ffmpeg 在应用程序中播放 RTSP 流。我一直 运行 遇到一个问题,一旦我到达 RTSP 流的末尾,我就无法再看到流中的任何地方。
我正在编写的程序使用的是 LGPL 共享库,但我可以在使用 GPL 版本的 ffplay 中看到相同的行为。
ffplay.exe "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"
在播放视频时,我可以使用 ffplay 的键盘快捷键(左/右箭头键)向前或向后搜索。一旦流到达末尾,就不可能了,流将暂停或播放,搜索不再有效。我在共享库中看到错误,但在 ffplay 中,我看不到错误,除非我使用 s
键(这可能是我无法查找的原因)。在其他流中,我看到一个问题,即流长于报告的长度,并且一旦多余的视频buffered/downloaded,就无法搜索。关于这里发生的事情的任何指导?
使用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 中的错误。它存在于我在Windows和OSX中看到的所有使用ffmpeg的播放器中。据报道here。对于我遇到的具体问题,我不得不 save/record 在本地播放流并在本地播放视频,而不是使用 RTSP 播放。