Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Jack Lau <jacklau1222gm@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] examples/transcoding: Fix time_base handling
Date: Wed, 5 Feb 2025 10:28:28 +0800
Message-ID: <4FE2CD32-C957-487D-BE86-146867B83243@gmail.com> (raw)
In-Reply-To: <5293f083-fefe-42c7-ace7-d3838ff39e1c@gmail.com>

> 
> AVCodecContext.time_base is not used for decoding.


Thank you for your reply. I understand that time_base is not used during decoding, but the transcoding code calls av_packet_rescale_ts twice, once before decoding and once after encoding, as shown below:

540         if (filter_ctx[stream_index].filter_graph) {
541             StreamContext *stream = &stream_ctx[stream_index];
542     
543             av_log(NULL, AV_LOG_DEBUG, "Going to reencode&filter the frame\n");
544         
545             av_packet_rescale_ts(packet,                                                                                                                   
546                                  ifmt_ctx->streams[stream_index]->time_base,
547                                  stream->dec_ctx->time_base);
548             ret = avcodec_send_packet(stream->dec_ctx, packet);

448         /* prepare packet for muxing */                                                                                                                    
449         enc_pkt->stream_index = stream_index;
450         av_packet_rescale_ts(enc_pkt,
451                              stream->enc_ctx->time_base,
452                              ofmt_ctx->streams[stream_index]->time_base);
453 
454         av_log(NULL, AV_LOG_DEBUG, "Muxing frame\n");
455         /* mux encoded frame */
456         ret = av_interleaved_write_frame(ofmt_ctx, enc_pkt);

If dec_ctx->time_base and enc_ctx->time_base are not consistent, it can lead to incorrect packet duration, which in turn causes issues with the output file's duration.
_______________________________________________
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".

  parent reply	other threads:[~2025-02-05  2:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05  0:51 Jack Lau
2025-02-05  0:55 ` James Almer
2025-02-05  2:26   ` Jack Lau
2025-02-05  3:25     ` Jack Lau
2025-02-05  9:00       ` Jack Lau
2025-02-05  2:28   ` Jack Lau [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-02-05  8:37 Jack Lau via ffmpeg-devel
2025-02-05  2:17 Jack Lau
2025-02-04 15:35 Jack Lau
2025-02-04 15:13 Jack Lau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FE2CD32-C957-487D-BE86-146867B83243@gmail.com \
    --to=jacklau1222gm@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git