繁体   English   中英

在Windows上仅使用DLL使用ffMPEG?

[英]Using ffMPEG on Windows with only the DLL's?

我真正想要的是使用ffMPEG 将视频的帧存储到char数组中
约束是仅使用MSVC。 由于可维护性问题,不允许使用Windows建筑调整

因此考虑使用共享构建来完成任务。 它仅包含DLL。 没有lib文件,因此我尝试使用HINSTANCE hInstLibrary = LoadLibrary("avcodec-54.dll");加载DLL之一HINSTANCE hInstLibrary = LoadLibrary("avcodec-54.dll"); 而且有效。 但是我找不到在任何地方发布的该DLL的接口。 有人可以帮忙吗? 我如何知道我可以调用DLL的哪些功能以及可以传递哪些参数以便获取视频帧?

使用ffmpeg的公共接口

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。

可以在开发版本(http://ffmpeg.zeranoe.com/builds/win32/dev/)中找到公共头文件。

UPD:这是一个有效的示例(没有其他静态链接)

#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;
  }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM