From d59611aece3888dda09b912ace8e7042fd64c8cb Mon Sep 17 00:00:00 2001 From: Konstantin Ilichev Date: Tue, 27 Aug 2024 23:13:32 +0000 Subject: [PATCH] Add documentation fof MCM FFmpeg audio plugin This commit adds description of how to configure and run an audio transmission via MCM FFmpeg plugin. Argument lists are provided for MCM connection, video, and audio configurations. Signed-off-by: Konstantin Ilichev --- ffmpeg-plugin/README.md | 144 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 136 insertions(+), 8 deletions(-) diff --git a/ffmpeg-plugin/README.md b/ffmpeg-plugin/README.md index 9d7e5c63..368ec882 100644 --- a/ffmpeg-plugin/README.md +++ b/ffmpeg-plugin/README.md @@ -26,12 +26,32 @@ Install dependencies and build MCM as described in the top level README.md, para ./build-ffmpeg.sh ``` -## Arguments -TBD +## MCM connection configuration + +The next arguments are supported to configure a connection to MCM + +| Argument | Type | Description | Default | +| --------------- | :-----: | -------------------------------------------------------- | :--------------: | +| `ip_addr` | String | Remote IP address | `"192.168.96.1"` | +| `port` | String | Remote port (Sender), or Local port (Receiver) | `"9001"` | +| `protocol_type` | String | MCM Protocol type (`"auto"`, `"memif"`, etc.) | `"auto"` | +| `payload_type` | String | ST2110 payload type (`"st20"`, `"st22"`, `"st30"`, etc.) | `"st20"` | +| `socket_name` | String | Memif socket name | - | +| `interface_id` | Integer | Memif interface id | `0` | + +## Video configuration + +The next arguments are supported to configure a video transmission + +| Argument | Type | Description | Default | +| -------------- | :----: | ----------------------------------------------- | :-------------: | +| `video_size` | String | Video frame size (`"640x480"`, `"hd720"`, etc.) | `1920x1080` | +| `pixel_format` | String | Video pixel format | `"yuv422p10le"` | +| `frame_rate` | String | Video frame rate (`25`, `50`, `60`, etc.) | `25` | -## Run +## Example – Run video transmission -This test run demonstrates sending a video file from the 1st FFmpeg instance to the 2nd FFmpeg instance via MCM and then stream it to a remote machine via UDP. +This example demonstrates sending a video file from the 1st FFmpeg instance to the 2nd FFmpeg instance via MCM and then stream it to a remote machine via UDP. ### NIC setup @@ -46,8 +66,13 @@ TBD 2. Start FFmpeg to receive frames from MCM and stream to a remote machine via UDP ```bash sudo MCM_MEDIA_PROXY_PORT=8002 ffmpeg -re -f mcm \ - -frame_rate 24 -video_size nhd -pixel_format yuv422p10le -protocol_type auto \ - -payload_type st20 -ip_addr 192.168.96.1 -port 9001 \ + -frame_rate 24 \ + -video_size nhd \ + -pixel_format yuv422p10le \ + -protocol_type auto \ + -payload_type st20 \ + -ip_addr 192.168.96.1 \ + -port 9001 \ -i - -vcodec mpeg4 -f mpegts udp://: ``` @@ -60,8 +85,13 @@ TBD 2. Start FFmpeg to stream a video file to the receiver via MCM ```bash sudo MCM_MEDIA_PROXY_PORT=8001 ffmpeg -i -f mcm \ - -frame_rate 24 -video_size nhd -pixel_format yuv422p10le -protocol_type auto \ - -payload_type st20 -ip_addr 192.168.96.2 -port 9001 - + -frame_rate 24 \ + -video_size nhd \ + -pixel_format yuv422p10le \ + -protocol_type auto \ + -payload_type st20 \ + -ip_addr 192.168.96.2 \ + -port 9001 - ``` ### VLC player setup @@ -71,6 +101,104 @@ On the remote machine start the VLC player and open a network stream from the ne udp://@:1234 ``` +## Audio configuration + +The table below shows a proper way to configure the sender and the receiver depending on the audio PCM encoding format + +| Audio encoding | Sender configuration | Receiver configuration | +| --- | --- | --- | +| PCM 24-bit | Output device `mcm_audio` | Input device `mcm_audio` and argument `-pcm_fmt pcm24` +| PCM 16-bit | Output device `mcm_audio_pcm16` | Input device `mcm_audio` and argument `-pcm_fmt pcm16` + +The next arguments are supported to configure an audio transmission + +| Argument | Type | Description | Default | +| ------------- | :-----: | ------------------------------------------------ | :-------: | +| `channels` | Integer | Number of audio channels (`1`, `2`, etc.) | `2` | +| `sample_rate` | Integer | Audio sample rate (`44100`, `48000`, or `96000`) | `48000` | +| `ptime` | String | MTL audio packet time (`"1ms"` or `"125us"`) | `"1ms"` | +| `pcm_fmt` | String | PCM audio format (`"pcm24"` or `"pcm16"`) | `"pcm24"` | + +## Example – Run audio transmission + +This example demonstrates sending an audio file from the 1st FFmpeg instance to the 2nd FFmpeg instance via MCM. + +There are two options of configuration: +* **Option A** for PCM 24-bit encoded audio +* **Option B** for PCM 16-bit encoded audio + +### NIC setup + +TBD + +### Receiver side setup + +1. Start media_proxy + ```bash + sudo media_proxy -d 0000:32:11.1 -i 192.168.96.2 -t 8002 + ``` +2. Start FFmpeg to receive packets from MCM and store on the disk + + **Option A – PCM 24-bit audio** + ```bash + sudo MCM_MEDIA_PROXY_PORT=8002 ffmpeg -re -f mcm_audio \ + -channels 2 \ + -sample_rate 48000 \ + -ptime 1ms \ + -pcm_fmt pcm24 \ + -protocol_type auto \ + -payload_type st30 \ + -ip_addr 192.168.96.1 \ + -port 9001 \ + -i output.wav + ``` + + **Option B – PCM 16-bit audio** + ```bash + sudo MCM_MEDIA_PROXY_PORT=8002 ffmpeg -re -f mcm_audio \ + -channels 2 \ + -sample_rate 48000 \ + -ptime 1ms \ + -pcm_fmt pcm16 \ + -protocol_type auto \ + -payload_type st30 \ + -ip_addr 192.168.96.1 \ + -port 9001 \ + -i output.wav + ``` + +### Sender side setup + +1. Start media_proxy + ```bash + sudo media_proxy -d 0000:32:11.0 -i 192.168.96.1 -t 8001 + ``` +2. Start FFmpeg to stream an audio file to the receiver via MCM + + **Option A – PCM 24-bit audio** + ```bash + sudo MCM_MEDIA_PROXY_PORT=8001 ffmpeg -i -f mcm_audio \ + -channels 2 \ + -sample_rate 48000 \ + -ptime 1ms \ + -protocol_type auto \ + -payload_type st30 \ + -ip_addr 192.168.96.2 \ + -port 9001 - + ``` + + **Option B – PCM 16-bit audio** + ```bash + sudo MCM_MEDIA_PROXY_PORT=8001 ffmpeg -i -f mcm_audio_pcm16 \ + -channels 2 \ + -sample_rate 48000 \ + -ptime 1ms \ + -protocol_type auto \ + -payload_type st30 \ + -ip_addr 192.168.96.2 \ + -port 9001 - + ``` + ## Known Issues ### Shared libraries error: