| @@ -1168,7 +1168,7 @@ static void do_video_out(OutputFile *of, · 1167 unmodified lines |
| 1168 | 1168 | if (frame_rate.num > 0 && frame_rate.den > 0) |
| 1169 | 1169 | duration = 1/(av_q2d(frame_rate) * av_q2d(enc->time_base)); |
| 1170 | 1170 | |
| 1171 | | − if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num) |
| 1171 | + if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num) |
| 1172 | 1172 | duration = FFMIN(duration, 1/(av_q2d(ost->frame_rate) * av_q2d(enc->time_base))); |
| 1173 | 1173 | |
| 1174 | 1174 | if (!ost->filters_script && |
| @@ -2625,9 +2625,11 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo · 1450 unmodified lines |
| 2625 | 2625 | avpkt = ist->pkt; |
| 2626 | 2626 | |
| 2627 | 2627 | if (!ist->saw_first_ts) { |
| 2628 | + ist->first_dts = |
| 2628 | 2629 | ist->dts = ist->st->avg_frame_rate.num ? - ist->dec_ctx->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; |
| 2629 | 2630 | ist->pts = 0; |
| 2630 | 2631 | if (pkt && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) { |
| 2632 | + ist->first_dts = |
| 2631 | 2633 | ist->dts += av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); |
| 2632 | 2634 | ist->pts = ist->dts; //unused but better to set it to a value thats not totally wrong |
| 2633 | 2635 | } |
| @@ -3949,10 +3951,10 @@ static OutputStream *choose_output(void) · 1315 unmodified lines |
| 3949 | 3951 | |
| 3950 | 3952 | for (i = 0; i < nb_output_streams; i++) { |
| 3951 | 3953 | OutputStream *ost = output_streams[i]; |
| 3952 | | − int64_t opts = ost->st->cur_dts == AV_NOPTS_VALUE ? INT64_MIN : |
| 3953 | | − av_rescale_q(ost->st->cur_dts, ost->st->time_base, |
| 3954 | + int64_t opts = ost->last_mux_dts == AV_NOPTS_VALUE ? INT64_MIN : |
| 3955 | + av_rescale_q(ost->last_mux_dts, ost->st->time_base, |
| 3954 | 3956 | AV_TIME_BASE_Q); |
| 3955 | | − if (ost->st->cur_dts == AV_NOPTS_VALUE) |
| 3957 | + if (ost->last_mux_dts == AV_NOPTS_VALUE) |
| 3956 | 3958 | av_log(NULL, AV_LOG_DEBUG, |
| 3957 | 3959 | "cur_dts is invalid st:%d (%d) [init:%d i_done:%d finish:%d] (this is harmless if it occurs once at the start per stream)\n", |
| 3958 | 3960 | ost->st->index, ost->st->id, ost->initialized, ost->inputs_done, ost->finished); |