简体   繁体   中英

How to hack ffmpeg to consider I-Frames as key frames?

I'm trying to get ffmpeg to seek h264 interlaced videos, and i found that i can seek to any frame if i just force it.

I already hacked the decoder to consider I - Frames as keyframes, and it works nicely with the videos i need it to work with. And there will NEVER be any videos encoded with different encoders.

However, i'd like the seek to find me an I - Frame and not just any frame.

What i'd need to do is to hack The AVIndexEntry creation so that it marks any frame that is an I-Frame to be a key frame. Or alternatively, hack the search thing to return I - Frames.

The code does get a tad dfficult to follow at this point.

Can someone please point me at the correct place in ffmpeg code which handles this?

This isn't possible as far as i can tell..

But if you do know where the I-Frames are, by either decoding the entire video or by just knowing, you can insert stuff into the AVIndexEntry information stored in the stream.

AVIndexEntries have a flag that tells if it's a keyframe, just set it to true on I-Frames.

Luckily, i happen to know where they are in my videos :)

-mika

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM