[FFmpeg-devel] [PATCH 0/2] ARIB STD-B24 caption decoding using libaribb24

Jan Ekström jeebjp at gmail.com
Fri Feb 8 02:38:07 EET 2019

On Sat, Feb 2, 2019 at 3:31 PM Jan Ekström <jeebjp at gmail.com> wrote:
> A decoder wrapper for the libaribb24 library found in various
> distributions and currently utilized by VLC.
> Requires GPLv3 with the current most recent release, but as the
> current library master is LGPLv3, any newer releases will require
> only LGPLv3.
> If the library is not found in your distribution, it is available at:
> https://github.com/nkoriyama/aribb24
> A test sample can be found at:
> https://kuroko.fushizen.eu/samples/arib_captions_colors_positioning_ruby_subpics.ts
> An example of how the decoded output currently looks can be found at:
> https://megumin.fushizen.eu/screenshots/arib_subs/mpv-shot0004.png
> I will proceed to making a FATE test as soon as I figure out the simplest
> way to limit an MPEG-TS stream to some PIDs without doing full remuxing.
> (I think dvblast has something like this so I might take a look at that)
> The decoded subtitles might or might not have durations set, so with
> ffmpeg.c `-fix_sub_duration` is required.
> Regarding positioning:
> I have an initial version of positioning implemented, but unfortunately
> it requires multiple subtitle lines per AVSubtitle, and many applications
> seem to fail at handling them, including the encoding portions of
> libavformat/libavcodec (all lines end up concatenated into a single line, even
> though that is 100% invalid as there is a header included).
> Thus I have decided to post the first version out now, as when the ruby
> blocks are not included as a distraction, single-line output seems to be
> fine and readable/enjoyable.
> Best regards,
> Jan
> Jan Ekström (2):
>   add libaribb24 ARIB STD-B24 caption decoder
>   lavf/mpegts: add reading of ARIB data coding descriptor
>  Changelog               |   1 +
>  configure               |   7 +
>  doc/decoders.texi       |  25 +++
>  libavcodec/Makefile     |   1 +
>  libavcodec/allcodecs.c  |   1 +
>  libavcodec/avcodec.h    |   4 +
>  libavcodec/codec_desc.c |   9 +-
>  libavcodec/libaribb24.c | 378 ++++++++++++++++++++++++++++++++++++++++
>  libavcodec/profiles.c   |   6 +
>  libavcodec/profiles.h   |   1 +
>  libavcodec/version.h    |   2 +-
>  libavformat/mpegts.c    |  47 +++++
>  libavformat/version.h   |   2 +-
>  13 files changed, 481 insertions(+), 3 deletions(-)
>  create mode 100644 libavcodec/libaribb24.c
> --
> 2.20.1

I really don't like to do this because I really like consensus... But
now that I know that the disagreement that was had about this patch
set was not a blocking one, I would like to move forward with my
ARIB-related work (of which this was part 1). As I have addressed all
the technical comments that I have received regarding the patches in
this set, if any more doesn't come within the next 24 or so hours or
so I would like to start pushing this in as a "reference" decoder for
this format against which a future internal implementation can be
compared against.

One of the things about which I would have liked comments is the
generation of the ASS header. I saw the libzvbi module just adding
another style into the string returned by the default header
generator, so I did end up wondering if an av_strnstr based solution
would be preferable instead of duplicating the full header generation?
The more detailed function that gives you control over some values
didn't let me override those values that I wanted (such as PlayResX/Y
in the beginning of the header), which is why I initially just used
the same string template with av_asprintf and with values matching my
use case. Another thing would have been the default font in the style,
which I am not sure what to set to, since as far as I know there's no
standard font type name which means "something that more or less
matches the .jp broadcast font specs" (although I'll try to check the
metadata on the .jp broadcast font that came with Windows 7
tomorrow^Wtoday after work).

After this patch set, I will most likely try to see if I can fix at
least the ASS encoder/muxer so that it would handle multiple
AVSubtitleRects in an AVSubtitle correctly. That then enables making
use of the positioning data in ARIB captions by pushing separately
positioned regions as separate lines. Past that, metadata text
decoding would be following (for which I already have a WIP patch in
my work tree), but I will also attempt to see if the text encoding can
be brought in as the beginnings of internal ARIB STD-B24 support.


More information about the ffmpeg-devel mailing list