Message ID | 20190109222653.18346-1-leo.izen@gmail.com |
---|---|
State | Superseded |
Headers | show |
On Wed, Jan 09, 2019 at 05:26:53PM -0500, Leo Izen wrote: > --- > fftools/ffmpeg.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) Does this behave as intended when there is also an audio stream ? also a fate test should be added thx [...]
On 4/4/19 5:11 AM, Michael Niedermayer wrote: > On Wed, Jan 09, 2019 at 05:26:53PM -0500, Leo Izen wrote: >> --- >> fftools/ffmpeg.c | 19 ++++++++++++++----- >> 1 file changed, 14 insertions(+), 5 deletions(-) > Does this behave as intended when there is also an audio stream ? It depends on what you mean by "as indended." You can already uses -r as an input option if you're transcoding the video stream. This makes it work the same way for streamcopy. In either case, it doesn't touch the audio stream or the container timebase. > > also a fate test should be added I can add a fate test and re-submit the patch with one included. > > thx > > [...] > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
2019-04-06 5:14 GMT+02:00, Leo Izen <leo.izen@gmail.com>: > On 4/4/19 5:11 AM, Michael Niedermayer wrote: >> On Wed, Jan 09, 2019 at 05:26:53PM -0500, Leo Izen wrote: >>> --- >>> fftools/ffmpeg.c | 19 ++++++++++++++----- >>> 1 file changed, 14 insertions(+), 5 deletions(-) >> Does this behave as intended when there is also an audio stream ? > > It depends on what you mean by "as indended." You can already uses -r as > an input option if you're transcoding the video stream. This makes it > work the same way for streamcopy. In either case, it doesn't touch the > audio stream or the container timebase. > >> >> also a fate test should be added > I can add a fate test and re-submit the patch with one included. I believe ticket #3999 should be mentioned in the commit message. Carl Eugen
On Fri, Apr 05, 2019 at 11:14:23PM -0400, Leo Izen wrote: > On 4/4/19 5:11 AM, Michael Niedermayer wrote: > >On Wed, Jan 09, 2019 at 05:26:53PM -0500, Leo Izen wrote: > >>--- > >> fftools/ffmpeg.c | 19 ++++++++++++++----- > >> 1 file changed, 14 insertions(+), 5 deletions(-) > >Does this behave as intended when there is also an audio stream ? > > It depends on what you mean by "as indended." You can already uses -r as an > input option if you're transcoding the video stream. This makes it work the > same way for streamcopy. In either case, it doesn't touch the audio stream > or the container timebase. Please put this information in the commit message [...]
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 544f1a1cef..f4bd5d97b7 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2038,12 +2038,14 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p if (ost->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) ost->sync_opts++; - if (pkt->pts != AV_NOPTS_VALUE) + if (ist->framerate.num) + opkt.pts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->mux_timebase) - ost_tb_start_time; + else if (pkt->pts != AV_NOPTS_VALUE) opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->mux_timebase) - ost_tb_start_time; else opkt.pts = AV_NOPTS_VALUE; - if (pkt->dts == AV_NOPTS_VALUE) + if (pkt->dts == AV_NOPTS_VALUE || ist->framerate.num) opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->mux_timebase); else opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->mux_timebase); @@ -2597,7 +2599,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo avpkt = *pkt; } - if (pkt && pkt->dts != AV_NOPTS_VALUE) { + if (pkt && pkt->dts != AV_NOPTS_VALUE && !ist->framerate.num) { ist->next_dts = ist->dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); if (ist->dec_ctx->codec_type != AVMEDIA_TYPE_VIDEO || !ist->decoding_needed) ist->next_pts = ist->pts = ist->dts; @@ -3153,8 +3155,15 @@ static int init_output_stream_streamcopy(OutputStream *ost) else sar = par_src->sample_aspect_ratio; ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar; - ost->st->avg_frame_rate = ist->st->avg_frame_rate; - ost->st->r_frame_rate = ist->st->r_frame_rate; + + if (ist->framerate.num) { + ost->st->avg_frame_rate = ist->framerate; + ost->st->r_frame_rate = ist->framerate; + } else { + ost->st->avg_frame_rate = ist->st->avg_frame_rate; + ost->st->r_frame_rate = ist->st->r_frame_rate; + } + break; }