Here’s a littleÂ DÃ©jÃ vu for regular readers of my blog.
One of my customers emailed me with an interesting problem this morning.
â€œI need to be able to peek into a video file, specifically a .mp4 file, and determine if itâ€™s PAL or NTSC.â€
This seemed like a fun challenge, so I thought Iâ€™d write a helper class to solve it..
The above excerpt is from a blog that I posted a few days ago (here), in which I was able to determine the media file attributes for an mp4 file on Android.
I was very pleased with myself for having written the code sample, and supplied a link to the blog post to my customer. Unfortunately, that customer then replied to my email with words akin to “Who said anything about Android?!”Â – Realizing that in my morning haste I’d confused two customers and created a solution for the wrong platform, I was of course suitably embarrassed.
My customer wanted to retrieve this information for a media file on the Windows platform!
Finding information on a media file format on Windows did not appear to be as obvious as it was on Android. The solution that I came up with involves a much earlier post on my blog about integrating the Windows Media Player ActiveX control.Â Using the type library created by importing the ActiveX player control, it’s possible to interrogate any video loaded into a video player.Â This doesn’t mean that the video player has to be visible either, it can be created at run-time, interrogated, and disposed without ever being placed on a form.
This is not necessarily the best, or ideal solution – if you have a better idea, please get in touch!Â (Please don’t suggest ffmpeg).
This solution does work however, and so I’ve re-packaged the same sample application as I built for Android, but this time with the Windows code added in using conditional defines…
Always verify your customers requirements before starting work! 🙂
Thanks for Reading!