我真正想要的是store frames of a video into a char array ,使用 ffMPEG。
约束是仅使用 MSVC。不允许使用Windows building tweak由于可维护性问题。
所以考虑使用 shared build完成任务。它仅由 DLL 组成。没有 lib
文件,所以我尝试使用 HINSTANCE hInstLibrary = LoadLibrary("avcodec-54.dll");
加载其中一个 DLL它有效。但是我在任何地方都找不到这个 DLL 的接口(interface)。有人可以帮忙吗?如何知道可以调用 DLL 的哪些函数以及可以传递哪些参数以便获取视频帧?
最佳答案
使用 ffmpeg 的公共(public)接口(interface)
ffmpegdir/include/libavcodec/
ffmpegdir/include/libavformat/
etc.
例如,要打开文件进行读取,请使用 ffmpegdir/include/libavformat/avformat.h 中的 avformat_open_input
AVFormatContext * ctx= NULL;
int err = avformat_open_input(&ctx, file_name, NULL, NULL);
您可以从 http://ffmpeg.zeranoe.com/builds/ 获取最新版本的 ffmpeg
公共(public)头文件可以在开发版本 (http://ffmpeg.zeranoe.com/builds/win32/dev/) 中找到。
更新:
这是一个工作示例(没有额外的静态链接)
#include "stdafx.h"
#include <windows.h>
#include <libavformat/avformat.h>
typedef int (__cdecl *__avformat_open_input)(AVFormatContext **, const char *, AVInputFormat *, AVDictionary **);
typedef void (__cdecl *__av_register_all)(void);
int _tmain(int argc, _TCHAR* argv[])
{
const char * ffp = "f:\\Projects\\Temp\\testFFMPEG\\Debug\\avformat-54.dll";
HINSTANCE hinstLib = LoadLibraryA(ffp);
__avformat_open_input __avformat_open_input_proc = (__avformat_open_input)GetProcAddress(hinstLib, "avformat_open_input");
__av_register_all __av_register_all_proc = (__av_register_all)GetProcAddress(hinstLib, "av_register_all");
__av_register_all_proc();
::AVFormatContext * ctx = NULL;
int err = __avformat_open_input_proc(&ctx, "g:\\Media\\The Sneezing Baby Panda.flv", NULL, NULL);
return 0;
}
关于visual-studio-2010 - 在仅 DLL 的 Windows 上使用 ffMPEG?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13262610/