[Libav-user] Copy Image Data from Decode Frame To Encode Frame

James Board jpboard2 at yahoo.com
Sat Sep 14 19:41:57 CEST 2013

I'm writing a simple libAV program that reads an AVI file, decodes each
frame, then writes that frame data to another AVI file as output.  The output
file should be pretty much the same as the input file.

I'm using the examples in the ffmpeg source as a start.  This is how
each frame from the input file gets decoded.

    avcodec_decode_video2(tmpCodecContextForInputFile, myFrameDecode, got_frame, &pktDecode);

Then, in another subroutine, this is how each frame gets encoded for the
output file:
    avcodec_encode_video2(tmpCodecContextForOutputFile, &pktEncode, myFrameEncode, &got_packet);

In between the two calls above, I have to convert the image data from
myFrameDecode to image data in myFrameEncode.  That's what I'm having trouble
with.  Right now I have lots of row/col loops and they do things differently
for different pixel formats.  Is there a single subroutine I can that can
convert the image data from myFrameDecode to the image data in myFrameEncode?

Also, if the input and output file have the same pixel format, is there a
simple way to copy the data from one to the other?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130914/f1e0130f/attachment.html>

More information about the Libav-user mailing list