How to use a HEX editor to determine file type

Posted on July 20, 2009 at 5:16 am

Most of us don’t know that the filename extension of a video doesn’t dictate the codec, but it does determine how the video data is organized in the folders. Of course, there’s a chance someone gave your file the wrong filename extension, so before you attempt to repair that video, make sure it has the correct extension.

In this tutorial you will need a hex editor like XVI32 that you can download freely:

XVI32 is a freeware hex editor running under Windows 95, Windows 98, Windows NT, Windows 2000, and Windows XP.

To check whether that .mpg file is really an .mpg file, open the file in a text or hex editor. The header (before the aforementioned 4CC code) will read RIFF if it’s an .avi file, RMF if it’s an .rm (Real Media) file, MOOV if it’s a .mov (Apple Quicktime) file, FLV if it’s an .flv (Flash Video) file, or W.M.F.S.D.K if it’s a Microsoft .asf or .wmv file. If you see no header (only junk), it’s likely an .mpg file.

In the example below I dropped an FLV file into the XVI32 window:

image

The codec information is located at the first line of the display:

image

You should see the codec information no matter what the extension of the file is used.  Pretty cool isn’t it?  If you drop an AVI file, you should see the word RIFF AVI on the screen:

image

You can do various things with a HEX editor, but this is one of the more useful applications for typical home and media playing use.

Ben Carigtan shows you how it’s done!

» Filed Under Computer Tips

Related Posts

Comments

2 Responses to “How to use a HEX editor to determine file type”

  1. jpedrosa said on :

    i need help here. i have copied a total of 277 files from digital camera to pc(from a net cafe), then transferred from pc to usb thumb drive. when i open the pics at first, it was ok. but when i got home to view the pics, i got an error “No preview available. i cant open the jpeg files in ms paint of photoshop. i badly need your help here. any response would be highly appreciated. thanks and godspeed!


  2. Sergio said on :

    You can also tell that it is an EXE file if it was compressed with UPX. It will have a .upx extension instead of .exe.


Please post your comments/suggestions!