I'm having trouble reading video packets after seeking within a video.
I seem to have no problem reading reading video packets if I just start
at the begining of the stream and scan every packet in order, but the
below code is not working.
I'm calling this from a timer that I want to
grab the video frame closest to the time timeMs. av_read_frame() is
returning the value -541478725 the third time it gets called, which
stops me from receiving and decoding the frame most of the time:
QImage FfmpegMediaSource::getVideoFrame(int timeMs)
{
AVPacket
packet;
//Seek to our goal time
avcodec_flush_buffers(pCodecCtx);
int64_t targetPts = timeMs * 1000;
targetPts = av_rescale_q(targetPts,
AV_TIME_BASE_Q,
pFormatCtx->streams[videoStream]->time_base);
int err
= av_seek_frame(pFormatCtx, videoStream, targetPts,
AVSEEK_FLAG_BACKWARD);
qDebug() _______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".