FFmpeg av_read_frame returns size, but no data?

I wrote C code to access ffmpeg and wrapped it in a C ++ / CLI (.NET) class. The program extracts the real-time video stream and extracts frames and converts them to PNG files.

Unfortunately, the images stored on the disk are always black (opening them in Notepad ++ shows that they are full of zeros).

I use the aformat / codec-55.dll builds and headers and development libraries to compile from ffmpeg-20131120- git -e502783-win64-dev. The entire project was compiled using Managed C ++ (Cpp / cli) .NET 4.0 for the 64-bit version.

After some research, the problem is that av_read_frame correctly fills in the AVPacket-> size value, but the AVPAcket-> data is always zero. When the frame is finished (received == 1), then the data for the AVFrame is only a matrix of zeros .: (

Here is the code: Sample code (sorry, but it did not fit into SO)

I think the problem is on line 34 when the package returns like this: size is set but data is empty

Please, how can I make this work? What did I do wrong?

+4
source share
1 answer

. PNG. (frame->linesize*frame->height) frame->data fwrite Irfanview ()?

+1

All Articles