action #42047
closedMark (non) keyframes in OGV file correctly size:M
0%
Description
Observation¶
Apparently (non) keyframes are not marked correctly in the OGG stream produced by videoencoder.cpp
:
mpv https://openqa.suse.de/tests/2125363/file/video.ogv
Playing: https://openqa.suse.de/tests/2125363/file/video.ogv
[ffmpeg/demuxer] ogg: Broken file, keyframe not correctly marked.
(+) Video --vid=1 (theora 1024x768)
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, non-keyframe not correctly marked.
[ffmpeg/demuxer] ogg: Broken file, keyframe not correctly marked.
(similar output with ffplay)
Acceptance criteria¶
- AC1: No error reports about non-keyframe not correctly marked in OGV generated video
- AC2 No error reports about keyframe not correctly marked in OGV generated video
Suggestions¶
- Quickly check if with simple code changes the above error message can be prevented (at best fixed for good), otherwise state somewhere that such error messages need to be ignored and "ffmpeg" should be installed for a better experience
- Confirm that ffmpeg-generated videos do not have such error
Further details¶
Likely this is not a problem for the new encoder use of ffmpeg when available
Updated by okurz almost 5 years ago
- Related to action #39251: Ensure videos are seekable for timed out jobs added
Updated by okurz almost 5 years ago
@mkittler I assume this could explain why stepping back and forth in the video, e.g. going frame by frame with mpv, is not consistent and does not always work as expected?
Updated by mkittler almost 5 years ago
Yes, that would explain it. But note that OGG is generally not the best container format when it comes to exact seeking. (OGG files have no global seek table like MKV or MP4 files usually have.)
Updated by AdamWill 9 months ago · Edited
This still seems to be an issue, and is rather annoying when you're trying to watch a very specific, short part of a long video.
edit: ah, of course, that implies we're still using the internal video encoder and not ffmpeg, when I intended to switch us to ffmpeg when that feature showed up. I did it wrong. I'm fixing that so hopefully we'll be using ffmpeg now and this won't be a problem for us, but as long as the internal encoder still exists I guess it's still a potential problem.
Updated by mkittler 9 months ago · Edited
Our code is actually closely following https://gitlab.xiph.org/xiph/theora/-/blob/master/examples/encoder_example.c / https://gitlab.xiph.org/xiph/theora/-/blob/master/examples/png2theora.c.
I also checked out:
- https://wiki.xiph.org/GranulePosAndSeeking
- https://github.com/search?q=repo%3AFFmpeg%2FFFmpeg+granulepos&type=code
- https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/oggenc.c
- headers of libogg and libvorbis
However, finding what's missing here and what we need to do is not very straight forward. Maybe our OGG files are actually fine/good and the keyframe marking on Ogg level is rather FFmpeg specific.
EDIT: I asked on the ffmpeg IRC channel about it.
Updated by mkittler 9 months ago
- Status changed from In Progress to Feedback
oggz-validate video.ogv
doesn't complain about mismarked keyframes. It only complains about a missing end of steam marker but that's actually another problem and probably only relevant for jobs that have been forcefully aborted.
So this could probably just be a warning of ffmpeg. When remuxing the video with ffmpeg -i video.ogv -c copy …
the resulting file no longer shows these warnings. When I compare these files with various tools from oggz it seems that the muxing is quite differently. ffmpeg only puts 3.3 packets in one page (on avarage) whereas our muxer puts 5.3 packets in one page. The list of keyframes shown via oggz-scan -k …
is on the other hand longer for our muxings.
Considering oggz-validate
doesn't complain about this and the files play just fine and we now normally use ffmpeg anyway I'm inclined to reject this ticket.
Otherwise the next step would be to dig deeper, e.g. to read https://www.theora.org/doc/Theora.pdf or to change our code to use ffmpeg's muxer library.
Updated by okurz 9 months ago
- Status changed from Feedback to Resolved
mkittler and me discussed this further. The only feasible potential improvement we could find where the effort would be acceptable would be to call ffmpeg to remux an ogv file when finalizing. However then that would kinda defeat the purpose to provide a solution that works without ffmpeg for little benefit because besides the questionable warning messages no functional impact was observed. We could seek in all kind of videos and could go frame by frame e.g. using mpv with the "," and "." keys. So resolving as in "everything works fine, ignore the warnings"