![android | Embarcadero RAD Studio Delphi C++Builder Blogs](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2020/08/android-1.jpg?resize=1140%2C628&ssl=1)
Author: Craig Chapman
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 Problem.
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!
The Solution
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ā¦
Conclusion
Always verify your customers requirements before starting work!
Thanks for Reading!
Design. Code. Compile. Deploy.
Start Free TrialĀ Ā Ā Upgrade Today
Ā Ā Ā Free Delphi Community EditionĀ Ā Ā Free C++Builder Community Edition