[FFmpeg-user] Decoding frames as fast as possible

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed Jul 18 01:13:46 EEST 2018

2018-07-03 10:23 GMT+02:00, Evan <cerebro.alexiel at gmail.com>:

> I'm developping a media player featuring advanced video/frame
> processing. To be able to seek to any particular frame, I need to

(After writing the answer below: Please understand that in the
general case, you cannot seek to any particular frame, this is
how video codecs work.)

> know, for each frame, its presentation time and if available, if it's
> a key frame or not. The latter is optional, really.
> To do that I build an "index" once the media is valid and opened.

In general, this is not considered a good idea (for the reason that
you found out and that - imo obviously - cannot be solved: No
matter how fast your hardware is there will always be a longer
video or a video with higher resolution).
If you absolutely have to build an index, do it for shown frames
at playback time.

You can of course only parse the video (instead of decoding it)
but remember that for "real" video codecs, the information you
get has limited relevance - just let FFmpeg do the seeking...

Carl Eugen

More information about the ffmpeg-user mailing list