From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v3 1/6] avcodec/mpeg12dec: extract only one type of CC substream
Date: Tue, 12 Mar 2024 12:52:29 +0100
Message-ID: <AS8P250MB07441BDF8F6DCB9BC5E3D2CC8F2B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <ZfA1wbRcRgl1FbT2@mariano>
Stefano Sabatini:
> On date Tuesday 2024-03-12 01:00:00 -0500, Marth64 wrote:
>> In MPEG-2 user data, there can be different types of Closed Captions
>> formats embedded (A53, SCTE-20, or DVD). The current behavior of the
>> CC extraction code in the MPEG-2 decoder is to not be aware of
>> multiple formats if multiple exist, therefore allowing one format
>> to overwrite the other during the extraction process since the CC
>> extraction shares one output buffer for the normalized bytes.
>>
>> This causes sources that have two CC formats to produce flawed output.
>> There exist real-world samples which contain both A53 and SCTE-20 captions
>> in the same MPEG-2 stream, and that manifest this problem. Example of symptom:
>> THANK YOU (expected) --> THTHANANK K YOYOUU (actual)
>>
>> The solution is to pick only the first CC substream observed with valid bytes,
>> and ignore the other types. Additionally, provide an option for users
>> to manually "force" a type in the event that this matters for a particular
>> source.
>>
>> Signed-off-by: Marth64 <marth64@proxyid.net>
>> ---
>> libavcodec/mpeg12dec.c | 67 ++++++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 64 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
>> index 3a2f17e508..8961a290a3 100644
>> --- a/libavcodec/mpeg12dec.c
>> +++ b/libavcodec/mpeg12dec.c
>> @@ -62,6 +62,16 @@
>>
>> #define A53_MAX_CC_COUNT 2000
>>
>> +enum Mpeg2ClosedCaptionsFormat {
>> + CC_FORMAT_AUTO,
>> + CC_FORMAT_A53_PART4,
>> + CC_FORMAT_SCTE20,
>> + CC_FORMAT_DVD
>> +};
>
>> +static const char mpeg2_cc_format_labels[4][12] = {
>
> nit: this might be
> static const char *mpeg2_cc_format_labels[4] = {
>
This would add relocations and put this into .data.rel.ro.
> to avoid unnecessary constraints on the string length, or you might
> pass the CC name in the function directly to avoid to maintain the
> array (as it is not shared at the moment)
>
That sound like a good idea.
>> + "Unknown", "A/53 Part 4", "SCTE-20", "DVD"
>> +};
>> +
>
> [...]
>
> LGTM otherwise.
_______________________________________________
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".
next prev parent reply other threads:[~2024-03-12 11:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 5:59 [FFmpeg-devel] [PATCH v3 0/6] Closed Captions improvements (phase 1) Marth64
2024-03-12 6:00 ` [FFmpeg-devel] [PATCH v3 1/6] avcodec/mpeg12dec: extract only one type of CC substream Marth64
2024-03-12 11:00 ` Stefano Sabatini
2024-03-12 11:52 ` Andreas Rheinhardt [this message]
2024-03-28 9:29 ` Anton Khirnov
2024-03-28 15:41 ` Marth64
2024-03-12 6:00 ` [FFmpeg-devel] [PATCH v3 2/6] avcodec/ccaption_dec: don't print multiple \an and \pos tags Marth64
2024-03-12 13:49 ` Stefano Sabatini
2024-03-12 6:00 ` [FFmpeg-devel] [PATCH v3 3/6] avcodec/ccaption_dec: ignore leading non-breaking spaces Marth64
2024-03-12 13:50 ` Stefano Sabatini
2024-03-17 4:27 ` Marth64
2024-03-12 6:00 ` [FFmpeg-devel] [PATCH v3 4/6] avcodec/rcwtenc: canonize name and refresh documentation Marth64
2024-03-12 13:52 ` Stefano Sabatini
2024-03-12 6:00 ` [FFmpeg-devel] [PATCH v3 5/6] avformat/rcwtdec: add RCWT Closed Captions demuxer Marth64
2024-03-12 11:44 ` Andreas Rheinhardt
2024-03-12 14:12 ` Marth64
2024-03-17 4:29 ` [FFmpeg-devel] [PATCH v4] " Marth64
2024-03-18 20:12 ` Marth64
2024-03-19 14:35 ` Stefano Sabatini
2024-03-19 15:55 ` Marth64
2024-03-19 17:39 ` [FFmpeg-devel] [PATCH v5 1/4] " Marth64
2024-03-19 17:39 ` [FFmpeg-devel] [PATCH v5 2/4] avformat/rcwtenc: remove repeated documentation Marth64
2024-03-19 17:39 ` [FFmpeg-devel] [PATCH v5 3/4] doc/muxers: refresh and simplify RCWT muxer documentation Marth64
2024-03-19 17:39 ` [FFmpeg-devel] [PATCH v5 4/4] doc/indevs: update CC extraction example to use RCWT muxer Marth64
2024-03-20 14:13 ` Stefano Sabatini
2024-03-19 21:41 ` [FFmpeg-devel] [PATCH v5 1/4] avformat/rcwtdec: add RCWT Closed Captions demuxer Michael Niedermayer
2024-03-19 22:07 ` Marth64
2024-03-20 14:11 ` Stefano Sabatini
2024-03-12 6:00 ` [FFmpeg-devel] [PATCH v3 6/6] avformat/sccdec: remove unused bprint.h include Marth64
2024-03-12 13:53 ` Stefano Sabatini
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=AS8P250MB07441BDF8F6DCB9BC5E3D2CC8F2B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.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