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

Alex Cohn alexcohn at netvision.net.il
Sat Sep 14 20:43:18 CEST 2013


On Sep 14, 2013 8:42 PM, "James Board" <jpboard2 at yahoo.com> wrote:
>
> 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?
>
> Thanks

You don't need to copy data between frames, you can reuse the decoder frame
as input for encoder.

BR
Alex Cohn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130914/3eafc7ad/attachment.html>


More information about the Libav-user mailing list