[FFmpeg-devel] [PATCH v16 00/16] Subtitle Filtering

Soft Works softworkz at hotmail.com
Thu Nov 25 19:53:07 EET 2021


Root commit for adding subtitle filtering capabilities.
In detail:

- Add type (AVMediaType) field to AVFrame
  Replaces previous way of distinction which was based on checking
  width and height to determine whether a frame is audio or video
- Add subtitle fields to AVFrame
- Add new struct AVSubtitleArea, similar to AVSubtitleRect, but different
  allocation logic. Cannot and must not be used interchangeably, hence
  the new struct
- Move enum AVSubtitleType, AVSubtitle and AVSubtitleRect to avutil
- Add public-named members to enum AVSubtitleType (AV_SUBTITLE_FMT_)
- Add avcodec_decode_subtitle3 which takes subtitle frames,
  serving as compatibility shim to legacy subtitle decoding
- Add additional methods for conversion between old and new API

New in V15

- Added missing reference to subfmt.h iun libzvbi-teletextdec.c
- Fixed Fate error in patch 15/16
- Removed all trsiling whitespace in tilers.texi

New in V15

- Rebased to upstream changes 
- avcodec/subtitles: Migrate subtitle encoders to frame-based API and provide compatibility shim for legacy api
- fftools/ffmpeg: Use new frame-based subtitle encoding API
- AVSubtitleArea: copy flags field, make params const
- graphicsubs2text: Don't emit duplicate frames
- graphicsubs2text: Combined OCR output into a single AVSubtitleArea
  (I have a prototype for detecting text colors and positions, but it's not ready at this point)
- splitcc: cleanup local subtitle_header ref
- stripstyles: add parameter for ass layer selection
- avcodec/subtitles: deferred loading of ass header for text subtitle encoders
- verified all example command lines in the docs are working, added somre more

Kind regards,
softworkz


softworkz (16):
  global: Prepare AVFrame for subtitle handling
  global: Move ass helper functions to avutil as avpriv_ and extend ass
    dialog parsing
  fftools/play,probe: Adjust for subtitle changes
  avfilter/subtitles: Add subtitles.c for subtitle frame allocation
  avfilter/avfilter: Handle subtitle frames
  avfilter/sbuffer: Add sbuffersrc and sbuffersink filters
  avfilter/overlaygraphicsubs: Add overlaygraphicsubs and
    graphicsub2video filters
  fftools/ffmpeg: Replace sub2video with subtitle frame filtering
  avfilter/overlaytextsubs: Add overlaytextsubs and textsubs2video
    filters
  avfilter/textmod: Add textmod, censor and show_speaker filters
  avfilter/stripstyles: Add stripstyles filter
  avfilter/splitcc: Add splitcc filter for closed caption handling
  avfilter/graphicsub2text: Add new graphicsub2text filter (OCR)
  avfilter/subscale: Add filter for scaling and/or re-arranging
    graphical subtitles
  avcodec/subtitles: Migrate subtitle encoders to frame-based API and
    provide a compatibility shim for the legacy api
  fftools/ffmpeg: Use new frame-based subtitle encoding API

 configure                                     |   7 +-
 doc/filters.texi                              | 756 +++++++++++++++
 fftools/ffmpeg.c                              | 553 ++++++-----
 fftools/ffmpeg.h                              |  15 +-
 fftools/ffmpeg_filter.c                       | 217 +++--
 fftools/ffmpeg_hw.c                           |   2 +-
 fftools/ffmpeg_opt.c                          |   3 +-
 fftools/ffplay.c                              | 102 +-
 fftools/ffprobe.c                             |  48 +-
 libavcodec/Makefile                           |  56 +-
 libavcodec/ass.h                              | 129 +--
 libavcodec/assdec.c                           |   2 +-
 libavcodec/assenc.c                           |  83 +-
 libavcodec/avcodec.c                          |  19 -
 libavcodec/avcodec.h                          |  82 +-
 libavcodec/ccaption_dec.c                     |  19 +-
 libavcodec/decode.c                           |  53 +-
 libavcodec/dvbsubenc.c                        |  85 +-
 libavcodec/dvdsubenc.c                        |  89 +-
 libavcodec/encode.c                           |  98 +-
 libavcodec/jacosubdec.c                       |   2 +-
 libavcodec/libaribb24.c                       |   2 +-
 libavcodec/libzvbi-teletextdec.c              |  15 +-
 libavcodec/microdvddec.c                      |   7 +-
 libavcodec/movtextdec.c                       |   3 +-
 libavcodec/movtextenc.c                       | 115 ++-
 libavcodec/mpl2dec.c                          |   2 +-
 libavcodec/pgssubdec.c                        |   1 +
 libavcodec/realtextdec.c                      |   2 +-
 libavcodec/samidec.c                          |   2 +-
 libavcodec/srtdec.c                           |   2 +-
 libavcodec/srtenc.c                           | 104 ++-
 libavcodec/subviewerdec.c                     |   2 +-
 libavcodec/tests/avcodec.c                    |   2 -
 libavcodec/textdec.c                          |   4 +-
 libavcodec/ttmlenc.c                          |  95 +-
 libavcodec/utils.c                            |  11 +
 libavcodec/webvttdec.c                        |   2 +-
 libavcodec/webvttenc.c                        |  81 +-
 libavcodec/xsubenc.c                          |  65 +-
 libavfilter/Makefile                          |  15 +
 libavfilter/allfilters.c                      |  13 +
 libavfilter/avfilter.c                        |  30 +-
 libavfilter/avfilter.h                        |  11 +
 libavfilter/avfiltergraph.c                   |   5 +
 libavfilter/buffersink.c                      |  63 ++
 libavfilter/buffersink.h                      |  15 +
 libavfilter/buffersrc.c                       |  72 ++
 libavfilter/buffersrc.h                       |   1 +
 libavfilter/formats.c                         |  22 +
 libavfilter/formats.h                         |   3 +
 libavfilter/internal.h                        |  19 +-
 libavfilter/sf_graphicsub2text.c              | 354 +++++++
 libavfilter/sf_splitcc.c                      | 316 +++++++
 libavfilter/sf_stripstyles.c                  | 196 ++++
 libavfilter/sf_subscale.c                     | 883 ++++++++++++++++++
 libavfilter/sf_textmod.c                      | 697 ++++++++++++++
 libavfilter/subtitles.c                       |  63 ++
 libavfilter/subtitles.h                       |  44 +
 libavfilter/vf_overlaygraphicsubs.c           | 737 +++++++++++++++
 libavfilter/vf_overlaytextsubs.c              | 624 +++++++++++++
 libavfilter/vf_subtitles.c                    |  50 +-
 libavformat/utils.c                           |   1 +
 libavutil/Makefile                            |   4 +
 {libavcodec => libavutil}/ass.c               |  73 +-
 libavutil/ass_internal.h                      | 139 +++
 {libavcodec => libavutil}/ass_split.c         |  30 +-
 .../ass_split_internal.h                      |  24 +-
 libavutil/frame.c                             | 194 +++-
 libavutil/frame.h                             |  93 +-
 libavutil/subfmt.c                            | 243 +++++
 libavutil/subfmt.h                            | 185 ++++
 tests/ref/fate/filter-overlay-dvdsub-2397     | 181 ++--
 tests/ref/fate/sub-dvb                        | 162 ++--
 tests/ref/fate/sub2video                      | 116 +--
 tests/ref/fate/sub2video_basic                | 135 +--
 tests/ref/fate/sub2video_time_limited         |   4 +-
 77 files changed, 7373 insertions(+), 1381 deletions(-)
 create mode 100644 libavfilter/sf_graphicsub2text.c
 create mode 100644 libavfilter/sf_splitcc.c
 create mode 100644 libavfilter/sf_stripstyles.c
 create mode 100644 libavfilter/sf_subscale.c
 create mode 100644 libavfilter/sf_textmod.c
 create mode 100644 libavfilter/subtitles.c
 create mode 100644 libavfilter/subtitles.h
 create mode 100644 libavfilter/vf_overlaygraphicsubs.c
 create mode 100644 libavfilter/vf_overlaytextsubs.c
 rename {libavcodec => libavutil}/ass.c (73%)
 create mode 100644 libavutil/ass_internal.h
 rename {libavcodec => libavutil}/ass_split.c (94%)
 rename libavcodec/ass_split.h => libavutil/ass_split_internal.h (89%)
 create mode 100644 libavutil/subfmt.c
 create mode 100644 libavutil/subfmt.h

-- 
2.30.2.windows.1



More information about the ffmpeg-devel mailing list