Opened 13 years ago
Closed 12 years ago
#438 closed defect (fixed)
broken frame after seek in ogg container
| Reported by: | j | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | unspecified | Keywords: | ogg theora |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
ogg demuxer does not seek to keyframe:
running
ffmpeg -ss 23 -i test.ogv -s 640x480 -f mjpeg -an -vframes 1 test.jpg
the output frame is not fully decoded. it did not seek to a keyframe and just dumps output.
if insted one seeks on the decoded stream. the frame looks ok.
ffmpeg -i test.ogv -ss 23 -s 640x480 -f mjpeg -an -vframes 1 test.jpg
ffmpeg's ogg demuxer should be able to seek to the previous keyframe in the first case.
and decode from there
Attachments (1)
Change History (8)
comment:1 by , 13 years ago
| Status: | new → open |
|---|
comment:2 by , 13 years ago
here a sample: http://v2v.cc/~j/samples/seektest.ogv
ffmpeg -ss 10 -i seektest.ogv -vframes 1 seektest.ogv.jpg
ffmpeg version N-32369-gc0323b9, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 6 2011 17:15:36 with gcc 4.6.1
configuration: --enable-gpl --enable-postproc --enable-libvorbis --enable-pthreads --enahble-libtheora --enable-libx264 --enable-libmp3lame --enable-libschroedinger --enable-libxvid --enable-libspeex --enable-libgsm --enable-nonfree --enable-libfaac --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-shared --enable-libvpx --enable-x11grab --disable-encoder=vorbis
libavutil 51. 16. 0 / 51. 16. 0
libavcodec 53. 13. 0 / 53. 13. 0
libavformat 53. 11. 0 / 53. 11. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 39. 0 / 2. 39. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[ogg @ 0x1b39780] Unknown skeleton version 4.0
[ogg @ 0x1b39780] max_analyze_duration 5000000 reached at 5000000
Input #0, ogg, from 'seektest.ogv':
Duration: 00:00:21.52, start: 0.000000, bitrate: 1016 kb/s
Stream #0.0: Data: none
Stream #0.1: Video: theora, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0.2: Audio: vorbis, 48000 Hz, stereo, s16, 80 kb/s
Metadata:
ENCODER : ffmpeg2theora-0.27
SOURCE_OSHASH : f8455fdcb9f10909
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
[buffer @ 0x1b3bfe0] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:16/15 sws_param:
[buffersink @ 0x1b7a580] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x1b3e600] w:720 h:576 fmt:yuv420p -> w:720 h:576 fmt:yuvj420p flags:0x4
Output #0, image2, to 'seektest.ogv.jpg':
Metadata:
encoder : Lavf53.11.0
Stream #0.0: Video: mjpeg, yuvj420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0.1 -> #0.0 (theora -> mjpeg)
Press [q] to stop, [?] for help
[theora @ 0x1b3da20] vp3: first frame not a keyframe
frame= 1 fps= 0 q=4.4 Lsize= -0kB time=00:00:00.04 bitrate= -4.4kbits/s dup=0 drop=1
video:17kB audio:0kB global headers:0kB muxing overhead -100.129184%
results http://v2v.cc/~j/samples/seektest.ogv.jpg
ffmpeg -i seektest.ogv -acodec copy -vcodec copy seektest.mkv ffmpeg -ss 10 -i seektest.mkv -vframes 1 seektest.mkv.jpg
ffmpeg version N-32369-gc0323b9, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 6 2011 17:15:36 with gcc 4.6.1
configuration: --enable-gpl --enable-postproc --enable-libvorbis --enable-pthreads --enable-libtheora --enable-libx264 --enable-libmp3lame --enable-libschroedinger --enable-libxvid --enable-libspeex --enable-libgsm --enable-nonfree --enable-libfaac --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-shared --enable-libvpx --enable-x11grab --disable-encoder=vorbis
libavutil 51. 16. 0 / 51. 16. 0
libavcodec 53. 13. 0 / 53. 13. 0
libavformat 53. 11. 0 / 53. 11. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 39. 0 / 2. 39. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[matroska,webm @ 0x1cf9780] parser not found for codec vorbis, packets or times may be invalid.
[matroska,webm @ 0x1cf9780] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'seektest.mkv':
Metadata:
ENCODER : Lavf53.11.0
Duration: 00:00:21.51, start: 0.000000, bitrate: N/A
Stream #0.0: Video: theora, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 1k tbn, 25 tbc (default)
Stream #0.1: Audio: vorbis, 48000 Hz, stereo, s16 (default)
Metadata:
ENCODER : ffmpeg2theora-0.27
SOURCE_OSHASH : f8455fdcb9f10909
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
[buffer @ 0x1d01640] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:16/15 sws_param:
[buffersink @ 0x1e839e0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x1e829a0] w:720 h:576 fmt:yuv420p -> w:720 h:576 fmt:yuvj420p flags:0x4
Output #0, image2, to 'seektest.mkv.jpg':
Metadata:
encoder : Lavf53.11.0
Stream #0.0: Video: mjpeg, yuvj420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 25 tbc (default)
Stream mapping:
Stream #0.0 -> #0.0 (theora -> mjpeg)
Press [q] to stop, [?] for help
frame= 1 fps= 0 q=6.2 Lsize= -0kB time=00:00:00.04 bitrate= -4.4kbits/s dup=0 drop=46
video:31kB audio:0kB global headers:0kB muxing overhead -100.070312%
result http://v2v.cc/~j/samples/seektest.mkv.jpg
i would expect the same result for ogv and mkv.
by , 13 years ago
| Attachment: | fix_ogg_seeking.patch added |
|---|
looks better with this, not sure its the right thing to do though
comment:3 by , 12 years ago
| Keywords: | ogg theora added |
|---|
comment:4 by , 12 years ago
I incorrectly mentioned this issue in commit d7b542ae, but that one only fixes issue #941.
This issue can be fixed in a much more obvious way, but it risks breaking seeking completely for some files, and fixing it really correctly might be a bit tricky:
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -670,8 +670,8 @@ static int ogg_read_seek(AVFormatContext *s, int stream_inde
ret = ff_seek_frame_binary(s, stream_index, timestamp, flags);
os = ogg->streams + stream_index;
- if (ret < 0)
- os->keyframe_seek = 0;
+// if (ret < 0)
+// os->keyframe_seek = 0;
return ret;
}
comment:5 by , 12 years ago
Forget that patch, it just breaks seeking completely.
For some reason the seek code does not find any keyframes.
comment:6 by , 12 years ago
More correct patch sent to ffmpeg-devel:
oggdec: fix keyframe seeking when granule_is_start is 0.
comment:7 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | open → closed |
Patch applied, output looks fine enough to me.



(Complete, uncut output and possibly a short sample missing.)
I wonder if you aren't simply describing how -ss works for streams that do not only contain keyframes...