-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[Video][Subtitles] Use ffmpeg A53 sidedata instead of custom demuxer #22333
Conversation
83e106b
to
b7ad474
Compare
347329c
to
6f4ce73
Compare
@CastagnaIT thanks for the tips, hopefully done right on the last push |
@lrusak think I've managed to use a unique_ptr for the side data (added on a separate commit). Please take a look if you have a chance. |
Added a new commit to fix another issue, according to the standard duplicate dual codes must be discarded. Also in ccextractor: The checking code was already there but was only being applied to the control chars, not regular dual char codes. |
@enen92 is this for subtitles as shown in the title or closed captioning 608/708 (or both)? |
Closed captions (eia-608/708) which are also subtitles. If you have content and are able to give them a go it'd be great. |
Here in North America we generally use the term closed captioning for accessibility (it also has description of sounds, music playing notes etc) and subtitles for alternate languages which is why I wasn't sure. I will add this after Nexus final and try with Live TV we have 608/708. I have a client for Android too and Exoplayer does a better job then Kodi so I will use that for comparing. The Exoplayer code is here |
5d50035
to
9bcecf9
Compare
I am interested in samples or accessing addon streams (temporarily) which the closed captions cannot be displayed/demuxed in Kodi (I mean no subtitles at all not exactly errors displaying, colouring or positioning the subtitle entries). So far the only public samples that didn't work (also didn't work before) are those provided by the dash industry forum (e.g: https://livesim.dashif.org/dash/vod/testpic_2s/cea608.mpd) but unfortunately they are completely broken and can't be used as a reference for now, see: Dash-Industry-Forum/dash-live-source-simulator#99 (comment) Maybe we can give them a go later on if those major issues are fixed |
Added a few more commits and I consider this finished:
Also the DASH foundation has fixed their public streams. I don't want to add more stuff into this (nor any other fixes out of the scope of CC demuxing) to avoid exploding the diff. Plan to get this merged by the end of the month unless someone objects. Getting a green and some testing would still be great. Note CC decoding and general behaviour is (and should be) still pretty much the same. Any issues with colors, positions, some entries no showing are out of the scope of this PR. I've just changed the way we get the data. |
I've been trying this with live TV today and in general it seems like a definite improvement. Omega is getting less stable for general use though so I think my testing will be limited to your PR I can't use master at the moment.. You probably should look at this sample since the captioning just stops https://www.mediafire.com/file/gefs76f1ooppj3o/subtitles.ts/file but can be re-enabled on track 2. Once track 2 is saved it is ok. Other plays seem to autodetect this. Musical notes show as boxes too, don't know if that is in scope. It is also hard to compare it to other players with positional support especially when several people are talking but it still seems like an improvement. I don't need cc's but I am interested in it for the community. It is really nice not to have to configure Kodi to parse them. |
i have tested with my samples and all worked good job! However, I think a solution should be found for the removed CC setting for example: |
Thanks for the feedback. Yeap I am not a big fan of it either, they are always enabled by default and their definition is too generic. I have to take a look to into the standards to check if there's any way to flag some of the properties (language, type, etc) but I don't think so. Also not sure if inputsream add-ons can create those streams beforehand since they are usually flagged in the respective manifests...but then we also lack anyway to create multiple streams of the same type (e.g. 2 cea608 streams)... |
ffmpeg already sets the sidedata whenever it is detected and as a result there is no need to restrict this to MPEG or H264. Furthermore other codecs also support EIA608 (e.g. HEVC)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generically after the test it for me its fine,
but i cannot evaluate the changes on VP
@enen92 not having to enable parsing was one of the major benefits of this PR. I agree that they should not be forced on but couldn't there be a compromise be made to not display them by default like other subtitle types? In any case for closed captioning the language cannot be consider safe, here often the language identifier when it is used and not unknown is wrong. |
Yes, later... |
I think I'll merge this tonight if no one objects. I have a few changes I want to make to closed captions and its easier to work on top of this. Plus, it's quite early in v21 release cycle anyway. |
Description
While Kodi's closed caption decoder (although outdated when compared to upstream) is still far superior than that decoder contained within ffmpeg, the same can't be said about our custom demuxer implementation. There are a lot of reports/samples out there that simply cannot be played in Kodi but work just fine in mpv or ffplay. While investigating #22143 I realised the root cause of the problem was the fact our demuxed was extended from an initial support of
AV_CODEC_ID_MPEG2VIDEO
toAV_CODEC_ID_H264
reusing some assumptions that only make sense in the former codec case (e.g. the start code). This code is complex and not maintained, ffmpeg seem to always fill the A53 side data with the closed caption data block, so we might want to use that instead in our demuxer (taking advantage of the already existing decoding code).User feedback is appreciated...
@matthuisman would be great to know if this finally fixes the CC captions not available in some of your addons.
@ksooo it'd be nice if you could have a look into the code if you find some time. Looking for a pure code review (stuff to improve), I am not expecting you to be familiar with the inner-workings of the thing.
Motivation and context
Improve subtitles and simplify our codebase at the same time. Get an alternative to the #22143 revert
How has this been tested?
Runtime tested with all my CC samples, some that did work and others that didn't work. Those that used to not have captions detected now show the subtitle stream.
What is the effect on users?
Hopefully better support for CC captions in Omega
Screenshots (if appropriate):
Before:
PR:
Types of change