I need to crop bitmap-based DVB subtitles. An ideal solution should fit in an
ffmpeg workflow with Linux, but I’ll appreciate any suggestion.
A bit of context if you care: I post-process hundreds of hours of TV-broadcast movie recordings using
ffmpeg. Among other things, I crop the top and bottom black bars off the video stream (using the
crop filter). Since the associated subtitle streams are bitmap-based (DVB subtitles), I need to crop them accordingly. Burning them is not an option.
Unfortunately, I was surprised not to find any tool to do so.
ffmpeg apparently has no filter that processes subtitle streams¹, and Google queries such as “crop DVB subtitles” gives me no meaningful result. Yet I would bet that it is a trivial task (?).
¹ It really feels like subtitles are second-class citizens to this software.
In a quest for perfection, I also considered using an OCR tool to turn the bitmap into text, which should at least be easier to deal with by myself. I found CCExtractor and Subtitle Edit (and maybe Flussonic but that one looks like a paid software). However:
- OCR requires manual intervention, which I cannot afford.
- I want to preserve appearance on screen as much as possible: DVB subtitles I deal with are typeset with varying colors and disposed at specific places. I am not sure that the aforementioned tools do this, as I believe they produce an SRT-like format which does not permit custom positioning (unlike ASS). Furthermore, if I manage to get such positioned text-based subtitles, I would still need to crop them (by translating their coordinates) in order to address the initial problem.
- The bitrate overhead of bitmap-based subtitles is negligible compared with video streams.