2008 CM4 HDMI IN mini EN

来自Mcuzone Wiki

切换语言为中文

Keywords

Raspberry Pi, CM4 Core board, RPiOS, Video Capture, HDMI, RTMP Streaming, Live Stream

I. Introduction

The CM4 HDMI Video Capture Card is designed based on the Raspberry Pi CM4 core board, offering a cost-effective solution for users with video capture needs. It supports all versions of the Raspberry Pi CM4 core board.

Over the past few years, the live streaming and online course markets have flourished, with both applications requiring high-definition streaming and video recording.

Some online courses and videos can only be viewed online, in which case recording devices can be used for transcription. Traditional PC solutions or capture card setups, while powerful, come with high costs and significant power consumption. To meet the mainstream market demand for 1080P resolution, we have launched a video capture card product based on the Raspberry Pi platform. It captures video signals via an onboard USB video capture chip, then uses the Raspberry Pi for encoding and storage. This solution enables real-time 1080P 30fps video preview as well as 1080P 30fps video capture and saving. Works with various USB-C/Lightning to HDMI converter cables to capture video resources from any platform.

For live streaming, in certain scenarios such as nighttime broadcasts and high-definition streaming, professional DSLRs/mirrorless cameras are often used as the signal source. In such cases, a conversion device is required to transmit the high-definition HDMI output from the professional DSLR/mirrorless camera for streaming. Our CM4_HDMI_IN video capture device can stream the input HDMI signal.

For the video recording function, we use VLC and Guvcview.

For the live streaming feature, we use the OBS streaming software.

Note: Live streaming involves platform accounts, and customers are required to register and apply for these themselves. Our company does not provide technical support for this matter.

II. Hardware Spec

1) Power Supply: 5V3A USB Type-C port (also serves as the flashing port for flashing the eMMC-equipped CM4 core board).

2) 1*Gigabit Ethernet port.

3) 1*standard HDMI output, supports 4K resolution.

4) 1*standard HDMI input, supports 1080p resolution.

5) 1*Record button.

6) 3*USB 2.0 Host ports, including 2*USB-A ports and 1*1.25mm-4PIN port.

7) 1*TF card slot, only used for flashing Raspberry Pi CM4 core boards without eMMC.

8) 1*BOOT jumper for flashing the Raspberry Pi CM4 core board with eMMC.

9) 1*3.3V fan power connector, 2.54mm-2P.

10) Lead out 40-pin GPIO headers, fully compatible with Raspberry Pi 4B's 40-pin GPIO.

11) Size: 85*70mm, the board material is UL-certified and RoHS-compliant, with a flammability rating of 94V-0.

12) Full aluminum alloy casing.

III. Flash OS

We use the Raspberry Pi OS, the system version is 2024-10-22-raspios-bookworm-arm64.img.xz

You can download it in:

https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit

For the core board with eMMC, the OS is flashed onto the eMMC. If the core board does not have eMMC, the OS is flashed onto the TF card.

Using a core board with eMMC, perform the following hardware operations: Short the BOOT pin on the expansion board with a jumper cap and connect the USB-C port to a computer.

2008_CM4_HDMI_IN_mini_48.jpg

After the flashing process is completed, remove the jumper cap and power on again to start the OS.

For the flashing method, please refer to:

How to flash OS

IV. Video Capture with Raspberry Pi OS

4.1 Preparation

Execute lsusb in the terminal and verify that the video device (highlighted in red) is detected:

2008_CM4_HDMI_IN_mini_09.jpg

Execute ls /dev/video* and confirm that /dev/video0 is listed:

2008_CM4_HDMI_IN_mini_10.jpg

With the video0 device in place, we can proceed with the subsequent operations of video capture and live streaming.

The video capture card has two HDMI interfaces. The HDMI IN port is the video input port, connect video input source (capture source). The HDMI OUT port is the video output port, connect to a monitor and display the OA running on the CM4.

4.2 Use VLC for video capture

The Raspberry Pi OS has VLC pre-installed by default. You can find the VLC under "Raspberry Pi logo in the top-left corner - Sound & Video":

Click icon to open the software:

2008_CM4_HDMI_IN_mini_11.jpg

Click "Tools - Preferences", then go to the Video tab and set the Output under Display to "OpenGL for Embedded Systems 2 video output":

After saving, you can view the input source.

Click "Media - Open Capture Device...", then in the Capture Device tab, configure the audio and video devices as shown in the image below:

2008_CM4_HDMI_IN_mini_13.jpg

Once configured, click the "Play" button to see the live feed from the input source:

2008_CM4_HDMI_IN_mini_14.jpg

If you need to capture video, after completing the settings in the Capture Device tab, click the arrow next to the "Play" button, then click "Convert":

2008_CM4_HDMI_IN_mini_15.jpg

In the pop-up window, under "Settings" > "Profile", it is recommended to select "Video - H.264 + MP3 (MP4)," though you can also choose other video formats based on your needs:

2008_CM4_HDMI_IN_mini_16.jpg

Then click "Browse", choose the destination folder for the captured video, and click "Save":

Click "Start" to begin video capture:

2008_CM4_HDMI_IN_mini_18.jpg

Note: Input source image cannot be viewed while capturing video.

We recorded a 3m57s video, with the specific video parameters as follows:

4.3 Use Guvcview for video capture

The Guvcview needs to be installed. Enter the following execute the Raspberry Pi terminal:

sudo apt install guvcview

After installation, you can find the Guvcview under the "Raspberry Pi logo in the top-left corner - Sound & Video." Click to open the software, which by default uses /dev/video0 as the input source and directly displays the image from the input source:

2008_CM4_HDMI_IN_mini_08.jpg

Click on the "Video Controls" tab to configure various video parameters, with the maximum resolution supported being 1920*1080:

2008_CM4_HDMI_IN_mini_22.jpg

In the "Audio Controls" tab, you can configure various audio parameters:

2008_CM4_HDMI_IN_mini_23.jpg

After completing the settings, click the "Cap. Video" button in the button bar to capture the video, while the video window can still continue to display the images from the input source.

The software automatically saves the video in the home directory. Once recording is done, click "Stop Video" and wait briefly (until it changes to "Cap. Video") for the save to complete:

2008_CM4_HDMI_IN_mini_24.jpg

We recorded a 4m12s video, with the specific video parameters as follows:

V. Live video streaming on Raspberry Pi OS

5.1 Install the video streaming software OBS

5.1.1 Install OBS

We use OBS as the video streaming software. The installation command is:

sudo apt update

sudo apt install libfdk-aac2 libfdk-aac-dev

sudo apt install obs-studio

After installation, directly clicking the icon to launch OBS will result in a graphics card driver error:

2008_CM4_HDMI_IN_mini_27.jpg

We need to execute the following commands in the terminal to launch OBS.

MESA_GL_VERSION_OVERRIDE=3.3 obs

5.1.2 Launch OBS with a script

Obviously, it's very inconvenient to do this every time. We can use a script to launch it directly (the "mcuzone" directory in the following command refers to the user's home directory, please adjust it according to the actual path):

sudo nano /home/mcuzone/obs.sh

Add the following to this file:

MESA_GL_VERSION_OVERRIDE=3.3 obs

Save and exit, then give the file the necessary permissions.

sudo chmod +x /home/mcuzone/obs.sh

So we can start the OBS software by clicking on this obs.sh.

5.1.3 Click the icon to launch OBS

If you want to directly click the icon to launch OBS, please follow the steps below.

Click on "Raspberry Pi icon in the top-left corner of the desktop - Preferences - Main Menu Editor - Sound & Video".

Double-click on "OBS Studio", and in the pop-up window, enter the following in the "Command" box:

/home/mcuzone/obs.sh

2008_CM4_HDMI_IN_mini_28.jpg

Save and exit, then you can launch OBS by clicking the icon.

5.1.4 Start OBS automatically on boot

To enable OBS to launch automatically at OS boot, make the following adjustments:

sudo mkdir /home/mcuzone/.config/autostart

sudo nano /home/mcuzone/.config/autostart/obs.desktop

Add the following content to this obs.desktop file:

[Desktop Entry]

Type=Application

Exec=/home/mcuzone/obs.sh

Save and exit, then restart the OS, and OBS will automatically launch upon entering the desktop.

5.2 Obtain the streaming parameters

5.2.1 Obtain Bilibili streaming parameters

Please refer to the following link:

https://www.bilibili.com/opus/688919050706747398

Please refer only to the first section "b站设置". The OBS setup on the Raspberry Pi will be explained in detail in the next section.

Through the settings, we obtained two parameters: the server address and the streaming key.

5.2.2 Obtain Weibo streaming parameters

Please refer to the following link:

https://weibo.com/l/wblive/act/k2mw80kz3kw0

Through the settings, we obtained two parameters: the server address and the streaming key.

5.3 The streaming settings and video live stream in OBS

5.3.1 Streaming Settings

Launch OBS. Taking a Bilibili live stream as an example, click "File - Settings - Stream", select "Custom..." under "Service", fill in the server address in the "Server" field, and enter the stream key in the "Stream Key" field:

2008_CM4_HDMI_IN_mini_29.jpg

Then click "OK" to complete the setup.

5.3.2 Live stream source settings

Click the "+" under "Sources", then click "Video Capture Device (V4L2)":

2008_CM4_HDMI_IN_mini_30.jpg

Click "OK" directly:

2008_CM4_HDMI_IN_mini_31.jpg

Save after configuring as shown below:

2008_CM4_HDMI_IN_mini_32.jpg

Click the "+" under "Sources", then click "Audio Input Capture (PulseAudio)":

2008_CM4_HDMI_IN_mini_33.jpg

Click "OK" directly:

2008_CM4_HDMI_IN_mini_34.jpg

Save after configuring as shown below:

2008_CM4_HDMI_IN_mini_35.jpg

After the setup is complete, we can see the live stream image and audio volume levels on the main interface:

2008_CM4_HDMI_IN_mini_36.jpg

5.3.3 Start streaming

Click "Start Streaming" under "Controls" to begin the livestream. Taking Bilibili as an example, we can watch the livestream through the streaming URL provided by Bilibili.

2008_CM4_HDMI_IN_mini_37.jpg

2008_CM4_HDMI_IN_mini_38.jpg

If you need to record live video on the Raspberry Pi side, you can click "Start Recording" under "Controls" to begin recording. The video window will continue to display the input source's image during the process. Once recording finishes, the software will save the video in the main directory.

We recorded a 1m49s video, with the specific video parameters as follows:

Contact Us

0001_x.jpg 0002_fb.jpg 0004_ytb.jpg 0003_bb.jpg 0005_qq.jpg QQ:8204136

Email: mcuzone@vip.qq.com

Tel: +86(0)13957118045

If there are any omissions, errors, or infringements on this page, please contact us through the above methods. Thank you!

Copyright 2004-2025 Wildchip