Skip to content

Feature request : DVB-T subtitles support #982

Closed

Description

@bouscram

(This is something which has been requested in the past but never implemented, so I give it another try...)

DVB-T streams generally include subtitles (in bitmap and sometimes text format). It would be a really nice addition to HandBrake if it was capable of using them.
I am mostly interested is the possibility to add the bitmap subtitles, similarly to DVD subtitles, as they are the only ones to be widely used (at least in France).

Activity

  1. jstebbins commented on Nov 7, 2017

    @jstebbins
    Contributor

    There are several subtitle enhancements that will be easier to implement on top of ffmpeg since ffmpeg has much broader subtitle support than libav. So we should revisit this after the PR to switch to ffmpeg is accepted. See #981

    The change to ffmpeg won't happen right away. It's going to require extensive testing. And we want to push a 1.1 release out the door first.

  2. bouscram commented on Nov 8, 2017

    @bouscram
    Author

    Thanks for the comment (and perspective given)

  3. bouscram commented on Jun 9, 2018

    @bouscram
    Author

    Hi again. I have been doing some tests with macXvideo (which is mainly a GUI launching ffmpeg with the appropriate options), and DVB subtitles are perfectly handled.
    The filter chain generated by the interface is rather simple (even for a newbie like me):
    [0:0]null[VA];[0:5]scale=1920:1080[sub1];[VA][sub1]overlay=main_w/2-overlay_w/2:main_h-overlay_h[VIDEO]
    I guess adding the option in HB should be quite simple now that switch ffmpeg has been done in the codebase (and the nightlies)

  4. sr55 commented on Jun 9, 2018

    @sr55
    Contributor

    Have you tried it to see if it works? In theory, if ffmpeg supports it, HandBrake does.

    If not, can you provide a log?

  5. bouscram commented on Jun 9, 2018

    @bouscram
    Author

    How can I try? Using the additional options in the video tab? With the CLI version?

  6. sr55 commented on Jun 9, 2018

    @sr55
    Contributor

    If they are supported, the subtitle track will appear in the GUI like any other subtle track. Select it for output and you should be good.

  7. bouscram commented on Jun 9, 2018

    @bouscram
    Author

    No, they don't appear in the GUI (if I look at the activity log, I see the subtitle tracks are seen as "other":
    [20:24:22] Found the following PIDS
    [20:24:22] Video PIDS :
    [20:24:22] 0x140 type H.264 (0x1b) (PCR)
    [20:24:22] Audio PIDS :
    [20:24:22] 0x14a type E-AC3 (0x87)
    [20:24:22] 0x14b type E-AC3 (0x87)
    [20:24:22] 0x14c type E-AC3 (0x87)
    [20:24:22] 0x14d type E-AC3 (0x87)
    [20:24:22] Subtitle PIDS :
    [20:24:22] Other PIDS :
    [20:24:22] 0x154 type DVB Subtitling (0x0)
    [20:24:22] 0x155 type DVB Subtitling (0x0)
    [20:24:22] 0x156 type DVB Subtitling (0x0)
    [20:24:22] 0x172 type ISO 13818-1 private section (0x5)
    [20:24:22] 0x173 type ISO 13818-6 DSM-CC U-N msgs (0xb)

    I am using Handbrake Version: 20180605211348-2a2d334-master (2018060601)

  8. sr55 commented on Jun 9, 2018

    @sr55
    Contributor

    Can you upload a sample file to take a look at please?

  9. bouscram commented on Jun 9, 2018

    @bouscram
    Author

    Here it is (from an EyeTV capture, which is almost my only source)
    0000000020cbf2f0.mpg.zip

  10. jstebbins commented on Jun 9, 2018

    @jstebbins
    Contributor

    Subtitles are not automatically supported just because "ffmpeg supports them". HandBrake doen't (yet) have an "autopassthru" option for subtitles.

    It's kind of a difficult thing to do properly. With audio, when passthru is not possible, we can convert to a universal intermediate format (raw PCM samples) and re-encode to a format compatible with the container. We can't do the same with subtitles. There is no "universal intermediate format" and the subtitle formats supported by MP4 are very limited in their supported capabilities.

    So "better" support for more subtitle formats is definitely possible with ffmpeg, but it requires writing code to support it on a case by case basis.

  11. bouscram commented on Jun 9, 2018

    @bouscram
    Author

    In fact, regarding DVB subtitles, I would be more than happy to be able just to burn them in (and in this case there is no problem problem with the container format). Otherwise you are totally right, the problem is rather complicated.
    My current work stream includes finding suitable subtitles on the Internet and sync them (which is sometimes tricky), or if I can't find any using ProjectX to extract them, going through BDSup2Sub with the extracted track, then converting the result to text with Subler, then correcting the OCR mistakes and finally synchronising them... Lots of pain, and as both ProjectX and BDSup2Sub are unmaintained Java, each update is a risk to lose the ability to do it.

  12. zimonth commented on Jun 9, 2018

    @zimonth

    What I've done with some of the files with DVB-subtitles, is to convert them from DVB-subtitles to DVD-subtitles. After that HandBrake can be used to transcode the video file and include (passthrough) the DVD-subtitle:
    See:
    https://forum.videohelp.com/threads/382169-Hardcopy-DVB-subtitles-to-MKV

    It's relative easy to do in ffmpeg:
    1 You start in ffmpeg with the command: ffmpeg -i your imputfile press enter
    ffmpeg wil report back the streams in the inputfile like videostream audio stream en subtite stream (dvdsub)
    write that down or remeber.
    Your next ffmpeg coomand is: ffmpeg -i your inputfile -map 0:0 (video stream) map 0:1 audio stream -map 0:2 (subtitle stream) -vcodec copy -acodec copy -scodec dvdsub your outpufile.mkv.
    Don't type in videstream or audiostream, just -map 0:0 and so on for the number of streams you want to remux.
    Let it run and after that you can use handbrake with your out.mkv.

  13. bouscram commented on Jun 10, 2018

    @bouscram
    Author

    I had also the idea that DVD subs could be some kind of universal format, as they are supported in both mp4 and mkv containers. Maybe this is what should be implemented in Handbrake. I will do some tests manually to see what it looks like.

  14. 7 remaining items

  15. bouscram commented on Jun 25, 2018

    @bouscram
    Author

    @Zexaron : ffmpeg can convert DVB subtitles to DVD flawlessly.
    What I finally did is:

    1. Use ffmpeg to convert the DVB stream to mp4 with DVD subtitles (see the command in my comment above)
    2. use Handbrake to do scaling/cropping etc.
    3. use Subler to convert the DVD subs to text. The result are very good and on the files I used.
      You could do just the same with mkv.
  16. added this to the Unscheduled milestone on Sep 4, 2018
  17. bouscram commented on Mar 17, 2019

    @bouscram
    Author

    @bradleysepos : has anybody expressed interest in implementing this? (my coding days are really too old for me to be of any practical help... ;-) )

  18. bradleysepos commented on Mar 17, 2019

    @bradleysepos
    Contributor

    Nope.

  19. cehoyos commented on Mar 18, 2019

    @cehoyos

    From a HB pov what are the differences between burning in DVD subtitles and burning it DVB subtitles?

  20. jstebbins commented on Mar 18, 2019

    @jstebbins
    Contributor

    HandBrake doesn't use ffmpeg much for subtitles currently. For example, we have our own DVD, CC, SRT, SSA, and tx3g subtitle decoders. HandBrake converts all text subtitles into SSA internally and all bitmap subtitles into our own internal bitmap format. We partially use ffmpeg for PGS subs, but it's not a simple passthrough. We have to add a pretty good size chunk of code in order to properly extract and pass through only forced subtitles. For forced subs we must detect the end time of the forced sub then create and insert an "empty" PGS subtitle packet to signal the end of the sub. PGS is currently the only place we make any use of ffmpeg for subtitles.

    From what I understand DVB supports both bitmap and text subtitles. Ultimately we would have to convert the bitmap subs to our internal bitmap format and the text subs into SSA. Using ffmpeg to extract the bitmap subs and then convert to our bitmap format would be pretty straight forward. I honestly don't know what would be involved in using ffmpeg to extract and convert the text to SSA. I don't know how much of the text formatting and style information ffmpeg preserves and how it makes that information available. I haven't researched that yet.

    My hope for DVB and several other subtitle formats is to create a more generalized ffmpeg based subtitle decoder in HandBrake that can do the required conversions. Or if ffmpeg's internal representation of text subs has all the formatting and style capabilities necessary, maybe just adopt that as our internal representation instead of converting to SSA.

    I would like to make greater use of ffmpeg for subtitle decoding, but there are too many things and not enough time.

  21. cehoyos commented on Mar 18, 2019

    @cehoyos

    DVB subtitles are always bitmap subtitles, they are similar to DVD subtitles (teletext subtitles also exist but are something completely different).
    I would be curious to understand what your issues with FFmpeg's subtitle support are.

  22. jstebbins commented on Mar 18, 2019

    @jstebbins
    Contributor

    DVB also supports character object encoding, but I hadn't actually read the spec yet. A quick read of the spec indicates that it is probably rarely used since it says, "The information inside the subtitling stream is not sufficient to make such a character coded system work reliably. A local agreement between broadcasters and equipment manufacturers may be an appropriate way to ensure reliable operation of character coded subtitles."

    See ETSI 300 743 section 5.4.6 Character object decoding

  23. jstebbins commented on Mar 18, 2019

    @jstebbins
    Contributor

    I would be curious to understand what your issues with FFmpeg's subtitle support are.

    Mostly unknown since we've not tried to make extensive use of ffmpeg for subtitles yet. So far, our only issue is detection and signalling of the end of PGS forced subtitles, which we have a good solution for.

    Please remember, HandBrake was not originally developed as a frontend to ffmpeg (or libav). The first version of HandBrake was written for BeOS. Early versions of HandBrake, after porting to OSX, used ffmpeg for mpeg4 encoding only. Everything else was done directly with other libs. HandBrake existed for several years before we even started making heavier use of ffmpeg for capabilities. There is still quite a lot of this legacy in the structure of HandBrake. We rarely have made the decision to not use ffmpeg for some technical reason. Our starting point was never, try ffmpeg and if that doesn't work, try something else. Our starting point was, we have this code that works, can it be done better with ffmpeg? The answer is often yes and as time permits we transition functionality over to using ffmpeg.

  24. cehoyos commented on Mar 18, 2019

    @cehoyos

    Thank you for the explanation!

    DVBSUB is a very common way of sending subtitles over DVB (it is even used in Germany where Teletext is very common), I don't think I have seen a Character object decoding sample yet.

  25. modified the milestones: Unscheduled , 1.4.0 on Mar 29, 2020
  26. jstebbins commented on Mar 29, 2020

    @jstebbins
    Contributor

    Bitmap DVB subtitles implemented via
    19c1ea5
    400e8d4

    Should be available in the nightly builds soon for anyone that would like to do some testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions