<p dir="ltr">On Sep 14, 2013 8:42 PM, "James Board" <<a href="mailto:jpboard2@yahoo.com">jpboard2@yahoo.com</a>> wrote:<br>
><br>
> I'm writing a simple libAV program that reads an AVI file, decodes each<br>
> frame, then writes that frame data to another AVI file as output.  The output<br>
> file should be pretty much the same as the input file.<br>
><br>
> I'm using the examples in the ffmpeg source as a start.  This is how<br>
> each frame from the input file gets decoded.<br>
>     avcodec_decode_video2(tmpCodecContextForInputFile, myFrameDecode, got_frame, &pktDecode);<br>
><br>
> Then, in another subroutine, this is how each frame gets encoded for the<br>
> output file:<br>
>     avcodec_encode_video2(tmpCodecContextForOutputFile, &pktEncode, myFrameEncode, &got_packet);<br>
><br>
> In between the two calls above, I have to convert the image data from<br>
> myFrameDecode to image data in myFrameEncode.  That's what I'm having trouble<br>
> with.  Right now I have lots of row/col loops and they do things differently<br>
> for different pixel formats.  Is there a single subroutine I can that can<br>
> convert the image data from myFrameDecode to the image data in myFrameEncode?<br>
><br>
> Also, if the input and output file have the same pixel format, is there a<br>
> simple way to copy the data from one to the other?<br>
><br>
> Thanks</p>
<p dir="ltr">You don't need to copy data between frames, you can reuse the decoder frame as input for encoder.</p>
<p dir="ltr">BR<br>
Alex Cohn</p>