[英]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.