PDA

View Full Version : Windows & Zeranoe FFmpeg Builds with NewTek NDI Built-In



jules43
01-19-2018, 07:30 AM
I was pleased to see the announcement that as of the 3.4.1 release of FFmpeg, NDI is built in for both read and write. I would very much like to make use of these capabilities via FFmpeg both using a Windows build and my own custom build.

For a Windows build I normally source my builds from the very popular Zeranoe web-site (https://ffmpeg.zeranoe.com/builds/). Where one can download a static, dynamic or developer build with most popular features enabled.

Do you plan to work with Zeranoe to make this available? At the moment I don't think your SDK includes the correct type of lib/symbol file to support this.

In addition I use the Media-AutoBuild_Suite (https://github.com/jb-alvarado/media-autobuild_suite) to actually build my own custom versions of FFmpeg.

As someone mentioned here:
https://github.com/jb-alvarado/media-autobuild_suite/issues/721

This requires libs built with mingw GCC rather than MSVC.

AFAIK building full versions of FFmpeg with MSVC is quite tricky and poorly supported. If there's a recommended way to build a custom version of FFmpeg with NDI builtin using MSVC that would be an alternative for me.

Thanks

Jules

ACross
01-19-2018, 09:53 AM
Actually, I do not think that to use the FFMPEG version of NDI you need any kind of support for MSVC. If I remember correctly they implemented it using dynamic binding (i.e. LoadLibrary) which means that they should be able to include it as part of the standard builds. Whats more, we released our SDK header files under the MIT license so that they can even be included in the FFMPEG source code if they want to facilitate building. If someone wants to work with us on this, just have them email [email protected] and we'll help make this happen.

ORFAST
01-20-2018, 06:32 AM
>>f I remember correctly they implemented it using dynamic binding (i.e. LoadLibrary)
>>which means that they should be able to include it as part of the standard builds.

Unfortunately, they use static linking (https://github.com/FFmpeg/FFmpeg/commit/2634927fe30ea4a821db515c6b7f77458f5c4bc5)
Moreover as you can see feature implemented with not the last NDI SDK release (which have really significant changes, stability and several very important features )
So, only way to have NDI with ffmpeg -> build with custom options + NDI SDK by yourself.

livepad
01-21-2018, 03:55 AM
>>f I remember correctly they implemented it using dynamic binding (i.e. LoadLibrary)
>>which means that they should be able to include it as part of the standard builds.

Unfortunately, they use static linking (https://github.com/FFmpeg/FFmpeg/commit/2634927fe30ea4a821db515c6b7f77458f5c4bc5)
Moreover as you can see feature implemented with not the last NDI SDK release (which have really significant changes, stability and several very important features )
So, only way to have NDI with ffmpeg -> build with custom options + NDI SDK by yourself.

On macOS, all you do is build FFMPEG from the regular source, but with a couple of extra configuration strings to inform FFMPEG you want NDI and it works just fine, runtime linking with the libNDI .dylib you have installed in /usr/... from the NewTek NDI end user Tools like their NDI Monitor.

Doesn't require any code changes. Also, if libNDI isn't available it seems to fail gently when running and trying to access NDI.

its also possible to make self contained app bundles which include the ndi dylib, by changing the rpath in FFMPEG to point locally, or even a local companion folder for non-bundle based apps. This is pretty much self contained, particularly the bundle method.

It might be nice to get static libraries for NDI on more platforms, and I would support that idea.
However, meanwhile the current situation is quite workable, but requires some care and knowledge of library linking.

jules43
02-14-2018, 04:55 AM
I've asked on the Zeranoe forum and the media-autobuild_suite about integration into build of FFmpeg.

The primary feedback from Zeranoe is that the license terms do not allow free distribution. I would guess that in particular this statement:

"Unless otherwise stated in the SDK, no files within the SDK and the Specific SDK may be distributed."

is a problem. The headers and libs (as opposed to DLLs) need to be licensed in such a way as to allow free redistribution in binaries and as build-able source.

The main contact at the media-autobuild_suite said the following:

don't put the SDK behind a **** registration wall, put it somewhere publicly and anonymously accessible; also, don't put it inside an installer, that's unusable for redistribution and building automation
FFmpeg expects ndi.lib or libndi.[dll.]a, because that's the normal name of a library and is what's available in both macOS and Linux versions of the SDK.
MinGW GCC doesn't set MSC_VER (nor should it set it, for very obvious reasons), so this is broken in Processing.NDI.Lib.h and probably other headers:
#ifdef _WIN32
#define PROCESSINGNDILIB_DEPRECATED __declspec(deprecated)
#ifdef PROCESSINGNDILIB_EXPORTS
#ifdef __cplusplus
#define PROCESSINGNDILIB_API extern "C" __declspec(dllexport)
#else
#define PROCESSINGNDILIB_API __declspec(dllexport)
#endif
#else
#ifdef __cplusplus
#define PROCESSINGNDILIB_API extern "C" __declspec(dllimport)
#else
#define PROCESSINGNDILIB_API __declspec(dllimport)
#endif
#ifdef _MSC_VER
#ifdef _WIN64
#define NDILIB_LIBRARY_NAME "Processing.NDI.Lib.x64.dll"
#define NDILIB_REDIST_FOLDER "NDI_RUNTIME_DIR_V3"
#define NDILIB_REDIST_URL "http://new.tk/NDIRedistV3"
#else
#define NDILIB_LIBRARY_NAME "Processing.NDI.Lib.x86.dll"
#define NDILIB_REDIST_FOLDER "NDI_RUNTIME_DIR_V3"
#define NDILIB_REDIST_URL "http://new.tk/NDIRedistV3"
#endif
#endif
#endif
#else

Most importantly, like Decklink's SDK, this clause makes the SDK nonfree, so FFmpeg compiled with it will never be legally redistributable:

d. Unless otherwise stated in the SDK, no files within the SDK and the Specific SDK may be distributed.


Threads referenced:
https://ffmpeg.zeranoe.com/forum/viewtopic.php?f=42&t=5424&view=unread&sid=b98cd1b84772525805f0753a824cd935
https://github.com/jb-alvarado/media-autobuild_suite/issues/721

ACross
02-14-2018, 08:50 AM
I think that there must be some confusion here, the wording "Unless otherwise stated in the SDK, no files within the SDK and the Specific SDK may be distributed." is entirely correct and is there for the specific purpose of allowing people to use the SDK in open source projects (indeed this approach was suggested to us by the author of another large open source project). We have placed all our header files under the MIT license so that it may be freely used in open source projects; we have also made dynamic linking possible for the exact same reason. This means that it is possible to build without any download from NewTek; this is an identical approach to that followed by nVEnc, etc... all of which are included in ffmpeg builds.

magdesign
08-21-2018, 03:54 AM
Where do I find information about how to compile FFMEG with NDI*support enabled?

Using Linux with FFMPEG*3.4, Installed NDI SDK 3.5, when trying to run ffmpeg to show a NDI source, I get:*
Unknown input format: libndi_newtek
Failed to set value 'libndi_newtek' for option 'f': Invalid argument

lukerctv
10-16-2018, 04:32 PM
Any update on this, or anything from NewTek about a better distribution method for their libraries?

Edit: Better yet, a pre-compiled ffmpeg for macos. PLEASE.

kanep
10-16-2018, 07:18 PM
There is a complied Windows version of FFMPEG with NDI support include with thed NDI SDK. Just sign up.

https://www.newtek.com/ndi/sdk/

lukerctv
10-17-2018, 08:57 AM
Yeah but Windows sucks...

lucimur
10-17-2018, 11:58 AM
There is a complied Windows version of FFMPEG with NDI support include with thed NDI SDK. Just sign up.

https://www.newtek.com/ndi/sdk/

Any chance that we can get this version of FFMPEG with nvenc support? The libx264 support included is not up to handling HD video streams.

Thanks