[FFmpeg-devel] [PATCH] libavcodec/ccaption_dec.c: Fixed indentation overwriting text in the cea608 caption decoder.

Levi Dooley i.am.stickfigure at gmail.com
Tue Jan 26 01:08:20 EET 2021


There was an assumption in the existing code that indentation would not
occur more than once on the same row.
This was a bad assumption. There are examples of 608 streams which call
handle_pac multiple times on the same row with different indentation.
As the code was before this change, the new indentation would overwrite
existing text with spaces.
These changes make indentation skip over columns instead. Text gets cleared
with spaces on handle_edm.
Instead of relying on the null character, trailing spaces are trimmed off
the end of a row.
This is necessary so that a null character doesn't end up between two words.

Signed-off-by: Levi Dooley <i.am.stickfigure at gmail.com>

Here's a link to a sample file that will reproduce this issue.
https://snapstream-dev-test-public.s3.us-east-1.amazonaws.com/ffmpeg-caption-issue/cleveland-clip.ts

The issue can be reproduced by running the following command:

> ffmpeg -f lavfi -i "movie=cleveland-clip.ts[out0+subcc]" -map s
> cleveland-clip.ass


I've gone ahead and ran this command both before and after my code changes.
The following output files demonstrate that there are some clear cases of
missing words or sentences in the beforepatch file, and it is entirely
fixed by this patch in the afterpatch file.

Before this patch:
https://snapstream-dev-test-public.s3.us-east-1.amazonaws.com/ffmpeg-caption-issue/cleveland-clip-beforepatch.ass

After this patch:
https://snapstream-dev-test-public.s3.us-east-1.amazonaws.com/ffmpeg-caption-issue/cleveland-clip-afterpatch.ass

And here is the full sample video in case anyone wants to play around with
a larger example with many more caption errors. The above video sample
"cleveland-clip.ts" is just a 60 second clip of the following.
https://snapstream-dev-test-public.s3.us-east-1.amazonaws.com/ffmpeg-caption-issue/The%20Cleveland%20Show%20-%20%28Brown%20Magic%29-2018-12-14-0.ts

The full patch file is attached to this email.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libavcodec-ccaption_dec.c-Fixed-indentation-overwrit.patch
Type: application/x-patch
Size: 5985 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210125/1b0e2322/attachment.bin>


More information about the ffmpeg-devel mailing list