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 格式。