I have a live pipeline, in which I want to insert metadata (say every 100 milliseconds) and write it to the mkv or mp4 file.
What would be the right type of element to do this?
I thought about writing a source element with an action signal to accept metadata from the application, and link it to the subtitle_%u pad of mp4mux or matroskamux. But I am not sure if this would work with live sources.
id3mux is usually only used for audio tagging, to add a tag to the beginning/end of a file when done, not so much for continuous metadata.
The main problem is that our muxers won’t just mux random data into files/tracks, but only formats they know about. And GPMF is likely not one of those formats.
You could hack around this by serialising things into json or xml or base64 or so and feeding that as text subtitles into subtitle tracks, but that’s not very nice of course.
Alternatively, some containers (e.g. mpegtsmux) have support for KLV (that’s a different KLV than GPMF though).