开发者

Forcing custom H.264 intra-frames (keyframes) at encode-time?

开发者 https://www.devze.com 2023-03-22 06:48 出处:网络
I have a video sequence that I\'d like to skip to specific frames at playback-time (my player is implemented using AVPlayer in iOS, but that\'s incidental). Since these frames will fall at unpredictab

I have a video sequence that I'd like to skip to specific frames at playback-time (my player is implemented using AVPlayer in iOS, but that's incidental). Since these frames will fall at unpredictable intervals, I can't use the standard "keyframe every N frames/seconds" functionality present in most video encoders. I do, however, know the target frames in advance.

In order to do this skipping as efficiently as possible, I need to force the target frames to be i-frames at encode time. Ideally in some kind of GUI which would let me scrub to a frame, mark it as a keyframe, and then (re)encode my video.

If such a tool isn't availab开发者_运维知识库le, I have the feeling this could probably be done by rolling a custom encoder with libavcodec, but I'd rather use a higher-level (and preferably scriptable) tool to do the job if a GUI isn't possible. Is this the kind of task ffmpeg or mencoder can be bent to?

Does anybody have a technique for doing this? Also, it's entirely possible that this is an impossible task because of some fundamental ignorance I have of the h.264 codec. If so, please do put me right.


ffmpeg has a -force_key_frames option that accepts a series of arbitrary timestamps as well as other ways to specify the frames. From the documentation:

-force_key_frames 0:05:00,...


Answered my own question: it's possible to set custom compression keyframes in Apple Compressor.

Compression markers are also known as manual compression markers. These are markers you can add to a Final Cut Pro sequence (or in the Compressor Preview window) to indicate when Compressor should generate an MPEG I-frame during compression.

Source.


Could you not use chapter markers to jump between sections? Not an ideal solution but a lot easier to achieve.

You can use this software: http://www.applesolutions.com/bantha/MH.html

0

精彩评论

暂无评论...
验证码 换一张
取 消