FFmpeg Plugin — Media Communications Mesh#
FFmpeg plugin is the software extension of FFmpeg, a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams.
The plugin adds video and audio muxers and demuxers that support sending and receiving media streams via Media Communications Mesh. It uses SDK API to establish and manage connections to the Mesh.
Build and install steps#
Install Media Communications Mesh. See Setup Guide for detailed process.
Clone the FFmpeg repository and apply patches.
By default, FFmpeg Release 7.0 is installed. For FFmpeg Release 6.1, replace
7.0
with6.1
in the following script../clone-and-patch-ffmpeg.sh
Run the FFmpeg configuration tool
./configure-ffmpeg.sh
Build and install FFmpeg with the Media Communications Mesh FFmpeg plugin
./build-ffmpeg.sh
Executable file name: ffmpeg
FFmpeg with the plugin should be running in privileged mode.
Muxers and Demuxers#
Video stream Muxer/Demuxer
-f mcm
Audio stream Muxer/Demuxer
-f mcm_audio_pcm16
Audio format PCM 16-bit
Command line arguments
Audio stream Muxer/Demuxer
-f mcm_audio_pcm24
Audio format PCM 24-bit
Command line arguments
Media Proxy SDK API address configuration#
Refer to the SDK API Definition for the options of configuring the Media Proxy SDK API address.
Command line arguments#
General parameters#
Argument |
Description |
Example |
---|---|---|
|
Connection type, |
|
|
Connection creation delay in milliseconds, 0..10000. Default 0. |
|
|
Buffer queue capacity, 2, 4, 8, 16, 32, 64, or 128. Default: 8 for video, 16 for audio. |
|
SMPTE ST 2110 connection parameters (-conn_type st2110
)#
Argument |
Description |
Example |
---|---|---|
|
Tx connection: destination IP address. |
|
|
Tx connection: destination port number. |
|
|
Rx connection only: optional multicast source filter IP address. |
— |
|
Only for Video Muxer/Demuxer: SMPTE ST 2110-2x transport type, |
|
|
SMPTE ST 2110 payload type, typically between 96..127. |
|
|
Required only for the |
|
Multipoint Group connection parameters (-conn_type multipoint-group
)#
Argument |
Description |
Example |
---|---|---|
|
Multipoint group Uniform Resource Name, or URN. Default “192.168.97.1” |
|
Video payload parameters#
Argument |
Description |
Example |
---|---|---|
|
Video frame size, |
|
|
Video pixel format, |
|
|
Video frame rate, 25, 50, 59.94, 60, etc. Default 25. |
|
Audio payload parameters#
Argument |
Description |
Example |
---|---|---|
|
Number of audio channels, 1, 2, etc. Default: 2. |
|
|
Audio sample rate, 48000 or 96000. Default 48000. |
|
|
Audio packet time according to SMPTE ST 2110-30. Default “1ms”. |
|
Example – Run video transmission#
This example demonstrates sending a video file from the 1st FFmpeg instance to the 2nd FFmpeg instance via Media Communications Mesh, then streaming it to a remote machine via UDP.
Run Mesh Agent#
mesh-agent
Receiver side setup#
Start Media Proxy
sudo media_proxy \ -d 0000:32:01.1 \ -i 192.168.96.11 \ -r 192.168.97.11 \ -p 9200-9299 \ -t 8002
Start FFmpeg to receive frames from Media Communications Mesh and stream them to a remote machine via UDP
sudo MCM_MEDIA_PROXY_PORT=8002 ffmpeg -f mcm \ -conn_type st2110 \ -transport st2110-20 \ -ip_addr 192.168.96.10 \ -port 9001 \ -frame_rate 60 \ -video_size 1920x1080 \ -pixel_format yuv422p10le \ -i - -vcodec mpeg4 -f mpegts udp://<remote-ip>:<remote-port>
Sender side setup#
Start Media Proxy
sudo media_proxy \ -d 0000:32:01.0 \ -i 192.168.96.10 \ -r 192.168.97.10 \ -p 9100-9199 \ -t 8001
Start FFmpeg to stream a video file to the receiver via Media Communications Mesh
sudo MCM_MEDIA_PROXY_PORT=8001 ffmpeg -i <video-file-path> -f mcm \ -conn_type st2110 \ -transport st2110-20 \ -ip_addr 192.168.96.11 \ -port 9001 \ -frame_rate 60 \ -video_size 1920x1080 \ -pixel_format yuv422p10le -
When sending a raw video file that lack metadata, you must explicitly provide FFmpeg with the necessary video frame details. This includes specifying the format
-f rawvideo
, pixel format-pix_fmt
, and resolution-s WxH
. Example:ffmpeg -f rawvideo -pix_fmt yuv422p10le -s 1920x1080 -i <video-file-path> ...
VLC player setup#
On the remote machine start the VLC player and open a network stream from the following URL:
udp://@:1234
Example – Run audio transmission, PCM 24-bit#
This example demonstrates sending a PCM 24-bit encoded audio file from the 1st FFmpeg instance to the 2nd FFmpeg instance via Media Communications Mesh.
Run Mesh Agent#
mesh-agent
Receiver side setup#
Start Media Proxy
sudo media_proxy \ -d 0000:32:01.1 \ -i 192.168.96.11 \ -r 192.168.97.11 \ -p 9200-9299 \ -t 8002
Start FFmpeg to receive packets from Media Communications Mesh and store on the disk
sudo MCM_MEDIA_PROXY_PORT=8002 ffmpeg -f mcm_audio_pcm24 \ -conn_type st2110 \ -ip_addr 192.168.96.10 \ -port 9001 \ -channels 2 \ -sample_rate 48000 \ -ptime 1ms \ -i - output.wav
Sender side setup#
Start Media Proxy
sudo media_proxy \ -d 0000:32:01.0 \ -i 192.168.96.10 \ -r 192.168.97.10 \ -p 9100-9199 \ -t 8001
Start FFmpeg to stream an audio file to the receiver via Media Communications Mesh
sudo MCM_MEDIA_PROXY_PORT=8001 ffmpeg -i <audio-file-path> -f mcm_audio_pcm24 \ -conn_type st2110 \ -ip_addr 192.168.96.11 \ -port 9001 \ -channels 2 \ -sample_rate 48000 \ -ptime 1ms -