How about android ndk AMediaCodec decoding data saved as yuv I420 file?

26 Views Asked by At
AMediaCodecBufferInfo info;
ssize_t index = AMediaCodec_dequeueOutputBuffer(ylMediaDecode->getAMediaCodec(), &info, 3000);   
if (index >= 0) {
   uint8_t *buffer = AMediaCodec_getOutputBuffer(ylMediaDecode->getAMediaCodec(), index, &outsize);
   auto filename = "/storage/emulated/0/Android/data/com.xxx.xxx/files/test.yuv"
   FILE fp_out = fopen(name.c_str(),"w+");
   fwrite(buffer, 1, info.size,fp_out);
} 

I use android ndk AMediaCodec to decode h265/h264 data, and try to save the obtained decoded data to test.yuv file. But the yuv file cannot be opened with 7yuv software. How can I correctly save the decoded data as a yuv I420 file?

0

There are 0 best solutions below