[BUG]Can't extract multi-track subtitles from .mp4 #349

Closed
opened 2026-01-29 16:41:38 +00:00 by claunia · 6 comments
Owner

Originally created by @Pennyliu999 on GitHub (Nov 23, 2017).

CCExtractor version (using the --version parameter preferably) : 0.85

In raising this issue, I confirm the following (please check boxes, eg [X]):

  • [ X] I have read and understood the contributors guide.
  • [X ] I have checked that the bug-fix I am reporting can be replicated, or that the feature I am suggesting isn't already present.
  • [X ] I have checked that the issue I'm posting isn't already reported.
  • [X ] I have checked that the issue I'm porting isn't already solved and no duplicates exist in closed issues and in opened issues
  • [X ] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
  • [X ] I have used the latest available version of CCExtractor to verify this issue exists.

My familiarity with the project is as follows (check one, eg [X]):

  • I have never used CCExtractor.
  • [X ] I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

Necessary information

  • Is this a regression (did it work before)? [X ] NO | [ ] YES - please specify the last known working version
  • What platform did you use? [X ] Windows - [ ] Linux - [ ] Mac
  • What where the used arguments? -autoprogram

Video links

https://s3-ap-southeast-1.amazonaws.com/tortoise/test.mp4

Originally created by @Pennyliu999 on GitHub (Nov 23, 2017). CCExtractor version (using the --version parameter preferably) : **0.85** **In raising this issue, I confirm the following (please check boxes, eg [X]):** - [ X] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [X ] I have checked that the bug-fix I am reporting can be replicated, or that the feature I am suggesting isn't already present. - [X ] I have checked that the issue I'm posting isn't already reported. - [X ] I have checked that the issue I'm porting isn't already solved and no duplicates exist in [closed issues](https://github.com/CCExtractor/ccextractor/issues?q=is%3Aissue+is%3Aclosed) and in [opened issues](https://github.com/CCExtractor/ccextractor/issues) - [X ] I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion. - [X ] I have used the latest available version of CCExtractor to verify this issue exists. **My familiarity with the project is as follows (check one, eg [X]):** - [ ] I have never used CCExtractor. - [X ] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [ ] I am an active contributor to CCExtractor. **Necessary information** - Is this a regression (did it work before)? [X ] NO | [ ] YES - *please specify the last known working version* - What platform did you use? [X ] Windows - [ ] Linux - [ ] Mac - What where the used arguments? `-autoprogram` **Video links** https://s3-ap-southeast-1.amazonaws.com/tortoise/test.mp4
Author
Owner

@saurabhshri commented on GitHub (Jan 5, 2018):

Hi @Pennyliu999 ! Thanks for reporting and providing the sample.

At present, apart from AVC tracks, we're only handling clcp handler code which is an Apple standard for "Closed Caption Track". The current code completely ignores subt ( Subtitle track handler defined by ISO ), sbtl (QuickTime Subtitle track handler defined by Apple) and text (Text handler code defined by 3GPP). This is most likely the result of unavailability of samples while working on MP4 support.

The sample you provided has subtitle tracks as per QuickTime Subtitle track standards.

Track 3, type=sbtl subtype=tx3g
Track 4, type=sbtl subtype=tx3g

Since it's ignored, CCExtractor reports :

MP4: found 4 tracks: 1 avc and 0 cc
Found 1 AVC track(s). Found no dedicated CC track(s).

The version of GPAC used by CCExtractor is outdated and only supports clcp. It's possible to bring the support of other handlers as well without updating GPAC - but that solution will really be very "hacky" and I don't think we should go that way.

The latest GPAC has proper support for all the handlers, but upgrading to latest GPAC is not going to be direct. Currently in CCExtractor, we're using GF_ISOM_MEDIA_CAPTIONS as media type which has been completely removed in the current GPAC version. We now have media types for each handler ( @cfsmp3 this is probably why you were getting invalid MP4 error).

GF_ISOM_REF_SUBT = GF_4CC( 's', 'u', 'b', 't' ),
---
GF_ISOM_MEDIA_SUBT = GF_4CC('s', 'b', 't', 'l'),
GF_ISOM_MEDIA_SUBPIC = GF_4CC('s', 'u', 'b', 'p'),
GF_ISOM_MEDIA_MPEG_SUBT = GF_4CC('s', 'u', 'b', 't'),

I think the best solution will be to update to latest GPAC and re-write our MP4 stuff. This will cover all areas and make things easier. Maybe we can do this after the 0.86 release or maybe we can start the work already in a different branch.

This will also form a nice task for Code-In students and upcoming GSoC students.

Relevant links :

@saurabhshri commented on GitHub (Jan 5, 2018): Hi @Pennyliu999 ! Thanks for reporting and providing the sample. At present, apart from AVC tracks, we're only handling `clcp` handler code which is an Apple standard for "Closed Caption Track". The current code completely ignores `subt` ( **Subtitle track handler defined by ISO** ), `sbtl` (QuickTime Subtitle track handler defined by Apple) and `text` (Text handler code defined by 3GPP). This is most likely the result of unavailability of samples while working on MP4 support. The sample you provided has subtitle tracks as per QuickTime Subtitle track standards. ``` Track 3, type=sbtl subtype=tx3g Track 4, type=sbtl subtype=tx3g ``` Since it's ignored, CCExtractor reports : ``` MP4: found 4 tracks: 1 avc and 0 cc Found 1 AVC track(s). Found no dedicated CC track(s). ``` The version of GPAC used by CCExtractor is outdated and *only supports clcp*. It's possible to bring the support of other handlers as well without updating GPAC - but that solution will really be very "hacky" and I don't think we should go that way. The latest GPAC has proper support for all the handlers, but upgrading to latest GPAC is not going to be direct. Currently in CCExtractor, we're using `GF_ISOM_MEDIA_CAPTIONS` as media type which has been completely removed in the current GPAC version. We now have media types for each handler ( @cfsmp3 this is probably why you were getting invalid MP4 error). ``` GF_ISOM_REF_SUBT = GF_4CC( 's', 'u', 'b', 't' ), --- GF_ISOM_MEDIA_SUBT = GF_4CC('s', 'b', 't', 'l'), GF_ISOM_MEDIA_SUBPIC = GF_4CC('s', 'u', 'b', 'p'), GF_ISOM_MEDIA_MPEG_SUBT = GF_4CC('s', 'u', 'b', 't'), ``` I think the best solution will be to update to latest GPAC and re-write our MP4 stuff. This will cover all areas and make things easier. Maybe we can do this after the 0.86 release or maybe we can start the work already in a different branch. This will also form a nice task for Code-In students and upcoming GSoC students. Relevant links : - MP4 handler codes : http://www.mp4ra.org/handler.html - Our code where we check media type : https://github.com/CCExtractor/ccextractor/blob/master/src/gpacmp4/mp4.c#L421 - Current GPAC handler codes : https://github.com/gpac/gpac/blob/master/include/gpac/isomedia.h#L220 - This commit in GPAC might be useful : https://github.com/gpac/gpac/commit/596d3220a3e33063030ddd8742f3c148464afa6c#diff-ff30135695fca05b5b003585b27c8277
Author
Owner

@saurabhshri commented on GitHub (Jan 5, 2018):

Also @Pennyliu999 , if you've more such (and different MP4) samples, we'd be very happy if you could share them! :) They will really help.

@saurabhshri commented on GitHub (Jan 5, 2018): Also @Pennyliu999 , if you've more such (and different MP4) samples, we'd be very happy if you could share them! :) They will really help.
Author
Owner

@cfsmp3 commented on GitHub (Jan 5, 2018):

@saurabhshri but I'm getting the errors processing the same file that used to work, and it's a GPAC error, not a CCExtractor error...

@cfsmp3 commented on GitHub (Jan 5, 2018): @saurabhshri but I'm getting the errors processing the same file that used to work, and it's a GPAC error, not a CCExtractor error...
Author
Owner

@Pennyliu999 commented on GitHub (Jan 6, 2018):

@saurabhshri Thanks for looking into this issue, I will upload more .mp4 files with different content and subtitles. Just for your information, if you can run Mac OSX (even in a virtual machine like vmware), you will be able to use a free app named "subler" to add mulit-track subtitles to .mp4 files just like Apple do (or like I do)

@Pennyliu999 commented on GitHub (Jan 6, 2018): @saurabhshri Thanks for looking into this issue, I will upload more .mp4 files with different content and subtitles. Just for your information, if you can run Mac OSX (even in a virtual machine like vmware), you will be able to use a free app named "subler" to add mulit-track subtitles to .mp4 files just like Apple do (or like I do)
Author
Owner

@Hori75 commented on GitHub (Jan 9, 2018):

I see that the commit is in 0.7.1 version. Will try to update gpac to 0.7.1 instead of 0.7.0-release version.

@Hori75 commented on GitHub (Jan 9, 2018): I see that the commit is in 0.7.1 version. Will try to update gpac to 0.7.1 instead of 0.7.0-release version.
Author
Owner

@saurabhshri commented on GitHub (Jan 9, 2018):

@Pennyliu999 Thanks a lot, much appreciated! :) We'll add them to our regression platform. cc: @canihavesomecoffee .

@saurabhshri commented on GitHub (Jan 9, 2018): @Pennyliu999 Thanks a lot, much appreciated! :) We'll add them to our regression platform. cc: @canihavesomecoffee .
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#349