[FFmpeg-devel] Encoding single frame

Michael Niedermayer michaelni at gmx.at
Sat Dec 21 01:43:35 CET 2013

On Fri, Dec 20, 2013 at 09:25:19AM +0100, Roelof van Wyk wrote:
> Hi All
> I need to do the following:
> 1.       Decode a H264 stream and identify a certain B frame/picture
> 2.       Perform some modifications to the frame
> 3.       Re-encode _only_ that frame and insert back into the original stream, without any modifications to the surrounding frames. I do not want to re-encode the entire stream
> So if the input GOP is IBBPBBPBBP..., the output GOP must be IBBPB'PBBP...
> Does the ffmpeg/libav API allow the encoder context to be initialized from the decoder context such that this can be done, and if so, can anybody provide me with some ideas or examples?

first, in general this is not possible in h264, B frames can be used
as reference by other B and P frames.
if your input doesnt use B frames that way or you dont mind that
subsequent frames will be affected, then
to do such reencoding you would have to extract all parameters from
SPS/PPS, referece frames, and initialize an encoder (x264 probably)
Theres no canned API to do that anywhere i know of.


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131221/e457ea9c/attachment.asc>

More information about the ffmpeg-devel mailing list