|
|
|
@ -1362,7 +1362,6 @@ static void do_video_out(AVFormatContext *s, |
|
|
|
|
ost->sync_opts = lrintf(sync_ipts); |
|
|
|
|
} else if (vdelta > 1.1) |
|
|
|
|
nb_frames = lrintf(vdelta); |
|
|
|
|
//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames);
|
|
|
|
|
if (nb_frames == 0) { |
|
|
|
|
++nb_frames_drop; |
|
|
|
|
av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n"); |
|
|
|
@ -1420,10 +1419,7 @@ static void do_video_out(AVFormatContext *s, |
|
|
|
|
big_picture.quality = quality; |
|
|
|
|
if (!enc->me_threshold) |
|
|
|
|
big_picture.pict_type = 0; |
|
|
|
|
// big_picture.pts = AV_NOPTS_VALUE;
|
|
|
|
|
big_picture.pts = ost->sync_opts; |
|
|
|
|
// big_picture.pts= av_rescale(ost->sync_opts, AV_TIME_BASE*(int64_t)enc->time_base.num, enc->time_base.den);
|
|
|
|
|
// av_log(NULL, AV_LOG_DEBUG, "%"PRId64" -> encoder\n", ost->sync_opts);
|
|
|
|
|
if (ost->forced_kf_index < ost->forced_kf_count && |
|
|
|
|
big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) { |
|
|
|
|
big_picture.pict_type = AV_PICTURE_TYPE_I; |
|
|
|
@ -1442,17 +1438,13 @@ static void do_video_out(AVFormatContext *s, |
|
|
|
|
pkt.size = ret; |
|
|
|
|
if (enc->coded_frame->pts != AV_NOPTS_VALUE) |
|
|
|
|
pkt.pts = av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base); |
|
|
|
|
/*av_log(NULL, AV_LOG_DEBUG, "encoder -> %"PRId64"/%"PRId64"\n",
|
|
|
|
|
pkt.pts != AV_NOPTS_VALUE ? av_rescale(pkt.pts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1, |
|
|
|
|
pkt.dts != AV_NOPTS_VALUE ? av_rescale(pkt.dts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1);*/ |
|
|
|
|
|
|
|
|
|
if (enc->coded_frame->key_frame) |
|
|
|
|
pkt.flags |= AV_PKT_FLAG_KEY; |
|
|
|
|
write_frame(s, &pkt, ost); |
|
|
|
|
*frame_size = ret; |
|
|
|
|
video_size += ret; |
|
|
|
|
// fprintf(stderr,"\nFrame: %3d size: %5d type: %d",
|
|
|
|
|
// enc->frame_number-1, ret, enc->pict_type);
|
|
|
|
|
|
|
|
|
|
/* if two pass, output log */ |
|
|
|
|
if (ost->logfile && enc->stats_out) { |
|
|
|
|
fprintf(ost->logfile, "%s", enc->stats_out); |
|
|
|
|