visual-studio-2010 - 在仅 DLL 的 Windows 上使用 ffMPEG?

标签 visual-studio-2010 visual-c++ ffmpeg

我真正想要的是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/

相关文章:

c++ - 从文本文件读取数据并将数据插入数组

c# - Task.Factory.StartNew 在部署时不执行任务

c# - user.isuserinrole mvc 的自定义角色提供程序

c++ - 在 qi spirit 中回滚替代解析器的变化

ffmpeg concat 在输出流中给出非单调 DTS

ffmpeg - 如何使用 ffmpeg 以特定 fps 解码视频

video - 更轻松地获取视频文件中的时间码

c# - 不包含适合入口点的静态 'main' 方法

visual-studio - Visual Studio C++ - 资源 View 空白?

c++ - 如何在 Visual Studio 中将 pjsip 构建为 DLL?