我刚刚开始了解VP8,所以如果这是一个愚蠢的问题,请给我一些放松。
H.264示例
在过去,我主要从事H.264的工作。每当我需要解析H.264比特流时,我都会利用libav来帮助我并使用类似的东西
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
上述方法在解析H.264比特流和为我提供H.264帧以提供给我自己的解码基础结构方面发挥了很大的作用。
我正试图在VP8中重复同样的工作。我尝试使用这段代码作为基础,而不是寻找"h264“格式,而是尝试了"vp8”和"webm“。"vp8“似乎无效,但"webm”能够加载格式。然而,当我到达avformat_open_input时,我会得到以下错误:
matroska,webm @ 0x101812400未知条目0xF0 使用不受支持的特性的matroska,webm @ 0x101812400 EBML报头 (EBML版本0,doctype (null),doc版本0) 未能打开输入文件:尚未在FFmpeg中实现,欢迎修补程序
我看不见了吗?还是我只是不正确地接近这个?
发布于 2014-08-22 21:15:38
我将这 C#包装器用于FFMPEG\LibAV (特别是这示例文件),它具有与C++示例文件相同的语法,并且工作正常。
错误消息说它还没有实现,所以我建议更新您的libav库。
正在工作的代码(包括我对AVInputFormat的修改,它在链接的示例文件中不存在):
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如果这样做不起作用,那么可能您打开的文件不正确( avformat_open_input的第二个参数为空)。
也许试着指定一个文件路径?
https://stackoverflow.com/questions/24947246
复制相似问题