[FFmpeg-trac] #10062(undetermined:new): av1_qsv produces incorrect output files

FFmpeg trac at avcodec.org
Sun Nov 27 19:55:18 EET 2022


#10062: av1_qsv produces incorrect output files
-------------------------------------+-------------------------------------
             Reporter:  oviano       |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  git-master   |               Resolution:
             Keywords:  qsv          |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by James):

 Replying to [comment:7 oviano]:
 > Replying to [comment:6 James]:
 > > > the hardware is outputting frames in DTS order (increasing each
 time), but the PTS is not in order
 > >
 > > Why? AV1 has no reordering. It should always be DTS = PTS. All other
 encoders do it, so it sounds like qsv_enc is generating wrong PTS values.
 >
 > Yes.
 >
 > However what clouds this issue is that QSVEnc doesn't have this problem,
 which suggests its possible to workaround/do things differently so that
 the output is correct, or do some re-ordering or something....so I've been
 scrutinising that code to understand what is different vs FFmpeg, but I
 can't see anything obvious.

 There's this code in qsvenc.c

 qpkt.pkt.dts  = av_rescale_q(qpkt.bs->DecodeTimeStamp, (AVRational){1,
 90000}, avctx->time_base);
 qpkt.pkt.pts  = av_rescale_q(qpkt.bs->TimeStamp,       (AVRational){1,
 90000}, avctx->time_base);

 So this would mean mfxBitstream.TimeStamp is being set wrong by the
 hardware encoder itself, and this value then propagated to the output
 AVPacket. Sounds like a bug that needs to be reported to onevpl.

 An (untested) workaround could be

 qpkt.pkt.dts = av_rescale_q(qpkt.bs->DecodeTimeStamp, (AVRational){1,
 90000}, avctx->time_base);
 qpkt.pkt.pts = (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER) ?
 av_rescale_q(qpkt.bs->TimeStamp, (AVRational){1, 90000}, avctx->time_base)
 :                qpkt.pkt.dts;
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10062#comment:8>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list