int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, enum AVRounding) av_const;
这个函数在ffmpeg中主要是将编码视频的pts等由原来的容器中规定的转化为现在容器规定的大小,总的来说是这样的:
a*bq/cq;
本人在代码中是这样用的:
npkt.pts=av_rescale_q_rnd(npkt.pts,instream->time_base,outstream->time_base,AV_ROUND_NEAR_INF);
其中time_base结构是这样的:
den,num;
den是分母,num是分子,num/den是1/帧率;
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,const AVFrame *frame, int *got_packet_ptr);
是将帧frame编码为avpkt遵照AVCodecContext 格式。