[FFmpeg-devel] [PATCH] lavd/lavfi.c: Set time_base for 608 cc to container time_base.
Thilo Borgmann
thilo.borgmann at mail.de
Sun Jul 25 10:47:06 EEST 2021
Am 16.07.21 um 09:45 schrieb Thilo Borgmann:
> Hi,
>
>>>> when transcoding 608 cc, the cc stream frame pts is set to the same value as its container frame's pts. However, the time_base is always set to 1/90000 (default) in the initialization stage. Which causes timing issues when the container time_base is actually not 1/90000.
>>>
>>> identical v2 attached that also includes updates to the FATE references affected by the patch (and failed with patchwork of course).
>>>
>>> -Thilo
>>>
>>> From 41b619e5d5083ca59a41cca9cb515190939d6573 Mon Sep 17 00:00:00 2001
>>> From: Yun Zhang <yunz at devvm259.frc1.facebook.com>
>>> Date: Mon, 28 Jun 2021 15:09:42 +0200
>>> Subject: [PATCH] lavd/lavfi.c: Set time_base for 608 cc to container
>>> time_base.
>>>
>>> Suggested-By: ffmpeg at fb.com
>>> ---
>>> libavdevice/lavfi.c | 3 +++
>>> tests/ref/fate/sub-cc | 4 ++--
>>> tests/ref/fate/sub-cc-realtime | 38 +++++++---------------------------
>>> 3 files changed, 13 insertions(+), 32 deletions(-)
>>>
>>> diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
>>> index 57d977e7ce..e07f20c872 100644
>>> --- a/libavdevice/lavfi.c
>>> +++ b/libavdevice/lavfi.c
>>> @@ -100,6 +100,7 @@ static int create_subcc_streams(AVFormatContext *avctx)
>>> LavfiContext *lavfi = avctx->priv_data;
>>> AVStream *st;
>>> int stream_idx, sink_idx;
>>> + AVRational *time_base;
>>>
>>> for (stream_idx = 0; stream_idx < lavfi->nb_sinks; stream_idx++) {
>>> sink_idx = lavfi->stream_sink_map[stream_idx];
>>> @@ -109,6 +110,8 @@ static int create_subcc_streams(AVFormatContext *avctx)
>>> return AVERROR(ENOMEM);
>>> st->codecpar->codec_id = AV_CODEC_ID_EIA_608;
>>> st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
>>> + time_base = &avctx->streams[stream_idx]->time_base;
>>> + avpriv_set_pts_info(st, 64, time_base->num, time_base->den);
>>
>> This look like an unnecessariily complicated way to write
>> st->time_base.{num,den}
>
> Changed patch attached.
Will push soon (tm) if there are no further comments.
Thanks,
Thilo
More information about the ffmpeg-devel
mailing list