Re: [FFmpeg-devel] [PATCH] examples/transcoding: Fix time_base handling

2025-02-05 Thread Jack Lau
Hello. I found one better method to fix this issue. Firstly, i think the problem caused by incorrectly setting enc_ctx->time_base, so i refer to the implementation in avcodec_open2() 361 #if FF_API_AVCTX_TIMEBASE 362if (avctx->framerate.num > 0 && avctx->framerate.den > 0) 363

Re: [FFmpeg-devel] [PATCH] examples/transcoding: Fix time_base handling

2025-02-04 Thread Jack Lau
To be clear, i want to give an example, i use a 10s duration, 30fps video. The ifmt_ctx->streams[stream_index]->time_base is same as ofmt_ctx->streams[stream_index]->time_base after initializing. The stream->dec_ctx->time_base is default 0,60 but stream->enc_ctx->time_base is set to av_inv_q(dec_ct

Re: [FFmpeg-devel] [PATCH] examples/transcoding: Fix time_base handling

2025-02-04 Thread Jack Lau
> > 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_

Re: [FFmpeg-devel] [PATCH] examples/transcoding: Fix time_base handling

2025-02-04 Thread Jack Lau
> > 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_

Re: [FFmpeg-devel] [PATCH] examples/transcoding: Fix time_base handling

2025-02-04 Thread James Almer
From bfd5500a5448ad468d32994816e8a55c0d4a2428 Mon Sep 17 00:00:00 2001 From: Jack Lau Date: Tue, 4 Feb 2025 21:39:20 +0800 Subject: [PATCH] examples/transcoding: Fix time_base handling The `dec_ctx->time_base` was incorrectly default set to 0/60, while `enc_ctx->time_base` was derived from `dec