0

I've just started to learn about VP8, so give me some slack if this is a dumb question.

H.264 Example

In the past I've worked mostly with H.264. Whenever I needed to parse H.264 bit streams, I would leverage libav to help me and use something like this

av_register_all();

_ioContext = avio_alloc_context(
        encodedData,
        H264_READER_BUF_SIZE,
        0,
        0,
        &readFunction,
        NULL,
        NULL);
if (_ioContext == NULL)
    throw std::exception("Unable to create AV IO Context");

AVInputFormat *h264Format = av_find_input_format("h264");
if (h264Format == NULL) {
    throw std::exception("Unable to find H264 Format");
}

_context = avformat_alloc_context();
_context->pb = _ioContext;

ret = avformat_open_input(&_context,
        "",
        h264Format,
        NULL);

if (ret != 0) {
    throw std::exception(
            "Failed to open input file :" +
            std::string(_avErrToString(ret)));
}

VP8

The above method has worked great for parsing the H.264 bit streams and providing me with H.264 frames to feed to my own decoding infrastructure.

I'm trying to duplicate the same effort with VP8. I tried using this code as a basis and instead of looking for the "h264" format, I've tried "vp8" and "webm". "vp8" doesn't seem valid, but "webm" is able to load a format. However when I get to avformat_open_input I get this error:

[matroska,webm @ 0x101812400] Unknown entry 0xF0
[matroska,webm @ 0x101812400] EBML header using unsupported features
(EBML version 0, doctype (null), doc version 0)
Failed to open input file :Not yet implemented in FFmpeg, patches welcome

Am I out of look? Or am I just approaching this incorrectly?

anoneironaut
  • 1,778
  • 16
  • 28

1 Answers1

1

I am using this C# wrapper for FFMPEG\LibAV (particularly this example file), it has the same syntax as the C++ one, and it works fine.

The error message says that it hasn't been implemented yet, so I suggest updating your libav library.

Piece of code that is working (it include the AVInputFormat modification by me, which is not present in the linked example file):

FFmpegInvoke.av_register_all();
FFmpegInvoke.avcodec_register_all();
FFmpegInvoke.avformat_network_init();

string url = @"C:\file.webm";

AVFormatContext* pFormatContext = FFmpegInvoke.avformat_alloc_context();

AVInputFormat* pFormatExt = FFmpegInvoke.av_find_input_format("webm");

if (FFmpegInvoke.avformat_open_input(&pFormatContext, url, pFormatExt, null) != 0)
    throw new Exception("Could not open file"); //no exception is thrown

//more code to decode frames, and frames are decoded successfully

If that does not work, then maybe you are opening the file incorrectly (the second argument of avformat_open_input is empty).

Maybe try specifying a file path?