如何在ffmpeg中使用滤镜技术
发布网友
发布时间:2022-04-21 06:35
我来回答
共1个回答
热心网友
时间:2023-07-15 05:03
//解码一个avpacket
static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt)
{
int got_picture, i;int ret = 1;
//if (packet_queue_get(&is->videoq, pkt, 1) < 0)
//return -1;
if ((i = av_read_frame(is->ic, pkt)) < 0)//如果读到文件尾部就退出
return 0;
i=avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt);
if (got_picture==0)
;//return 0;
*pts = frame->pkt_dts;
if (*pts == AV_NOPTS_VALUE)
*pts = 0;
/*if (((is->av_sync_type == AV_SYNC_AUDIO_MASTER && is->audio_st) ||
is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK) &&
(framedrop>0 || (framedrop && is->audio_st)))
{
//SDL_LockMutex(is->pictq_mutex);
if (is->frame_last_pts != AV_NOPTS_VALUE && *pts)
{
double clockdiff = get_video_clock(is) - get_master_clock(is);
double dpts = av_q2d(is->video_st->time_base) * *pts;
double ptsdiff = dpts - is->frame_last_pts;
if (fabs(clockdiff) < AV_NOSYNC_THRESHOLD &&
ptsdiff > 0 && ptsdiff < AV_NOSYNC_THRESHOLD &&
clockdiff + ptsdiff - is->frame_last_filter_delay < 0)
{
is->frame_last_dropped_pos = pkt->pos;
is->frame_last_dropped_pts = dpts;
is->frame_drops_early++;
ret = 0;
}
}
}*/
if (ret)
is->frame_last_returned_time = av_gettime() / 1000000.0;