43 Commits
Author SHA1 Message Date
Scott GarrettandClaude Code 57772086a5 Convert Matroska PGS tracks to VobSub and name flagged tracks SDH
A PGS track inside an MKV can now be muxed as a real subp track: the
muxer's bitmap-converter branch recognizes a PGS source with a VobSub
target (new MP42ConversionSettings subtitlesVobSubConversion) and uses
the new MP42PgsToVobSubConverter instead of MP42BitmapSubConverter.

The converter rebuilds the PGS elementary stream from the source
container up-front, because mkvmerge stores each PGS segment with its
13-byte "PG" envelope removed (type + 2-byte length + payload,
zlib-compressed) — a plain concatenation of demuxed blocks is not a
.sup. Each block is walked segment-by-segment and the envelope is
restored as PG + 90 kHz pts (from the block's nanosecond timestamp) +
four zero bytes + type + length, byte-identical to what mkvextract
writes; blocks that already carry envelopes pass through verbatim. The
rebuilt temp .sup then rides the existing MP42VobSubImporter wholesale
for palette, DVD geometry, and raw-SPU samples, which replay through
copyEncodedSample while the live muxing stream is discarded.

Subtitle type recognition now names any flagged track "SDH" (hearing
impaired, commentary, forced, lyrics, closed captions) instead of a
per-type name, and MKV container tracks get the same treatment on the
conversion path: the TrackEntry Name runs through the recognizer, or
the MKV's own filename when there is no Name element. tagsOnly mode
stays verbatim — that model is the tag writer's diff baseline.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-28 20:00:08 -05:00
Scott GarrettandClaude Code 30dd96ff79 Recognize subtitle language and type tokens in filenames
getFilenameLanguage now tokenizes the name and scans right-to-left the way mkvmerge's own heuristics do, so a language code survives behind a trailing flag token ("...eng.hearing_impaired.srt" was read as "und"). Three-char tokens try ISO 639-2/T and the library's B codes; the dash stays out of the separator set so region subtags ("pt-BR") are not split into a bogus ISO 639-1 hit.

getFilenameSubtitlesTrackName maps community type tokens (sdh / hearing_impaired / deaf, cc / closed caption, forced, commentary, lyrics) to a bare conventional track name ("SDH"); the language rides its own element. MP4 has no SDH flag and the name-keyword pass in MP42File organizeMediaCharacteristicsForMediaType: turns these names into the real QuickTime tags (public.subtitles.forced-only, public.accessibility.*).

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-28 18:17:53 -05:00
Damiano Galassi a3c2aa6968 Add VVC enums. 2024-06-25 12:10:48 +02:00
Damiano Galassi 027cb1f6ae Update copyright year. 2022-01-02 09:31:49 +01:00
Damiano Galassi 45552f45c0 Make MP4GetTrackMediaDataName aware of multiple sample descriptions. Only the first one is ready at the moment. 2021-12-09 12:03:28 +01:00
Damiano Galassi e42154278f Add experimental av1 support. 2021-05-31 12:09:29 +02:00
Damiano Galassi 36493a9195 Improve subtitles language detection. 2021-02-23 10:58:51 +01:00
Damiano Galassi 799fdcc642 Update copyright year. 2021-02-02 10:55:04 +01:00
Damiano Galassi a190617dc4 Update major brand when saving a file. 2020-09-22 14:20:25 +02:00
Damiano Galassi b2394c7c3e Update copyright. 2020-09-22 11:38:15 +02:00
Damiano Galassi 0e421a6eef Enable and fixes more warnings. 2020-09-19 14:39:02 +02:00
Damiano Galassi 9a2c5858ce use kMP42AudioCodecType_MPEGLayer3 for MP4_MPEG1_AUDIO_TYPE audio type. 2020-01-28 11:50:27 +01:00
Damiano Galassi de38f09878 Update to FFmpeg 4 2018-05-02 15:06:28 +02:00
Damiano Galassi 99740b8ebc Do not set an arbitrary lang in getFilenameLanguage 2018-03-23 12:44:01 +01:00
Damiano Galassi af08a8d8f4 Improve Chinese languages code. 2018-02-11 15:34:10 +01:00
Damiano Galassi 3557220f53 Remove 10.9 support. 2018-02-03 10:43:45 +01:00
Damiano Galassi 4622fdc3a8 Partial support for reading pcm in mp4. 2017-11-07 17:51:32 +01:00
Damiano Galassi cfbf9bbf91 Refactor NSLinguisticTagger code. 2017-10-02 19:20:17 +02:00
Damiano Galassi a4b9d5bba9 Move esds code to format utilities. 2017-10-02 12:43:20 +02:00
Damiano Galassi ef3de22096 Cosmetics 2017-09-02 17:05:51 +02:00
Damiano Galassi 26b025e365 Improve star offset from edit list conversion. 2017-09-02 10:53:28 +02:00
Damiano Galassi c9a13f3b1d Fix findChapterPreviewTrackId 2017-09-01 09:09:17 +02:00
Damiano Galassi fc6b9d8a4c Use NSTimeInterval to store a track start offset, rename alternate_group to alternateGroup. 2017-09-01 07:36:57 +02:00
Damiano Galassi 4d1dc8cb92 Add a way to differentiate hvc1 and hev1 2017-08-03 14:17:19 +02:00
Damiano Galassi 090ad02a7d Use the extended language tag for English. 2016-11-30 11:51:45 +01:00
Damiano Galassi 5c6f1a7ea8 Always use extended language tags when possible. 2016-11-26 13:14:14 +01:00
Damiano Galassi 384d30d00c Show localized track names in the document window. 2016-11-23 11:40:21 +01:00
Damiano Galassi d847082696 Use the iso639_2 to store the language in MP42Track. 2016-11-04 09:57:25 +01:00
Damiano Galassi 69cb3ea22c Guess a layout for PCM tracks if none is set. 2016-09-18 10:33:08 +02:00
Damiano Galassi 72c721db22 Remove unused code. 2016-09-18 10:12:04 +02:00
Damiano Galassi 8a2b4460ed Fix some more display names. 2016-08-19 09:34:52 +02:00
Damiano Galassi 285e6e9667 Add back "Chapter Track" name to chapters track. 2016-08-16 10:36:35 +02:00
Damiano Galassi b54c8b747b Add hevc support. 2016-08-14 12:03:29 +02:00
Damiano Galassi 1310202592 Implements the localised media names. 2016-08-13 13:40:09 +02:00
Damiano Galassi 1c562a65ea Switch to FourCC instead of NSStrings for media type and formats. 2016-08-10 18:51:53 +02:00
Damiano Galassi 78a5867492 Moved some magic cookies utility to a new file. 2015-11-18 09:35:20 +01:00
Damiano Galassi f710cf7ac2 Comment out unused dec3 parse code. 2015-11-05 23:18:28 +01:00
Damiano Galassi bda8ac4b37 Partial eac3 passthru. 2015-11-04 23:41:08 +01:00
Damiano Galassi 81421f1421 Use the new media format strings. 2015-09-12 19:50:01 +02:00
Damiano Galassi e5095a611a Enabled more warnings, switched the deployment target to 10.7 and minor code cleanup 2015-08-24 17:32:42 +02:00
Damiano Galassi f0b349eef1 New formats constants. 2014-12-12 11:20:08 +01:00
Damiano Galassi 7611af9ce4 Moved some functions to the public MP42Utilities. 2013-11-16 14:01:14 +01:00
Damiano Galassi 08e32323ce Renamed MP42Utilites to MP42PrivateUtilities, a public header will be committed soon. 2013-11-16 13:23:01 +01:00