diff options
author | James Almer <jamrial@gmail.com> | 2017-10-30 23:07:15 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-10-30 23:07:15 -0300 |
commit | a7da13474286774cf378c3ea606c19a7c1a0eba3 (patch) | |
tree | 72dfe851f855241e2b34e400cfc29b2aa1c242f2 /fftools/ffmpeg.c | |
parent | f7038c3629e7c9db3d75c11db4c67d94352d9f70 (diff) | |
parent | 4d56f7ab8f627aa140c1ede1bb61305f01cefcdd (diff) | |
download | ffmpeg-a7da13474286774cf378c3ea606c19a7c1a0eba3.tar.gz |
Merge commit '4d56f7ab8f627aa140c1ede1bb61305f01cefcdd'
* commit '4d56f7ab8f627aa140c1ede1bb61305f01cefcdd':
avconv: Flush output BSFs when stream copy reaches EOF
Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r-- | fftools/ffmpeg.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index ade8df6abc..ea25dd0d64 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1971,6 +1971,12 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ost->mux_timebase); AVPacket opkt; + // EOF: flush output bitstream filters. + if (!pkt) { + output_packet(of, &opkt, ost, 1); + return; + } + av_init_packet(&opkt); if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && @@ -2706,7 +2712,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo AVRational time_base_q = AV_TIME_BASE_Q; int64_t next_dts = av_rescale_q(ist->next_dts, time_base_q, av_inv_q(ist->framerate)); ist->next_dts = av_rescale_q(next_dts + 1, av_inv_q(ist->framerate), time_base_q); - } else if (pkt->duration) { + } else if (pkt && pkt->duration) { ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->dec_ctx->framerate.num != 0) { int ticks= av_stream_get_parser(ist->st) ? av_stream_get_parser(ist->st)->repeat_pict + 1 : ist->dec_ctx->ticks_per_frame; @@ -2719,7 +2725,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo ist->pts = ist->dts; ist->next_pts = ist->next_dts; } - for (i = 0; pkt && i < nb_output_streams; i++) { + for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = output_streams[i]; if (!check_output_constraints(ist, ost) || ost->encoding_needed) @@ -4600,7 +4606,7 @@ static int transcode(void) /* at the end of stream, we must flush the decoder buffers */ for (i = 0; i < nb_input_streams; i++) { ist = input_streams[i]; - if (!input_files[ist->file_index]->eof_reached && ist->decoding_needed) { + if (!input_files[ist->file_index]->eof_reached) { process_input_packet(ist, NULL, 0); } } |