cine-encoder icon indicating copy to clipboard operation
cine-encoder copied to clipboard

Picture subtitles and more

Open philstopford opened this issue 1 year ago • 1 comments

This PR builds on the previous ones. The aim of this PR is to add preliminary support for image-based subtitles. This required a surprising amount of changes:

  • The '-vf' argument has to be dropped when burning image subtitles. They need a complex filter and this is not compatible with other filters. The video stream mapping also had to be adjusted in this mode.
  • I had to move the subtitle video filter handling into a QStringList so that arguments could be handled properly.
  • Made the 'isSupported' call approach more 'intelligent' by considering the container as well as the stream type. This allows us to detect whether hard-burn is the only option, rather than declaring 'Unsupported'. We can then avoid offering to copy the stream to an incompatible container. This is not an exhaustive list of compatible streams vs formats, but can be now trivially extended as needed. I separated audio and subtitle checks to make this cleaner.
  • Changing the preset needs to cause a refresh of the UI in case the target container is now (in)compatible with the titles in the source. That is done by remembering the current selection, clearing the selection and re-selecting. That causes the re-evaluation. There might be a neater way, but this works.

The main headache was figuring out the logic for the default, checkbox and hard-burn controls. Checkbox is for stream inclusion and thus is irrelevant when hard-burning (only the hard burn stream can survive). The hard-burn can only happen if the stream is the default. Therefore, in this update, if a stream is hard-burn only, the checkbox is cleared and disabled. The only option for the user is to hard-burn, and the hard-burn is triggered by making the relevant stream the default. This change does not affect the workflow otherwise - streams supported for either hard-burn or copy have the same workflow as before (default, with checkbox, or hard-burn, with default). I tested this a fair bit and would welcome feedback,

Some other enhancements come along for the ride:

  • The MOV_TEXT type was causing trouble for vobsub subtitle streams. dvd_subtitle seems to work for both srt and vobsub in my test files.
  • I added code to allow the list of titles to be deselected en-masse. Some of my test files had many audio or subtitle streams and it was tedious to manually deselect them all. The deselection clears all flags (default, check) for all streams.
  • The hard-burn, particularly when combined with HDR footage, can lead to longer job times. I noticed that this could often cause the ETA to end up reporting 00:00:00 when the job was far from done. I've adjusted the reporting logic as part of the PR, but there still seems to be quite some variance from one update to another.

philstopford avatar Oct 26 '23 22:10 philstopford

One comment here is that this approach does not attempt to force the picture subtitles to fit the frame. That is to say, if your source frame is larger or smaller than the picture subtitle frame, they will get chopped off or misplaced. This is also true for resizing of the video on-export, I expect (although have not yet tested this particular behavior - it's on a list of potential wrinkles).

I suspect that there are ways to tweak the set-up, but it needs some investigations. In particular, how to find out the picture subtitle size, how to figure out the output target size, etc. It's not an area I've invested much time into yet.

philstopford avatar Nov 13 '23 03:11 philstopford