Jump to content

UDF or advice needed on parsing a MP4/TS file, please?

Recommended Posts


One of my apps launches and monitors a third-party app that's recording a video file (usually MP4, but possibly TS), so obviously it has the video file opened for writing. The thing is, on rare occasions this third-party app fails to capture the audio stream for some unknown reason. What I'd like to do (it may be impossible) is to read that file and then determine if any audio is being captured. But although I don't think this is possible, there's an easy work-around: Make a copy of the target video file as it is after perhaps 1 minute, then open that for reading.

Of course, I'd also have to figure out how to tell whether audio has been captured or not, and for that I'd need to figure out how to parse MP4 and TS files.  Unfortunately, I can't simply get the file's metadata to determine if there's any audio, because no metadata is created (or stored, anyway) until the file is officially closed. These partial copies will not contain metadata, or at least it's not accessible, so code like Bento or other libraries won't help. I'd have to do it the hard way (I think).

I actually developed some programs to parse, test, display, and create MPEG-2 files back in the day, but it was tricky figuring out how to parse those files (and since it was 20 years or so ago, I remember little).  I'm not sure it's worth the effort to learn how to parse MP4 or TS files again just for this purpose, but if there were an existing MP4/TS-parsing UDF, or a general-purpose binary-parsing UDF, that would be ideal! I've looked at BASS and the Media UDFs, but I didn't see anything I could use.

Does anyone know of any other UDF or parsing library or whatever I might be able to use?


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now