Skip to content

feat(mp4): add dvdsub/VobSub support to FFmpeg MP4 demuxer#2269

Merged
cfsmp3 merged 2 commits intomasterfrom
feat/ffmpeg-vobsub-support
Apr 20, 2026
Merged

feat(mp4): add dvdsub/VobSub support to FFmpeg MP4 demuxer#2269
cfsmp3 merged 2 commits intomasterfrom
feat/ffmpeg-vobsub-support

Conversation

@cfsmp3
Copy link
Copy Markdown
Contributor

@cfsmp3 cfsmp3 commented Apr 19, 2026

Summary

  • Wire existing vobsub_decoder (OCR bitmap subtitle decoder) into the FFmpeg MP4 demuxer path
  • Adds support for dvdsub tracks in MP4 containers, which were previously unsupported in the FFmpeg path

Changes

  • mp4.rs: Add DvdSub track type, detect AV_CODEC_ID_DVD_SUBTITLE, buffer packets for end-time calculation
  • mp4_rust_bridge.c: 3 new functions wrapping vobsub_decoder API (init, process, free)
  • mp4_rust_bridge.h: Declarations
  • CMakeLists.txt: 3 --undefined linker flags for bridge symbols

Test plan

Tested on 1f3e951d516b.mp4 (dvdsub in MP4):

  • GPAC: 5405 bytes
  • FFmpeg + this patch: 5405 bytes, byte-identical

With this change, the FFmpeg path is a strict superset of GPAC across all 36 MP4/MOV/M4V samples tested:

  • 12 samples: byte-identical to GPAC
  • 1 sample: FFmpeg extracts 51KB that GPAC cannot (ad9f9e03240e.m4v)
  • 1 sample: timing-only diff (~2ms, FFmpeg upstream av_rescale_q rounding)
  • 22 samples: no captions in either

cfsmp3 and others added 2 commits April 19, 2026 11:11
Wire the existing vobsub_decoder (OCR-based bitmap subtitle decoder)
into the FFmpeg MP4 demuxer path. Previously, dvdsub tracks in MP4
containers were documented as unsupported — GPAC could extract them
but the FFmpeg path could not.

Changes:
- Add DvdSub track type detection (AV_CODEC_ID_DVD_SUBTITLE) in mp4.rs
- Add C bridge functions (ccx_mp4_vobsub_init/process/free) that call
  the existing vobsub_decoder module
- Buffer dvdsub packets to compute end times from next-packet PTS
- Add --undefined linker flags for bridge symbols

Tested on sample 1f3e951d516b.mp4 (dvdsub in MP4):
- GPAC: 5405 bytes output
- FFmpeg + this patch: 5405 bytes, byte-identical to GPAC

With this change, the FFmpeg path extracts captions from every sample
that GPAC can, plus one additional sample (ad9f9e03240e.m4v) that
GPAC cannot handle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ccextractor-bot
Copy link
Copy Markdown
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit e4443a7...:
Report Name Tests Passed
Broken 9/13
CEA-708 1/14
DVB 2/7
DVD 3/3
DVR-MS 2/2
General 22/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 76/86
Teletext 20/21
WTV 13/13
XDS 31/34

Your PR breaks these cases:

NOTE: The following tests have been failing on the master branch as well as the PR:


It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

@ccextractor-bot
Copy link
Copy Markdown
Collaborator

CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit e4443a7...:
Report Name Tests Passed
Broken 9/13
CEA-708 1/14
DVB 3/7
DVD 3/3
DVR-MS 2/2
General 22/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 81/86
Teletext 20/21
WTV 13/13
XDS 31/34

NOTE: The following tests have been failing on the master branch as well as the PR:


This PR does not introduce any new test failures. However, some tests are failing on both master and this PR (see above).

Check the result page for more info.

@cfsmp3 cfsmp3 merged commit 283bfd9 into master Apr 20, 2026
48 of 49 checks passed
@cfsmp3 cfsmp3 deleted the feat/ffmpeg-vobsub-support branch April 20, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants