Using ffMPEG on Windows with only the DLL's?

后端 未结 1 820
不知归路
不知归路 2021-01-07 14:25

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

相关标签:
1条回答
  • 2021-01-07 15:07

    Use the public interface of ffmpeg from

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

    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);
    

    You can get the latest builds of ffmpeg from http://ffmpeg.zeranoe.com/builds/

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

    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;
      }
    
    0 讨论(0)
提交回复
热议问题