mbox

[FFmpeg-devel,v8,00/13] Subtitle Filtering

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

Message

Soft Works Sept. 21, 2021, 11:54 p.m. UTC
v8 Update:

- Added new subtitle filters:
  graphicsub2text, censor, show_speaker (see below)
- Added parameters to load words from file 
  for textmod and censor
- Copied copyright owners from vf_overlay to
  vf_overlay_graphicsubs
- Remove "convenience" pointers (data) from AVSubtitleArea
  (not needed, will avoid migration errors)
- Minor fixes

--------------------------------------------------------------

This patchset introduces filtering support for subtitles.

Besides the ground work, this patchset includes a range
of new filters for subtitle processing:

- graphicsubs2text (S -> S)
  Convert graphic subtitles to text subtitles via OCR
  
- censor {S -> S)
  Allows censoring word in subtitles by a configurable
  word list
  
- show_speaker {S -> S)
  Prepend the speaker names to text lines
  (those are often available in ass subs)  
  
- split_cc (V -> VS)
  Splits out Closed-Caption data as a subtitle stream
  for filtering and encoding
  
- 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 (13):
  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 sbuffersrc 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, censor and show_speaker filters
  avcodec/ass_split: Extend ass dialog parsing
  avfilter/stripstyles: Add stripstyles filter
  avfilter/split_cc: Add split_cc filter for closed caption handling
  avfilter/graphicsub2text: Add new graphicsub2text filter (OCR)

 configure                                 |   5 +-
 doc/filters.texi                          | 482 ++++++++++++++
 fftools/ffmpeg.c                          | 460 ++++++--------
 fftools/ffmpeg.h                          |  14 +-
 fftools/ffmpeg_filter.c                   | 200 ++++--
 fftools/ffmpeg_hw.c                       |   2 +-
 fftools/ffmpeg_opt.c                      |   3 +-
 fftools/ffplay.c                          |  79 +--
 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                      |  13 +
 libavfilter/allfilters.c                  |  20 +-
 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_graphicsub2text.c          | 326 ++++++++++
 libavfilter/sf_split_cc.c                 | 272 ++++++++
 libavfilter/sf_stripstyles.c              | 211 +++++++
 libavfilter/sf_textmod.c                  | 727 +++++++++++++++++++++
 libavfilter/subtitles.c                   |  61 ++
 libavfilter/subtitles.h                   |  44 ++
 libavfilter/version.h                     |   2 +-
 libavfilter/vf_overlay_graphicsubs.c      | 730 ++++++++++++++++++++++
 libavfilter/vf_overlay_textsubs.c         | 615 ++++++++++++++++++
 libavfilter/vf_subtitles.c                |  27 +-
 libavformat/utils.c                       |   1 +
 libavutil/Makefile                        |   2 +
 libavutil/frame.c                         | 187 +++++-
 libavutil/frame.h                         |  93 ++-
 libavutil/subfmt.c                        | 219 +++++++
 libavutil/subfmt.h                        | 185 ++++++
 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 +-
 48 files changed, 5117 insertions(+), 774 deletions(-)
 create mode 100644 libavfilter/sf_graphicsub2text.c
 create mode 100644 libavfilter/sf_split_cc.c
 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