axiomatic-systems / Bento4

Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
http://www.bento4.com
2.04k stars 485 forks source link

Can this be used to read and write custom metadata to an MP4 at certain timestamps? #830

Open nonlin opened 1 year ago

nonlin commented 1 year ago

I'm tasked with inserting custom metadata that can be read back to define at timestamp X of an MP4 file obtain certain data, a key value pair lets say.

Is Bento4 the right tool for the job?

FFMPEG seems to only let you modify an MP4s global metadata, nothing local or at certain intervals.

barbibulle commented 1 year ago

Hi. The answer is... it depends ;-) It depends on what type of metadata you're talking about. There's a number of different ways "metadata" can be associated with an mp4 file. There's file-level metadata, which is typically used to signal things like a song artist/album info or associated thumbnails or other so-called "tags". The mp4tag app uses the Bento4 API to read and write this type of metadata. There are actually variants of this type of metadata (3gpp, itunes, ...). But that's always global to the file, not related to particular media times. Then there's metadata like subtitles and other time-related events. Same here, there are a number of variants, and they're all fairly different. There's mp4 timed-text metadata (used for subtitles), ttml, and others. Do you know what type of metadata you intend to use?

nonlin commented 1 year ago

The mp4 timed text seems like it could work for me.

But essentially I want to add scented odor data to play at specific time stamps.

So this isn't subtitles or anything that will be displayed on screen. Just data that needs to be stored and retrieved at specific intervals.

I've already implemented a sidecar system. Just trying to see if I can take that data from my buddy file and put it into an mp4 in a portable cross platform way with existing tools.

So far my research is indicating I'm best off sticking with the buddy file but just doing my homework.