How do I find the codec for an AVI?

19

3

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).

C. Ross

Posted 2009-08-16T23:38:41.787

Reputation: 5 284

Answers

24

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

vidsWMV1

Then google for 'fourcc WMV1' in this example.

Chris

Posted 2009-08-16T23:38:41.787

Reputation: 1 394

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 – 2018-09-03T18:32:53.380

1Interesting solution, didn't know about this. +1 – Sasha Chedygov – 2009-08-17T23:17:08.453

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

joe

Posted 2009-08-16T23:38:41.787

Reputation: 11 615

@Badaro Even if you manage to get it loaded, searching is going to be a nightmare performance-wise. – jpmc26 – 2015-08-19T06:46:07.883

And how to we check the FOURCC code? I have mpg2, is it that? It is not listed in FOURCC website. – jeff – 2015-11-23T21:25:59.523

4I think he would prefer a method that does not require downloading a program. – hyperslug – 2009-08-17T00:13:09.363

13GSpot 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 – 2009-08-17T00:47:30.633

1A good answer, but it wasn't the answer I was looking for. – C. Ross – 2009-08-17T12:48:36.923

@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 – 2012-10-14T16:44:24.720

0

I just needed this, found this (very old) page, and decided I would rather not load my 260 MB AVI into a text editor, so maybe my solution will help someone else.

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

FWIW, Windows Media Player listed the codec in my AVI as "-" for both audio and video, but the above worked as expected.

I hope that was worth it to someone that I spent time typing this up! ;-)

Whew, Mark

Mark

Posted 2009-08-16T23:38:41.787

Reputation: 1