[Libav-user] Speeding video decoding

Don Moir donmoir at comcast.net
Sun Jun 21 19:26:09 CEST 2015

----- Original Message ----- 
From: "Gonzalo Garramuno" <ggarra13 at gmail.com>
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter." <libav-user at ffmpeg.org>
Sent: Tuesday, June 16, 2015 2:58 PM
Subject: [Libav-user] Speeding video decoding

>I have a viewer which allows the user to scrub (play back and forwards) the video fed into it,  Currently to do this, I cache a set 
>of frames in memory using my own code (say 60 frames).
> However, I find that I still need to call avcodec_decode_video2 so that frames can be decoded properly if the user steps outside 
> of the 60 frames I cached.
> My problem is that calling avcodec_decode_video2 so many times (while still in the cache range) makes the scrubbing not work 
> smoothly.
> I was wondering what, if anything, am I doing wrong or what other trick can be used to sped up the scrubbing?
> Any help is appreciated.
> -- 
> Gonzalo Garramuño

Hi Gonzalo,

You can try to set skip_loop_filter to AVDISCARD_NONREF and there could be some other flags you can set to speed things up just 
slightly. decoding can be intense and probably the slowest thing you need to deal with.

For scrubbing though, I am thinking you don't need to decode every single frame. For example, if video is at 25 FPS, it may be you 
could get away with like 10 FPS or less. When user is scrubbing it is not likely you would be able to display every frame anyway.

I am also interested in this and have not yet investigated it so I would be interested in what you come up with. 

More information about the Libav-user mailing list