mbox

[FFmpeg-devel,v6,00/11] Subtitle Filtering

Message ID MN2PR04MB5981F9DDAA0B4B77B5B71B16BADC9@MN2PR04MB5981.namprd04.prod.outlook.com
Headers show

Message

Soft Works Sept. 16, 2021, 8:30 p.m. UTC
v6 Update:

- Implements all given feedback from reviews (thanks!)
- Add AVSubtitle fields to AVFrame, keeping AVSubtitle unchanged
  for compatibility and future deprecation
- Use subtitle frames internally and for filtering 
- Retain compatibility with legacy subtitle implementation
  through a number of compatibility conversion methods
- Reordered and reorganized commits, each one passing 
  FATE now
- Document new public API functions
- Many more detail changes


v5 Update:

- Merge AVSubtitle into AVFrame
- Move FATE test adjustments to corresponding commit
- Move documentation updates to corresponding filter commits
- Remove mediatype parameter from av_frame_get_buffer2

(still need some advice for splitting the commits in a way that 
every single one will pass FATE)

v4 Update:

- Re-Sending due to Patchwork having failed to parse my patchset
  There seems to be a bug in Patchwork when parallel processing is 
  enabled. 
  This time, I'll send the e-mails slowly, one after another.

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

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 (11):
  global: Prepare AVFrame for subtitle handling
  fftools/play,probe: Adjust for subtitle changes
  avfilter/subtitles: Add subtitles.c for subtitle frame allocation
  avfilter/avfilter: Handle subtitle frames
  avfilter/sbuffer: Add sbuffersrv and sbuffersink filters
  avfilter/overlay_graphicsubs: Add overlay_graphicsubs and
    graphicsub2video filters
  fftools/ffmpeg: Replace sub2video with subtitle frame filtering
  avfilter/overlay_textsubs: Add overlay_textsubs and textsubs2video
    filters
  avfilter/textmod: Add textmod filter
  avcodec/ass_split: Extend ass dialog parsing
  avfilter/stripstyles: Add stripstyles filter

 configure                                 |   4 +-
 doc/filters.texi                          | 261 ++++++++
 fftools/ffmpeg.c                          | 459 ++++++--------
 fftools/ffmpeg.h                          |  14 +-
 fftools/ffmpeg_filter.c                   | 198 ++++--
 fftools/ffmpeg_hw.c                       |   2 +-
 fftools/ffmpeg_opt.c                      |   3 +-
 fftools/ffplay.c                          |  50 +-
 fftools/ffprobe.c                         |  49 +-
 libavcodec/ass_split.c                    |  12 +-
 libavcodec/ass_split.h                    |   2 +
 libavcodec/avcodec.c                      |  19 -
 libavcodec/avcodec.h                      | 105 ++--
 libavcodec/decode.c                       |  24 +-
 libavcodec/pgssubdec.c                    |   1 +
 libavcodec/utils.c                        |  11 +
 libavfilter/Makefile                      |   9 +
 libavfilter/allfilters.c                  |  16 +-
 libavfilter/avfilter.c                    |  30 +-
 libavfilter/avfiltergraph.c               |   5 +
 libavfilter/buffersink.c                  |  63 ++
 libavfilter/buffersink.h                  |  15 +
 libavfilter/buffersrc.c                   |  72 +++
 libavfilter/buffersrc.h                   |   1 +
 libavfilter/formats.c                     |  14 +
 libavfilter/formats.h                     |   3 +
 libavfilter/internal.h                    |   1 +
 libavfilter/sf_stripstyles.c              | 211 +++++++
 libavfilter/sf_textmod.c                  | 372 +++++++++++
 libavfilter/subtitles.c                   |  61 ++
 libavfilter/subtitles.h                   |  44 ++
 libavfilter/version.h                     |   2 +-
 libavfilter/vf_overlay_graphicsubs.c      | 727 ++++++++++++++++++++++
 libavfilter/vf_overlay_textsubs.c         | 613 ++++++++++++++++++
 libavfilter/vf_subtitles.c                |  28 +-
 libavformat/utils.c                       |   1 +
 libavutil/Makefile                        |   2 +
 libavutil/frame.c                         | 184 +++++-
 libavutil/frame.h                         |  93 ++-
 libavutil/subfmt.c                        | 221 +++++++
 libavutil/subfmt.h                        | 186 ++++++
 libavutil/version.h                       |   2 +-
 tests/ref/fate/filter-overlay-dvdsub-2397 | 181 +++---
 tests/ref/fate/sub-dvb                    | 162 ++---
 tests/ref/fate/sub2video                  |  44 --
 tests/ref/fate/sub2video_basic            |  93 ++-
 tests/ref/fate/sub2video_time_limited     |   4 +-
 47 files changed, 3912 insertions(+), 762 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