Skip to content

axflow/meetingsdk-linux-raw-recording-sample

 
 

Repository files navigation

Documentation for Axflow Fork

This fork followed the original Getting Started guide below to prepare this sample project so it can record raw video and audio. Namely,

  1. Download the Linux Meeting SDK.
  2. Copy relevant SDK files to demo/lib.
  3. Create a Node script in token to generate required JWT.
  4. Create demo/config.txt to store configuration.
  5. Modify demo/ZoomSDKRenderer.cpp so the app unconditionally records videos.

Meeting SDK

The SDK downloaded from marketplace.zoom.us and used here is sdk/zoom-meeting-sdk-linux_x86_64-6.0.2.4740.tar.xz.

If you want to try a newer SDK,

  1. Pull the latest changes from the original repository at https://github.com/zoom/meetingsdk-linux-raw-recording-sample.
  2. Put a copy of the newer SDK in sdk.
  3. Redo step 1 of Getting Started.

Configuration

You need to create App Credentials once by following instructions in https://developers.zoom.us/docs/meeting-sdk/developer-accounts/#get-meeting-sdk-credentials.

  1. Client ID
  2. Client Secret

For every Zoom session you wish to record, you must generate these configurations and save them to demo/config.txt.

Key Value
meeting_number Zoom Meeting ID
meeting_password Zoom Meeting Secret
token JWT Access Token

meeting_number & meeting_password

  1. Start a Zoom meeting or join a meeting as a host.
  2. Follow instructions to Copy Invitation text in https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0063688#h_01GPFEENFS345TVTRGK9ECVX7Q
  3. Paste your clipboard somewhere.
  4. Put the Meeting ID as meeting_number in demo/config.txt as a string.
  5. Put the Passcode as meeting_password in demo/config.txt as a string.

token

The access token is generated by the Node script in token (taken from https://developers.zoom.us/docs/meeting-sdk/auth/#sample-code).

  1. Install Node dependencies.
npm ci --prefix token
  1. Open token/index.js.
  2. Replace "REPLACE_WITH_CLIENT_ID" with the App Credentials Client ID as a string.
  3. Replace "REPLACE_WITH_CLIENT_SECRET" with the App Credentials Client Secret as a string.
  4. Replace REPLACE_WITH_MEETING_ID with meeting_number as an integer. NOTE: Here this value is a number, not a string.
  5. Run node token/index.js.
  6. Put the generated output as token in demo/config.txt as a string.

How to Capture Raw Video & Audio

  1. You should already be in a Zoom meeting as a host after preparing the configurations above.
  2. Build the sample app by running (from repository’s root)
docker build --tag msdk-5.17.11-on-ubuntu-compact --file Dockerfile-Ubuntu/Dockerfile
  1. Make a share directory to share files between container and host through bind mount.
  2. Run the sample app.
docker run --interactive --tty --mount type=bind,source=$(pwd)/share,target=/app/demo/share msdk-5.17.11-on-ubuntu-compact
  1. A bot named LinuxChan should join your Zoom meeting.
  2. To start recording, open the Zoom meeting and assign recording privileges to LinuxChan or make it a co-host.
  3. You should see a lot of logs showing video and audio getting successfully captured.
  4. Stop the recording by removing recording privileges or press Ctrl + C to terminate the sample app.
  5. Within the container, you should find raw video captured in /app/demo/bin/output.yuv and raw audio in audio.pcm.
  6. Copy these files to the host.
cp /app/demo/bin/output.yuv /app/demo/share/output.yuv
cp /app/demo/bin/audio.pcm /app/demo/share/audio.pcm

Convert Raw Video to MP4

Raw video is captured in YUV format (unfortunately documentation does not get more specific than that).

To convert it to MP4 using ffmpeg (version 6.1.1), run

ffmpeg -f rawvideo -pix_fmt yuv420p -video_size "640*360" -framerate 25 -i output.yuv -f mp4 output.mp4

"640*360" is the frame size and could be different depending on the final frame size negotiated between the sample app and Zoom’s servers. Scan the logs to determine the actual frame size captured.

Convert Raw Audio to WAV

Raw audio is capture in PCM format (as with video, documentation does not get more specific).

To convert it to WAV using ffmpeg (version 6.1.1), run

ffmpeg -f s16le -ar 32k -ac 1 -i audio.pcm audio.wav

Source Code Changes

Only ZoomSDKRenderer.app is modified in this way.

-if (data->GetStreamHeight() == 720) {
+// if (data->GetStreamHeight() == 720) {
SaveToRawYUVFile(data);
-}
+// }

For some reason, the original sample app only saves video if the video frame is exactly 720 pixels high. My captured frames were 360 pixels high regardless of how I change hard-coded variables so this change is required.

Zoom Meeting SDK Linux Sample App

The is a sample app for Zoom Meeting SDK Linux. It demonstrates access to raw audio and raw video in a headless docker environment.

Prerequistes

  1. Zoom Account
  2. Zoom Meeting SDK App Type
  3. Authentication token signed by
    1. Client ID
    2. Client Secret
  4. Meeting Recording Token (Optional)
  5. Docker environment
  6. Linux or Windows with WSL environment.
  7. VS Code or Visual Studio ======================================================================

Getting Started

Download Linux Meeting SDK from marketplace.zoom.us

1 Please decompress the downloaded zoom-meeting-sdk-linux_x86_64-5.xx.x.xxxx.tar and copy the files in the decompressed folder to these sample-app folders

  • h to demo/include/h
  • qt_libs to demo/lib/zoom_meeting_sdk/qt_libs
  • all the lib******.so files to demo/lib/zoom_meeting_sdk/lib******.so
  • copy translation.json to demo/lib/zoom_meeting_sdk/json
  • softlink libmeetingsdk.so to libmeetingsdk.so.1 within demo/lib/zoom_meeting_sdk/ . You can use the command ln -s libmeetingsdk.so libmeetingsdk.so.1 to do so.

2 Execute cmake -B build in demo/ folder . After successful cmake, the demo/build/ folder will be generated.

3 Execute make in the /demo/build/ directory to compile

Notes for using the demo:

  1. The sdk auth token, password, meeting number etc.. needs to be written in the config.txt file. The recording_token when entered, will allow you to recording with additional actions from host.

GetVideoRawData, GetAudioRawData, SendVideoRawData, SendAudioRawData are boolean control variables. You can search for them in the sample code to understand the flow.

Disclaimer

Please be aware that all hard-coded variables and constants shown in the documentation and in the demo, such as Zoom Token, Zoom Access, Token, etc., are ONLY FOR DEMO AND TESTING PURPOSES. We STRONGLY DISCOURAGE the way of HARDCODING any Zoom Credentials (username, password, API Keys & secrets, SDK keys & secrets, etc.) or any Personal Identifiable Information (PII) inside your application. WE DON’T MAKE ANY COMMITMENTS ABOUT ANY LOSS CAUSED BY HARD-CODING CREDENTIALS OR SENSITIVE INFORMATION INSIDE YOUR APP WHEN DEVELOPING WITH OUR SDK.


meeting_number: "1234567890"
token: "xxxxxxxx.yyyyyyyyyyyyyyyyyy.zzzzzzzzzzzzzzzzz"
meeting_password: "123456"
recording_token: ""
GetVideoRawData: "true"
GetAudioRawData: "true"
SendVideoRawData: "false"
SendAudioRawData: "false"

  1. You need to fill in withoutloginParam.userName = ""; in meeting_sdk_demo.cpp. meeting_sdk_demo.cpp is the starting point of the demo app.
  2. Once init sdk and auth sdk are successfully executed, only then you can join and leave meeting.
  3. Once you have successfully joined a meeting, subscribing to raw audio and raw video requires either
    1. either host/co-host/local-recording rights or
    2. meeting recording token
  4. You will need a file named ~\.config.us\zoomus.conf before you can access raw audio in an environment without soundcard, such as docker and WSL environment. The sample zoomus.conf file is generated in the setup-pulseaudio.sh files
  5. For Sending Raw Audio and Raw Video, there are 2 methods (turnOnSendVideoAndAudio and turnOnSendVideoAndAudio) which you will need to call

CMakeLists.txt

If you have additional cpp and/or .h files, you might need to be included in this CMakeLists.txt

add_executable(meetingSDKDemo 
              ${CMAKE_SOURCE_DIR}/meeting_sdk_demo.cpp
              ${CMAKE_SOURCE_DIR}/init_auth_sdk_workflow.cpp
              ${CMAKE_SOURCE_DIR}/meeting_sdk_util.cpp
              ${CMAKE_SOURCE_DIR}/init_auth_sdk_workflow.h
              ${CMAKE_SOURCE_DIR}/meeting_sdk_util.h
              ${CMAKE_SOURCE_DIR}/RegressionTestRawdataRender.cpp
              ${CMAKE_SOURCE_DIR}/RegressionTestRawdataRender.h
              ${CMAKE_SOURCE_DIR}/custom_ui_eventSink.h
              ${CMAKE_SOURCE_DIR}/custom_ui_eventSink.cpp
              ${CMAKE_SOURCE_DIR}/MeetingReminderEventListener.h
              ${CMAKE_SOURCE_DIR}/MeetingReminderEventListener.cpp
              )

Similarly for libraries

target_link_libraries(meetingSDKDemo gcc_s gcc)
target_link_libraries(meetingSDKDemo meetingsdk)
target_link_libraries(meetingSDKDemo glib-2.0)
target_link_libraries(meetingSDKDemo pthread)

Docker

The sample app has been tested on Centos 8, Centos 9, Ubuntu 22 and Ubuntu 23. Here are some dependencies you will need to include.

Centos

This is tested on WSL and Docker centos 9 and Centos 8 Here are some dependencies to get it to run on Centos. Some packages might be redundant, and has not been optimized.

Install files for compiling

sudo yum install cmake
sudo yum install gcc gcc-c++

Enable the CodeReady Linux Builder repository

sudo dnf config-manager --set-enabled crb

Install the EPEL RPM.

sudo dnf install epel-release epel-next-release

CURL related dependencies

yum install -y openssl-devel
yum install -y libcurl-devel 

Install Pulseaudio

yum install -y  pulseaudio pulseaudio-utils 

If you encounter: Fatal error: SDL2/SDL.h: No such file or directory. This is no longer in used at code level, but leaving this here for legacy support purposes

sudo yum -y install SDL2-devel

If you encounter these error Messages

#/usr/bin/ld: warning: libxcb-image.so.0, needed by /root/release_demo/demo/libmeetingsdk.so, not found (try using -rpath or -rpath-link) #/usr/bin/ld: warning: libxcb-keysyms.so.1, needed by /root/release_demo/demo/libmeetingsdk.so, not found (try using -rpath or -rpath-link)

sudo yum install libxcb-devel
sudo yum install xcb-util-devel
sudo yum install xcb-util-image
sudo yum install xcb-util-keysyms

If you encounter these runtime runtime error

#libGL error: MESA-LOADER: failed to open swrast: /usr/lib64/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib64/dri, suffix _dri)

sudo yum install mesa-libGL
sudo yum install mesa-libGL-devel
sudo yum install mesa-dri-drivers

==============================================================

Ubuntu

This is tested on WSL and Docker Ubuntu 22 and 23 Here are some dependencies to get it to run on Ubuntu. Some packages might be redundant, and has not been optimized.

Install necessary dependencies

apt-get update && apt-get install -y build-essential cmake

apt-get install -y --no-install-recommends --no-install-suggests \
    libx11-xcb1 \
    libxcb-xfixes0 \
    libxcb-shape0 \
    libxcb-shm0 \
    libxcb-randr0 \
    libxcb-randr0 \
    libxcb-image0 \
    libxcb-keysyms1 \
    libxcb-xtest0 

optional libraries

apt-get install -y --no-install-recommends --no-install-suggests \
    libdbus-1-3 \
    libglib2.0-0 \
    libgbm1 \
    libxfixes3 \
    libgl1 \
    libdrm2 \
    libgssapi-krb5-2 

CURL related dependencies

apt-get install libcurl4-openssl-dev \
    openssl \
    ca-certificates \
    pkg-config 

Install Pulseaudio

apt-get install -y  pulseaudio pulseaudio-utils 

if you are getting error about <SDL2/SDL.h>

apt-get install libegl-mesa0 libsdl2-dev g++-multilib

Addition requirement for raw audio data in docker / headless environment with no soundcard

Additional file in ~/.config/zoomus.conf

[General] system.audio.type=default

Dockerfiles

Dockerfile targetting different distros are provided in this sample app as well (Dockerfile-centos, Dockerfile-Ubuntu .....) Currently this is tested on

  • Centos 9 (functionality where custom function of fetching JWT Token from Web Service does not work, main SDK function works fully)
  • Centos 8
  • Ubuntu 22

Run these in /demo directory

Centos 8

docker build -t msdk-5.17.11-on-centos8-compact -f Dockerfile-Centos8/Dockerfile . docker run -it --rm msdk-5.17.11-on-centos8-compact

Centos 9

docker build -t msdk-5.17.11-on-centos9-compact -f Dockerfile-Centos9/Dockerfile . docker run -it --rm msdk-5.17.11-on-centos9-compact

Ubuntu 22

docker build -t msdk-5.17.11-on-ubuntu-compact -f Dockerfile-Ubuntu/Dockerfile . docker run -it --rm msdk-5.17.11-on-ubuntu-compact

Pulseaudio

The configuration for pulseaudio has been provided for you as shell scripts.

The setup is done via setup-pulseaudio.sh and setup-pulssaudio-centos.sh, this need to be run prior to running this project in a docker environment.

The script

  • starts the pulseaudio service,
  • creates a virtual speaker,
  • a virtual microphone, and
  • add a zoomus.conf file in the docker environment.

Need help?

If you're looking for help, try Developer Support or our Developer Forum. Priority support is also available with Premier Developer Support plans.

Documentation

Make sure to review our documentation as a reference when building your Zoom Apps.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 86.1%
  • JavaScript 13.9%