[Libav-user] How to split AVFrame to smaller AVFrames

Neerav Patel neeravpatel at hotmail.com
Fri Jun 20 04:14:43 CEST 2014

I am trying to use avcodec_encode_audio2 and I can see that the nb_samples of the decoded data is 22050, but the encode context only has a frame size of 1152. I am assuming I need to copy the AVFrame to a smaller AVFrame so I can pass it in.  How does one copy a portion of a AVFrame. Do I use av_samples_copy? how do I use that and allocate a AVFrame from it?
Any help would be greatly appreciated.
I have tried:uint8_t * data = ( decodeAudio.data );
AVFrame * tempAudio = av_frame_alloc();
tempAudio.data = data;
tempAudio.nb_samples = 1152;
But I dont think that is right, as I am not copying any of the other fields...
Thanks in advance 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140620/7e6684f9/attachment.html>

More information about the Libav-user mailing list