在Windows上只使用DLL的ffMPEG? [英] Using ffMPEG on Windows with only the DLL's?

查看:609
本文介绍了在Windows上只使用DLL的ffMPEG?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真正想要的是将视频的帧存储到char数组,使用ffMPEG。

约束是仅使用MSVC。由于可维护性问题,不允许使用 Windows构建调整

What I actually want is to store frames of a video into a char array, using ffMPEG.
Constraint is to use only MSVC. Not allowed to use the Windows building tweak due to maintainability issues.

所以考虑使用共享版本完成任务。它只包含DLL。没有 lib 文件,所以我尝试使用加载其中一个DLL HINSTANCE hInstLibrary = LoadLibrary(avcodec-54.dll); 它有效。但是我找不到在任何地方发布的这个DLL的接口。有人可以帮忙吗我如何知道我可以调用哪些DLL函数,以及可以传递哪些参数,以便我可以获得视频帧?

So considered using the shared build to accomplish the task. It consists of only DLL's. No lib files, so I tried loading one of the DLL's using HINSTANCE hInstLibrary = LoadLibrary("avcodec-54.dll"); and it works. But I couldn't find the interfaces of this DLL published anywhere. Could anyone help with this? How do I know which functions of the DLL I can call and what parameters I can pass it so that I can get the video frames?

推荐答案

使用

ffmpegdir/include/libavcodec/
ffmpegdir/include/libavformat/
etc.


例如,要打开一个文件进行阅读,请使用ffmpegdir / include / libavformat / avformat.h中的avformat_open_input

for example, to open a file for reading, use avformat_open_input from ffmpegdir/include/libavformat/avformat.h

AVFormatContext * ctx= NULL;
int err = avformat_open_input(&ctx, file_name, NULL, NULL);

您可以从 http://ffmpeg.zeranoe.com/builds/

公开头文件可以在开发人员构建(http://ffmpeg.zeranoe.com/builds/win32/dev/)。

Public header files can be found in dev builds (http://ffmpeg.zeranoe.com/builds/win32/dev/).

UPD:
这里是一个工作的例子(没有额外的静态链接)

UPD: Here is a working example (no additional static linking)

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

这篇关于在Windows上只使用DLL的ffMPEG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆