- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been trying to use my own build of ffmpeg with my .mll plugin, but I keep getting NULL when attempting to find the encoder by the codec ID. Here is part of the code:
#include <windows.h>
#include <Lmcons.h>
#include <maya/MSimple.h>
#include <maya/MGlobal.h>
#include <maya/MString.h>
extern "C"
{
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#include <libavcodec\avcodec.h>
#include <libavformat\avformat.h>
}
#pragma comment(lib, "avcodec.lib")
#pragma comment (lib, "avformat.lib")
using namespace std;
DeclareSimpleCommand(h264_test, "Autodesk", "2016");
MStatus h264_test::doIt(const MArgList&)
{
av_register_all(); AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H264); if (!codec) { MGlobal::displayInfo("Codec not found");
} else {
MGlobal::displayInfo("H264 codec was found");
}
return MS::kSuccess;
}
NOTES:
- I have tried the compiled ffmpeg from Zeranoe, tried my own compiled version of ffmpeg and the one provided by Autodesk here.
- I tried compiling with Microsoft Visual Studio 2013 and with Microsoft Visual Studio 2012 Update 4 (suggested by Autodesk on Maya 2016 SKD Documentation)
- I have placed my compiled .mll and ffmpeg dlls in "C:\Program Files\Autodesk\Maya2016\bin" and made sure the environment variable PATH includes that directory.
- When I compile the same code as a Windows executable (.exe), the program is able to find the codec and output the message "H264 codec was found", but for some reason Maya doesn't seem to allow my .mll plugin to execute the appropriate calls to ffmpeg dlls.
- This issue doesn't happen with h264 only, any other codec ID I try returns NULL, such as AV_CODEC_ID_MPEG2VIDEO.
Solved! Go to Solution.