Quantcast
Viewing latest article 2
Browse Latest Browse All 74

Windows MP4 shell property handler sometimes destroys your media data

Some version of Microsoft Windows OS have rather dangerous subsystem known as MP4 property sheet handler (“MF MPEG-4 Property Handler” to be exact). Programmatically, you would use API like SHGetPropertyStoreFromParsingName and use IPropertyStore from there to read (reading is OK) and update/write certain MP4 file properties like, for example, a comment or som other metadata.

The same API is used from property sheet UI if you decide to update metadata:

Image may be NSFW.
Clik here to view.

It looks like the implementation is damaging some media files. An attempt to update a file breaks it and overwrites vital part of MPEG-4 Part 14 file structure with the new metadata, rendering the file unplayable.

Long story short – prefer to not use the API at all to update the metadata, or make a backup copy.

In DirectShow MP4 multiplexer created back in time by Geraint Davies, in its fork I am still using somewhere, I created IMuxFilter::SetComment method exactly for this: to be able to set comment before the file is finalized, by injecting a respective box with metadata as a part of finalization, so that stock faulty Windows API is not used and the produced file is reliably safe.


Viewing latest article 2
Browse Latest Browse All 74

Trending Articles