[FFmpeg-devel] [PATCH v3 00/18] Subtitle Filtering

Soft Works softworkz at hotmail.com
Sat Sep 11 09:02:34 EEST 2021


v3 Update:

- Reworked, revised, rebased, reorganized, refactored
- No more prototype/test-style code
- Additional subtitle filters added
- Filter documentation added
- Adjusted FATE tests


This patchset is about introducing filtering support for subtitles.

The current sub2video "hack" implementation is slow, ineffective and 
limited in capabilities.

=> This patchset introduces true subtitle filtering

While v1 and v2 where intended for POC, RFC, and getting an impression 
regarding feasibility, this version is about getting serious on the
subject.

At a future point in time, it might make sense merge AVSubtitle into
AVFrame. I haven't done that yet to avoid cluttering the patchset with
too much distraction and keep focus on the relevant changes.

Otherwise, I think most of these changes are pretty much straightforward
and not a big thing.
(within the context of the current state of code!)

Details are always debatable and I'll be happy about any (productive) 
feedback.


These new filters are included:

- overlay_graphicsubs (VS -> V)
  Overlay graphic subtitles onto a video stream

- graphicsub2video {S -> V)
  Converts graphic subtitles to (transparent) video frames
  
- overlay_textsubs {VS -> V)
  Overlay text subtitles onto a video stream.
  
- textsubs2video {S -> V)
  Converts text subtitles to video frames
  
- textmod {S -> S)
  Modify subtitle text in a number of ways

- stripstyles {S -> S)
  Remove all inline styles from subtitle events


Regards,
softworkz


softworkz (18):
  avutil/frame: Subtitle Filtering - Add AVMediaType property to AVFrame
  avutil/subfmt: Move AVSubtitleType, AVSubtitle and AVSubtitleRect to
    avutil
  avcodec/avcodec: Remove AVSubtitleType, AVSubtitle and AVSubtitleRect
    from avcodec
  avcodec/avcodec: Add av_get_subtitle_format_from_codecdesc function
  avcodec/avcodec: Remove sub_text_format parameter
  avcodec/ass_split: Extend ass dialog parsing
  fftools/play,probe: Adjust for subtitle format type change
  fftools/ffmpeg: Replace sub2video with subtitle frame filtering
  avfilter/subtitles: Add subtitles.c
  avfilter/avfilter: Handle subtitle frames
  avfilter/subtitles: adjust for recent changes
  avfilter/sbuffer: Add sbuffersrv and sbuffersink filters
  avfilter/overlay_graphicsubs: Add overlay_graphicsubs and
    graphicsub2video filters
  avfilter/overlay_textsubs: Add overlay_textsubs and textsubs2video
    filters
  avfilter/textmod: Add textmod filter
  avfilter/stripstyles: Add stripstyles filter
  docs/filters: Add documentation for all new subtitle filters
  tests/fate: Update subtitle tests

 configure                                 |   4 +-
 doc/filters.texi                          | 263 ++++++++
 fftools/ffmpeg.c                          | 408 ++++++------
 fftools/ffmpeg.h                          |  12 +-
 fftools/ffmpeg_filter.c                   | 198 ++++--
 fftools/ffmpeg_hw.c                       |   2 +-
 fftools/ffmpeg_opt.c                      |   3 +-
 fftools/ffplay.c                          |   2 +-
 fftools/ffprobe.c                         |  23 +-
 libavcodec/ass.c                          |   2 +-
 libavcodec/ass.h                          |   6 +-
 libavcodec/ass_split.c                    |  12 +-
 libavcodec/ass_split.h                    |   2 +
 libavcodec/assdec.c                       |   2 +-
 libavcodec/assenc.c                       |   4 +-
 libavcodec/avcodec.c                      |  19 -
 libavcodec/avcodec.h                      |  81 +--
 libavcodec/decode.c                       |   5 +-
 libavcodec/dvbsubdec.c                    |   2 +-
 libavcodec/dvdsubdec.c                    |   2 +-
 libavcodec/dvdsubenc.c                    |   2 +-
 libavcodec/libzvbi-teletextdec.c          |  14 +-
 libavcodec/movtextenc.c                   |   4 +-
 libavcodec/options_table.h                |   2 -
 libavcodec/pgssubdec.c                    |   4 +-
 libavcodec/srtenc.c                       |   4 +-
 libavcodec/ttmlenc.c                      |   4 +-
 libavcodec/utils.c                        |  11 +
 libavcodec/version.h                      |   4 +-
 libavcodec/webvttenc.c                    |   4 +-
 libavcodec/xsubdec.c                      |   2 +-
 libavfilter/Makefile                      |   9 +
 libavfilter/allfilters.c                  |  16 +-
 libavfilter/avfilter.c                    |  26 +-
 libavfilter/avfiltergraph.c               |   5 +
 libavfilter/buffersink.c                  |  63 ++
 libavfilter/buffersink.h                  |  15 +
 libavfilter/buffersrc.c                   |  72 +++
 libavfilter/buffersrc.h                   |   1 +
 libavfilter/f_interleave.c                |   3 +
 libavfilter/formats.c                     |  14 +
 libavfilter/formats.h                     |   3 +
 libavfilter/internal.h                    |   1 +
 libavfilter/sf_stripstyles.c              | 246 +++++++
 libavfilter/sf_textmod.c                  | 409 ++++++++++++
 libavfilter/subtitles.c                   |  61 ++
 libavfilter/subtitles.h                   |  44 ++
 libavfilter/version.h                     |   2 +-
 libavfilter/vf_overlay_graphicsubs.c      | 740 ++++++++++++++++++++++
 libavfilter/vf_overlay_textsubs.c         | 633 ++++++++++++++++++
 libavfilter/vf_subtitles.c                |  14 +-
 libavutil/Makefile                        |   2 +
 libavutil/frame.c                         |  78 ++-
 libavutil/frame.h                         |  39 +-
 libavutil/subfmt.c                        |  78 +++
 libavutil/subfmt.h                        | 125 ++++
 libavutil/version.h                       |   2 +-
 tests/ref/fate/filter-overlay-dvdsub-2397 | 181 +++---
 tests/ref/fate/sub-dvb                    | 162 ++---
 tests/ref/fate/sub2video                  | 178 ++----
 tests/ref/fate/sub2video_basic            |  93 ++-
 tests/ref/fate/sub2video_time_limited     |   6 +-
 62 files changed, 3631 insertions(+), 797 deletions(-)
 create mode 100644 libavfilter/sf_stripstyles.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_overlay_graphicsubs.c
 create mode 100644 libavfilter/vf_overlay_textsubs.c
 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