Raw decoding of the h.264 bitstream

I can get raw h.264 frames from the camera. (It does NOT contain network headers, such as rtsp, http). This is h.264 raw data. And I push this data into the queue behind the scenes. I looked through many ffmpeg examples that use avformat_open_input () with a local file path or network path. And I see the video while I save the frames to a file and using avformat_open_input ().

My problem is that I want to decode frames in real time, and not after saving as a file. Does anyone know about this?

Thanks!

+4
source share
1 answer

avformat, avcodec. avformat . avcodec ( ).

AVPacket avpkt; int err, frame_decoded = 0;
AVCodec *codec = avcodec_find_decoder ( AV_CODEC_ID_H264 );
AVCodecContext *codecCtx = avcodec_alloc_context3 ( codec );
avcodec_open2 ( codecCtx, codec, NULL );
// Set avpkt data and size here
err = avcodec_decode_video2 ( codecCtx, avframe, &frame_decoded, &avpkt );
+8

Source: https://habr.com/ru/post/1607596/


All Articles