Opened 14 years ago
#1759 new defect
Stuttering vp8 video at alt-ref frames
Reported by: | Owned by: | reimar | |
---|---|---|---|
Priority: | normal | Component: | vd |
Version: | HEAD | Severity: | minor |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Reproduced by developer: | no | Analyzed by developer: | no |
Description
When I play a vp8 stream created by the reference encoder (ivfenc) with "--auto-alt-ref=1" specified, I see uneven playback whenever a lot of alt-ref frames come up in a short span during a camera pan. Any video source will do this, but I have a particularly bad example (15 sec vp8 stream as ivf):
Vlc and gstreamer play these videos normally. Mplayer plays videos with "--auto-alt-ref=0" normally.
I can correct the problem (to my eyes) by forcing vp8_decode_frame() (libavcodec/vp8.c) to return the previous (displayed) frame, rather than no frame, each time it decodes a non-displayed (alt-ref) frame:
line 1645:
if (!s->invisible) {
*(AVFrame*)data = *s->framep[VP56_FRAME_CURRENT];
*data_size = sizeof(AVFrame);
+ } else {
+ *(AVFrame*)data = *s->framep[VP56_FRAME_PREVIOUS];
+ *data_size = sizeof(AVFrame);
+ av_log(avctx, AV_LOG_WARNING, "invisible frame\n");
}
However, I think this would damage ffmpeg's vp8 handling if it were in the libavcodec library, rather than just compiled into mplayer. With the above change, I can't see any stuttering in the affected videos. AV sync doesn't seem to be affected.
I suspect that mplayer isn't properly handling frames which aren't intended to be displayed, but I have to confess that the code involved has eluded me so far. Ideally, I'd expect an alt-ref frame to be handled by immediately decoding the next frame, rather than waiting another frame interval, which may or may not be happening.