Search code examples
video-processingvideo-encodingcodec

Editing/Decoding AVI files using system-installed proprietary codecs


I've been searching for this for a few days now, but nothing seems to quite answer or work for me, so please forgive me if I'm asking a stupid question or one that seems to have been answered elsewhere.

I have an AVI file encoded using the GMP4 video codec, currently installed on my computer so I can PLAY the file in Windows Media Player for instance. What I'm trying to do is open/decode the file for editing purposes, in order to be able to stitch two video files together. I do not require it to be output in the same format, but rather only opened for editing, get the frames and then I can output to a more standard format.

The problem I'm getting is that there is no DirectShow filter created for this format, so it won't open using that for me (haven't worked too deeply into it, but all samples fail to load the video file). FFMPEG tries to read the file, states that the header is incorrect but it'll attempt to read it anyway, then dies stating that I need the GMP4 codec. As I'd stated earlier, I have the particular codec installed but FFMPEG doesn't seem to notice or have access to it.

Is there anything that will allow me to use the system-installed codecs to decode the video frames? It seems strange to me that Windows Media Player can do something, but I can't programatically repeat it. I'm not restricted to C++ or C#, though C# would definitely be a preferred language.

Thanks All, Alex


Solution

  • I spent all day with the same problem. Solution is to install AVISynth, and then you can load with ffmpeg any AVI file for whom the system has a VfW codec. Instead of passing ffmpeg your AVI input file, create an .avs file with a single line containing AviSource("your-avi-filename") and passing ffmpeg the .avs filename.

    Suppose you want to convert your input.avi in a proprietary video CODEC into an h263 format (supposing your input.avi has a supported h263 frame size):

    echo AviSource("input.avi") > input.avs
    ffmpeg -i inputs.avs -vcodec h263 output.avi