Page 1 of 1

FFMpeg VideoFileReader raw H264

PostPosted: Tue Mar 15, 2016 2:56 pm
by tombradshaw
I can get VideoFileReader to convert a H264 MP4 to series of JPEG images.
I am looking to modify the c++ source so I can feed VideoFileReader from raw H264.
I get a initial SPS and PPS h264 data packet and then packets for the I and P frames.

So I would like to call Open and then call ReadVideoFrame for each I and P frame and get Bitmap image returned.
I am struggling with c++ (not used it for a long time) and my knowledge of libffmpeg.
Has anyone done this? Below is my new Open function, but I can't see how I would use the SPS and PPS data

void VideoFileReader::OpenBin( )
data = gcnew ReaderPrivateData( );
data->Packet = new libffmpeg::AVPacket( );
data->Packet->data = NULL;
libffmpeg::AVCodec* decoder = libffmpeg::avcodec_find_decoder( libffmpeg::CODEC_ID_H264 );
data->CodecContext = avcodec_alloc_context3(decoder);
avcodec_open2(data->CodecContext, decoder, NULL);