You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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).
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.
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)
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)
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.
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.
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.
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.
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.
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.
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
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.
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.
Activity
jstebbins commentedon Nov 7, 2017
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.
bouscram commentedon Nov 8, 2017
Thanks for the comment (and perspective given)
bouscram commentedon Jun 9, 2018
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)
sr55 commentedon Jun 9, 2018
Have you tried it to see if it works? In theory, if ffmpeg supports it, HandBrake does.
If not, can you provide a log?
bouscram commentedon Jun 9, 2018
How can I try? Using the additional options in the video tab? With the CLI version?
sr55 commentedon Jun 9, 2018
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.
bouscram commentedon Jun 9, 2018
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)
sr55 commentedon Jun 9, 2018
Can you upload a sample file to take a look at please?
bouscram commentedon Jun 9, 2018
Here it is (from an EyeTV capture, which is almost my only source)
0000000020cbf2f0.mpg.zip
jstebbins commentedon Jun 9, 2018
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.
bouscram commentedon Jun 9, 2018
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.
zimonth commentedon Jun 9, 2018
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
bouscram commentedon Jun 10, 2018
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.
7 remaining items
bouscram commentedon Jun 25, 2018
@Zexaron : ffmpeg can convert DVB subtitles to DVD flawlessly.
What I finally did is:
You could do just the same with mkv.
bouscram commentedon Mar 17, 2019
@bradleysepos : has anybody expressed interest in implementing this? (my coding days are really too old for me to be of any practical help... ;-) )
bradleysepos commentedon Mar 17, 2019
Nope.
cehoyos commentedon Mar 18, 2019
From a HB pov what are the differences between burning in DVD subtitles and burning it DVB subtitles?
jstebbins commentedon Mar 18, 2019
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.
cehoyos commentedon Mar 18, 2019
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.
jstebbins commentedon Mar 18, 2019
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
jstebbins commentedon Mar 18, 2019
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.
cehoyos commentedon Mar 18, 2019
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.
jstebbins commentedon Mar 29, 2020
Bitmap DVB subtitles implemented via
19c1ea5
400e8d4
Should be available in the nightly builds soon for anyone that would like to do some testing