Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

Media file meta-data on Windows in Delphi.

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…



Always verify your customers requirements before starting work! 1f642-9336350

Thanks for Reading!

What's New for RAD Studio 11

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Related posts

2021 Annual C++ Developer Survey "Lite" by ISOCpp.org - Results summary


Articles and News from the C++ community


Building REST services with RAD Server (Delphi & C++ Builder)


A vulkan header generator for Delphi.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.