srj*_*ang 4 ffmpeg h.264 libavcodec libav
我可以从相机获得原始h.264帧.(它不包含任何网络标头,例如rtsp,http).它们是h.264原始数据.我将这些数据逐帧推送到队列中.我用Google搜索了许多ffmpeg示例,该示例将avformat_open_input()与本地文件路径或网络路径一起使用.当我将帧保存到文件并使用avformat_open_input()时,我可以看到视频.
我的问题是我想要实时解码帧,而不是将其保存为文件.有没有人对此有任何想法?
谢谢!
你不需要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 );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2058 次 |
| 最近记录: |