Skip to content

Compiling FFmpeg with NDI support on Mac OS

Notifications You must be signed in to change notification settings

thpryrchn/macos-FFmpegNDI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 

Repository files navigation

Because of the NewTek NDI® SDK license agreement, we cannot distribute the SDK with FFmpeg directly. Here I've tried to make compiling it as simple as possible and then use this version to build a point2point NDI link over the Internet.

The theory is that if you can get NDI into and out of FFmpeg, FFmpeg has a documented point2point streaming documented on their site.

Step 1 - Getting the SDK

Register and request the NewTek NDI® Software Developer Kit download link from https://www.newtek.com/ndi/sdk/#download-sdk and then download the MacOS version and install it. It dumps itself in the root of the drive, which I'm not happy about, but what can we do?

Step 2 - Build environment

Install build tools using Brew. If you are not using brew or want to compile the dependencies as well, please see the page on the FFmpeg site for details.

brew install automake git nasm shtool texi2html theora wget \
    fdk-aac lame opus sdl x264 x265 pkg-config xvid \
    libass libtool libvorbis libvpx

Step 3 - Link into NewTek NDI® SDK

Symbolic links to resolve locations:

sudo ln -s Library/NewTek\ NDI\ SDK/ NDI
sudo ln -s /usr/local/lib/libndi.4.dylib /usr/local/lib/libndi.dylib

Step 4 - Build FFmpeg

Here I give Three options. The first is with most of the FFmpeg options enabled. This results in a much bigger build, but also much better support.

Option 1 - Have Homebrew make FFmpeg with all options!

brew tap thpryrchn/ffmpeg
brew install chromaprint
brew install amiaopensource/amiaos/decklinksdk
brew uninstall --force --ignore-dependencies ffmpeg
brew install thpryrchn/ffmpeg/ffmpeg $(brew options thpryrchn/ffmpeg/ffmpeg | grep -vE '\s' | grep -- '--with-' | tr '\n' ' ') --head

Option 2 - FFmpeg large build

Clone FFmpeg repo from there GIT repo.

git clone https://github.com/thpryrchn/FFmpeg.git ffmpeg
cd ffmpeg

Then,

./configure  --prefix=/usr/local \
  --enable-gpl \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libndi_newtek \
  --enable-libopus \
  --enable-libtheora \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libx265 \
  --enable-libxvid \
  --enable-nonfree \
  --extra-cflags="-I$PWD/ndi/include" \
  --extra-ldflags="-L$PWD/ndi/lib/x64" \
  --extra-libs="-lpthread -lm" \
  --samples=fate-suite/

Option 3 - FFmpeg simple build

./configure --enable-nonfree \
  --enable-gpl \
  --enable-libndi_newtek \
  --enable-libx264 \
  --enable-nonfree \
  --extra-cflags="-I$PWD/ndi/include" \
  --extra-ldflags="-L$PWD/ffmpeg/ndi/lib/x64"
Let it build
make
sudo make install

Quick test

This works on the same machine, from multiple terminals.

./ffmpeg -i ~/Downloads/input.mkv -f libndi_newtek -clock_video true -clock_audio true -pix_fmt uyvy422 "OUTPUT"

./ffmpeg -f libndi_newtek -find_sources 1 -i dummy

./ffplay -f libndi_newtek -i "MACBOOK.LOCAL (OUTPUT)"

TX & RX samples

# TX & RX
./ffmpeg -i ~/Downloads/input.mkv -f mpegts - | ./ffplay -i -

# TX
./ffmpeg -re -i ~/Downloads/input.mkv -f mpegts "udp://192.168.33.159:1234?pkt_size=1316"
# RX
./ffmpeg -i udp://:1234 -f mpegts - | ./ffplay -

# TX
./ffmpeg -f libndi_newtek -i "MACBOOK (OUTPUT)" -f mpegts "udp://192.168.33.159:1234?pkt_size=1316"
# RX
./ffmpeg -i udp://:1234 -f libndi_newtek -clock_video true -clock_audio true -pix_fmt uyvy422 "OUTPUT"

References:

About

Compiling FFmpeg with NDI support on Mac OS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages