Please let me know if this belongs in another thread. I've been researching this question by Google for some time and finding loads of things what are not what I need.

The background:
  • I've got a video about ready for DVD, via DVD Styler, and it came with subtitles in .srt form (or maybe I extracted them to .srt, I forget which)

  • I eventually accepted the fact that there was no way the DVD-compatible subtitle stream was ever going to give me professional looking typesetting of the subtitles, having tried a number of ways and always winding up with the subtitles looking damaged on the DVD, from merely unacceptable to outright ridiculous.

  • so I turned it around: the film is letterboxed for DVD format, leaving adequate space below it for burned in (permanent) subtitles.

  • having translated the .srt file to a .ass, I used the "ass=" video filter in ffmpeg. Brilliant! Good colours, just the fonts I wanted, different type styles as needed, the lot. It also let me do some refinements on the subtitle timings, which were, you might say, less than precise.

  • Then all I needed was an actually separate subtitle stream consisting only of black slides where and when each subtitle was, so that instead of switching subtitles off, I would switch on the hiding of them.

  • So I created a script to translate the .ass file into an .xml file for spumux to interpret. For the .png to use as the image for each cover (i.e. SPU), I simply did a snapshot from vlc of a frame from the letterboxed video, and finalised it with Photoshop Elements as solid black over all the letterbox areas, and a colour over the video's area designated in the SPUstream as transparent.

    Each SPU element got an exact copy of the start and end times that had gone to the "ass" filter in ffmpeg. The timings should have been identical.
    (NOTE: long ago I discovered that by setting -accurate_seek in ffmpeg, and always supplying the times down to the millisecond, I could get reliably frame accurate timing. So that's what I expected to happen here)

  • it worked -- but only for SOME of the subtitles! With lots of others I got brief flashes of subtitle text from where the covering mask was shown a few frames too briefly, or sometimes a few frames too late.

  • So I had to accept that spumux and the ass filter seem to interpret the fine details of the timings differently.


    I wound up adding a notation into the .ass file for each subtitle (it has unused fields, at least by the ass filter, so I borrowed one) to specify an amount of padding to add to the start or end or both of the subtitle's time when the .xml file for spumux was generated.

  • It occurred to me I could have made life much simpler by just generating one single whole long covering slide for the entire DVD subtitle stream -- BUT it turns out that VLC only responds to the subtitles on-off switch BETWEEN the subtitles. And if VLC has that limitation, I had to assume other players do too.

  • this system of timing paddings works, BUT: it takes SO much time to re-review the video after each correction to make sure that subtitles off (= subtitles covered) actually never does show some bizarre and annoying flash of text at any point.

The Problem:

What I'd really like to have, so as to stop wasting hours of my time at each pass:

- ffmpeg has a black detection filter that will report on each frame it finds that varies from black by more than a given amount.

- vlc will take snapshots of individual frames comprising both the video AND the subtitle streams: this I've just recently tested.

What I need is to make vlc make not individual snapshots but an entire copy of the video with the subtitle stream merged into
the video stream just as in the snapshots. Then I can turn ffmpeg's black detection filter loose on the letterbox portion,
cropped from the whole video (either by ffmpeg or vlc).

Then at last I could get an automated report on whether and where there were any remaining non-black flashes.

Does anybody know of a way to get either vlc or ffmpeg to do such merging between video and subtitle streams? I've tried
looking it up in a variety of ways, and always wind up with lots of reasonable references which are nevertheless irrelevant
to me.

Many thanks for any help!