Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support injection of custom stream readers into TsExtractor (e.g. to handle DVB subtitles) #726

Closed
tresvecesseis opened this issue Aug 19, 2015 · 13 comments
Assignees

Comments

@tresvecesseis
Copy link
Contributor

are you interested in DVB subtitle (or any other kind graphic subtitle) support in Exoplayer, I made a pull request #705 and I don´t know if you don´t have time to check the patch or there are other problems with it

@ojw28
Copy link
Contributor

ojw28 commented Aug 20, 2015

We're thinking about it; it's not high up the list of things we want to land though. My gut feeling is that we wont want to support this directly. It's not something we want to be encouraging v.s. having services send text format subtitles, and it seems to exist largely for legacy reasons. It also looks like quite a lot of code that we'd have to maintain.

If we don't take it, we should at least provide a way for clients to inject their own support without having to modify the library. This probably means the ability to inject custom stream readers into a TsExtractor instance.

@tresvecesseis
Copy link
Contributor Author

i don´t agree to call "legacy" to one the most used subtitle format in the world, dvb-t is the main TV service in most of the world (all Europe and Australia, almost all Africa and Asia, part of South America and Greenland), so you are excluding the posibility to use the exoplayer library to create TV/DVD/BR players, in any case we will maintain our fork of the exoplayer library until you provide the means to extract the TS data to be able to integrate the funtionality in our player

@ojw28
Copy link
Contributor

ojw28 commented Aug 21, 2015

I mean legacy for streaming. Doesn't your suggested use case require custom hardware and platform modifications? I don't think Android has any APIs for receiving terrestrial broadcasts, although please correct me if I'm wrong.

@tresvecesseis
Copy link
Contributor Author

In the OTT case that´s true but we manage a private multicast VDN (with several million of customers) that is based in DVB-IPI (so no special hardware needed), I could understand that is not a typical scenario and that is why we propose to generalize the graphics subtitle renderer to give support to DVB/BR subtitles given that the DVD/BR streaming from a home video server is way more popular.

For the hardware and API support, all the Android TVs have the required hardware but the APIs for accesing the hardware doesn´t seem to be available currently for the creation of new tuners (they are system/vendor private), and the other Android 4.x chinese boxes available use standard linux v4l2 drivers/APIs, but, as you said, there is not an Android APi to control the DVB tuners and it depends in proper implementation by the player.

Having said that, it could be enough if we had a way to enumerate the tracks/PIDs and extract them to be processed by the player, something like passing a callback to the exoplayer library to be called when new data/PES is available for a given track/PID. Could that be a workable solution?

@ojw28
Copy link
Contributor

ojw28 commented Aug 21, 2015

In the OTT case I'd expect most providers to be converting subtitles into a more suitable format for OTT delivery. The one case where this doesn't really hold is if you're not the original broadcaster and only have access to the DVT subtitles, in which case I guess you'd need to OCR them, which would be messy. This seems like a relatively niche case though.

I don't know if the Android TV people have plans to expose any new APIs, but I would guess that they wouldn't expose the raw feed in a way that would make ExoPlayer supporting DVB subtitles useful. It feels like a much higher level API would make sense, with the DVB support remaining in the platform.

Agreed that there should be a way to inject custom handlers into TsExtractor. Let's use this bug to track that request.

@ojw28 ojw28 changed the title DVB subtitle support Support injection of custom stream readers into TsExtractor (e.g. to handle DVB subtitles) Aug 21, 2015
@tresvecesseis
Copy link
Contributor Author

tresvecesseis commented Aug 30, 2016

@ojw28 I've sent another pull request #1781 for the v2 branch, to support DVB subtitles, it´s much less invasive that the old one (only minimal adjustments in two files of the core library) and I think it's a valuable addition for the European/Asian IPTV developers.

@AquilesCanta AquilesCanta self-assigned this Sep 15, 2016
@AquilesCanta
Copy link
Contributor

In the next push a fix for this will be provided. The API is a bit awkward, yet, due to HLS compatibility requisites, but we are working on it.

ojw28 pushed a commit that referenced this issue Sep 28, 2016
ojw28 pushed a commit that referenced this issue Oct 24, 2016
In this CL:

* PesReader moves out of TsExtractor and becomes public.
* ElementaryStreamReaderFactory becomes TsPayloadReaderFactory and is
    moved to TsPayloadReader.
* The TsPayloadReaderFactory is in charge of wrapping any
    ElementaryStreamReaders with a PesReader.

Incoming:
* Extract SectionReader supperclass (analog to PesReader, but for
    sections) from Pat and Pmt readers.
* Add a ScteReader, wrapped by a section reader, and include it in
    the DefaultTsPayloadReaderFactory.

Issue:#726

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136707706
ojw28 pushed a commit that referenced this issue Oct 24, 2016
SectionPayloadReaders are provided to a SectionReader to
get whole sections(crc checked). This allows the injection
of custom section readers. E.G: SCTE35 messages.

Issue:#726

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136816612
ojw28 pushed a commit that referenced this issue Oct 27, 2016
This allows the user to create section readers(usually) for reserved pids,
like SDT, EIT, CAT, etc.

Issue:#726

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137150853
ojw28 pushed a commit that referenced this issue Oct 27, 2016
Unlike with PesReaders, sections don't have a standard way
of providing timestmaps or even generating tracks. We need
to pass this information so that readers decide what to do
with it.

Issue:#726

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137162494
@AquilesCanta
Copy link
Contributor

Guys, let me know if you find any inconveniences with the API for reader injection. It should be possible to inject any kind of readers now. Thanks for being patient about it.

@tresvecesseis
Copy link
Contributor Author

thanks, I supposse that this is the API we should use to implement additional subtitle formats, isnt't it?

@AquilesCanta
Copy link
Contributor

Well, this is the API you should use to implement additional subtitle format extraction from TS. That is, through this API you can provide the readers to the TsExtractor. They will obtain a trackOutput from the extractor output, and that will eventually be passed to the decoders. TsExtractorTest may serve as example.

Depending on the format, you will also have to create a SubtitleDecoder, if no decoder exists (if it exists, you need to pass whatever it needs).

You can have a look at the CeaxxxDecoder's, or the Mp4WebvttDecoder for an example.

@kiall
Copy link
Contributor

kiall commented Dec 28, 2016

@tresvecesseis did you ever manage to implement support out-of-tree for DVBSUB and other bitmap subtitles? If so, I'm very interested for use in in https://github.com/kiall/android-tvheadend.

@ojw28 is the exoplayer projects stance still that bitmap based subtitles won't be supported? This rules out a whole category of Android TV apps, where Satellite and Terrestrial content is grabbed and pushed over IP to a Android TV device. For better or worse, bitmap subtitles are pretty much standard for OTA broadcasts (At least in the EU), and aren't going anywhere anytime soon. And worse, transcoding bitmap subtitles to text isn't something many people do, given the need to OCR them :(

@ojw28
Copy link
Contributor

ojw28 commented Dec 28, 2016

@kiall - #179 is the right place to discuss bitmap based subtitles.

@tresvecesseis
Copy link
Contributor Author

@kiall we are pretty busy doing new stuff on our heavily modified ExoPlayer so no time for this porting, but it should be very simple with the support provided by @AquilesCanta to add custom stream readers, you only have to move some classes around (move the DVB subs classes to your player) and provide a Custom TsPayloadReader, you will also need to port 530977d to be able to see the subs.

@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants