diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-07-25 16:01:40 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-08-30 11:51:42 +0200 |
commit | ed5caaaf221bda5b4efbe8a3631d0a3438b0d32c (patch) | |
tree | d2cdb619ff084da84cdfe93f3f0f3a56f90f1dc1 /fftools | |
parent | b39b6b745669f0472768d57092fbd1b009fd6a33 (diff) | |
download | ffmpeg-ed5caaaf221bda5b4efbe8a3631d0a3438b0d32c.tar.gz |
fftools/ffmpeg_mux: use correct timebases for bitstream filtering
Bitstream filtering input timebase is not always necessarily equal to
OutputStream.mux_timebase. Also, set AVPacket.time_base correctly for
packets output by bitstream filters
Do not rescale at all in of_output_packet() when not doing bitstream
filtering, as it's unnecessary - write_packet() will rescale to the
actual muxer timebase.
Diffstat (limited to 'fftools')
-rw-r--r-- | fftools/ffmpeg_mux.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 24cdf00469..ab9bb398c1 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -340,16 +340,13 @@ int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt) if (pkt && pkt->dts != AV_NOPTS_VALUE) ost->last_mux_dts = av_rescale_q(pkt->dts, pkt->time_base, AV_TIME_BASE_Q); - /* rescale timestamps to the muxing timebase */ - if (pkt) { - av_packet_rescale_ts(pkt, pkt->time_base, ost->mux_timebase); - pkt->time_base = ost->mux_timebase; - } - /* apply the output bitstream filters */ if (ms->bsf_ctx) { int bsf_eof = 0; + if (pkt) + av_packet_rescale_ts(pkt, pkt->time_base, ms->bsf_ctx->time_base_in); + ret = av_bsf_send_packet(ms->bsf_ctx, pkt); if (ret < 0) { err_msg = "submitting a packet for bitstream filtering"; @@ -367,6 +364,9 @@ int of_output_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt) goto fail; } + if (!bsf_eof) + ms->bsf_pkt->time_base = ms->bsf_ctx->time_base_out; + ret = submit_packet(mux, bsf_eof ? NULL : ms->bsf_pkt, ost); if (ret < 0) goto mux_fail; |