20

How can I find which codec an AVI file needs? A method that does not require downloading a program would be preferred (such as looking at the file in notepad).

3 Answers 3

25

Open in notepad, do a search for 'vids' - the FOURCC value is right after that. Eg you'll find something like:

vidsWMV1

Then google for 'fourcc WMV1' in this example.

1
  • Nice! FYI, this will also work on macOS with TextEdit or other text editors. I love these simple approaches that don't require special software.
    – EJ Mak
    Sep 3, 2018 at 18:32
21

This is a very simple process and can be done using the GSpot Codec Information Tool. Just download the program and install it. Now go into your Start Menu and open the program.

  1. Select File | Open and select your AVI file
  2. Look for the FourCC code for the file's Video Codec

  3. Visit the FourCC website and find out who develops that codec

  4. You can now go to that developers website to download your codec. You can also visit the Codec section of wmplugins.

Note: Do not download anything labeled as a "Codec Pack" or from the links at the top of the FourCC website. This will help you stay out of trouble when playing your files.

VLC has support for Divx and 3ivx built in for all platforms.

Source :http://msmvps.com/blogs/chrisl/articles/11529.aspx

7
  • 5
    I think he would prefer a method that does not require downloading a program.
    – hyperslug
    Aug 17, 2009 at 0:13
  • 13
    GSpot is <200KB and doesn't require installation. Downloading and running it will probably be faster than trying to load a video file on Notepad.
    – Badaro
    Aug 17, 2009 at 0:47
  • 1
    A good answer, but it wasn't the answer I was looking for.
    – C. Ross
    Aug 17, 2009 at 12:48
  • @Badaro agreed that GSpot is the best. I have a small folder named "Other Programs" on my E:\ secondary HDD just for storing programs like these. very quick solution and it works for all AVI formats
    – Jake
    Oct 14, 2012 at 16:44
  • @Badaro Even if you manage to get it loaded, searching is going to be a nightmare performance-wise.
    – jpmc26
    Aug 19, 2015 at 6:46
0

If you have a Unix-like shell, you probably have a program called 'strings' which finds sequences of printable characters. By default, the minimum length is four, which is fine for this need. (It can be changed on the command line.) The 'vids' and the fourcc will be consecutive in the output (but not one string in my AVI).

You could pipe the result into something simple like 'more' and find it yourself. Or you could pipe it into head and hope to guess the number of lines you will need. Or you could be a little more sophisticated and pipe it through sed and have it print the line that matches the desired pattern. Or you can use awk to do the same. On my cygwin bash shell, those options looks like these commands:

strings foo.avi | more
strings foo.avi | head -10
strings foo.avi | sed -n '/vids/,+1p'
strings foo.avi | awk 'NR==1,/vids/{if( $0 == "vids" ) { getline ; print ; exit } } '

The disadvantage to the third version is that I have sed process the entire file, so it might take a while to complete. I'm confident that there is a way to make it stop after the first match, but I'm not sufficiently expert with sed to know (or find) that. The awk version does explicitly stop if the condition is true (get next line, print that, exit -- whereas the sed command has only the first two of those with +1 and p). In both the sed and awk command, the /vids/ is the regular expression we need (i.e. the search string in Chris' answer above). Also, the awk construction 'NR==1,/vids/' says to apply the following code block to the lines from number 1 (first input line) to wherever it finds that regular expression (matching string). The if condition prevents printing all the lines up to the one that matches. I have it match the full line ($0), which for the strings command, should work fine; strings are printed one per line anyway.

Note that the string it finds may well include extra characters (e.g. from my AVI file it finds 'strf(' not 'strf' which is the fourcc). If you really need to chop it at four characters (e.g. for a script that needs to match it against a standard list), you can pipe the answer to 'head -c 4' and get just the fourcc. Here's my final answer:

strings foo.avi | awk 'NR==1,/vids/{if( $0 == "vids" ) { getline ; print ; exit } } ' | head -c 4

For what it's worth, Windows Media Player listed the codec in my AVI as "-" for both audio and video, but the above worked as expected.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .