1、编码器打开失败
这是少配置了x264需要的编码参数吧
你把AVCOdecContext的qmin,qmax设置一下
用别的编码器就不一定要设置。
2、avformt_find_stream_info,解决卡住的问题(ffmpeg, demux)
.............
if(avformat_open_input(&(handle->pFormatContext), "",
handle->pInputFormat, NULL) <0) {
av_free(handle->inputBuffer);
*errorCode = -4;
return FALSE;
}
(handle->fpState)(handle, 51);
AVDictionary* pOptions = NULL;
handle->pFormatContext->probesize = 100 *1024;
handle->pFormatContext->max_analyze_duration = 5 * AV_TIME_BASE;
if(avformat_find_stream_info(handle->pFormatContext, &pOptions) < 0) {
.........
return FALSE;
}
...............
3、av_read_frame解出来的pkt对应的pts都是0
pts为零有可能是你printf的打印格式出错了,是long long 格式 要用%lld
还是不对 得到的pts貌似是对应帧序列号x1000
嗯,你看一下time_base
v4l2_buffer的头文件是什么
doublepts = pkt->pts * av_q2d(is->video_st->time_base);