Coding question:

You know how there are libraries in Java that let you load XML files, manipulate their contents via a model, then save them to a new file?

I want to do that with MKV, so that I can make edits to subtitle tracks (WITHOUT re-coding any media streams).

Anyone have any ideas please? I'm sure there must be something somewhere that can do this. I could research the full MKV format and write my own code, but frankly, it's a bit daunting.

#Software #AskMastodon

@macronencer This looks promising: https://www.nikse.dk/subtitleedit

Or extract with ffmpeg https://www.mux.com/articles/extracting-subtitles-and-captions-from-video-files-with-ffmpeg

You can split & join tracks with ffmpeg without reencoding the streams.

Nikse.dk

@gunchleoc Many thanks! Those both look interesting, and I'll check them out. 👍
@villares I appreciate the tip, but I don't do Python :)

@macronencer as a Python enthusiast I had to try :D

(Just joking a bit, I totally respect your choices!)

@macronencer
I'll second ffmpeg. It can even decode CCs that are embedded in tv broadcasts.
@gunchleoc

@encthenet @gunchleoc

Thank you both. I've just been looking at the documentation for ffmpeg and it looks extremely powerful. I'm perfectly at home with the command line so I think I've found my answer. I appreciate your help!

@macronencer

Maybe check with @mosu who makes the MKVToolNix tools.

@stepheneb @mosu Thanks! Is it possible to use those on a Mac? I'm running Java in IntelliJ.
@macronencer @stepheneb I'm not a Java person. I know there were low-level EBML/Matroska Java libraries at one point, but I have insight if they're still updated, how they're used, their capabilities or if there are others. https://github.com/Matroska-Org/jebml
GitHub - Matroska-Org/jebml

Contribute to Matroska-Org/jebml development by creating an account on GitHub.

GitHub
@mosu @stepheneb Wow, another link to look at! It seems there are quite a few related technologies/solutions around that I've not found until now. Thanks :)
@macronencer @stepheneb Like I said, I cannot say anything about that repo apart from "it exists". Yes, I'm listed as a committer once or twice, but that was solely merging PRs by other people.

@macronencer I remember there was a Windows application called VirtualDub. It featured a "direct stream copy" option, which allowed you to export a modified container without re-encoding the video stream. This was useful for adding extra audio tracks or subtitles.

If it’s still functional, it might be helpful for editing a movie or two (assuming you’re using it manually, not programmatically).

https://en.wikipedia.org/wiki/VirtualDub

VirtualDub - Wikipedia

@david_bardos Thank you for your help, but I don't have access to Windows at the moment, so probably a non-starter.