Use with Raspberry Pi 4B
Use the Radxa 4K HDMI IN to MIPI CSI-2 Adapter with a Raspberry Pi 4B to capture HDMI video and audio.
- Video is captured through the Raspberry Pi 4B’s 2-lane MIPI CSI-2 interface.
- Audio is captured through the Raspberry Pi 4B’s I2S interface. Connect the I2S signals and enable the overlay’s
audiooption.
These steps are for 64-bit Raspberry Pi OS. Video capture on the Pi 4B was tested with a 6.18 kernel. The RK628 driver also works with PiKVM. See Further reading for the PiKVM installation guide and tested environments.
The adapter accepts HDMI input up to 4K at 30 fps. The Pi 4B uses a 2-lane CSI-2 interface, which limits capture to 2560 × 1440 at 30 fps in this setup. For the first test, set your HDMI source to 1920 × 1080 at 60 fps.
Hardware connections
Shut down the Raspberry Pi and disconnect its power before wiring. You need an HDMI cable, an AC014 opposite-side FPC cable (15 pins and 1.0 mm pitch at each end), and jumper wires for INT, DET, and optional I2S audio.
- Connect the HDMI source to HDMI IN on the adapter.
- Use the AC014 cable to connect the adapter's 15-pin 2-lane CSI port to the
CAMERAconnector on the Pi 4B. Align the exposed contacts at each end with the connector contacts. Insert the cable fully and close both latches. - Connect
INTandDETfrom the adapter's 7-pin header. Use the physical pin numbers on the Pi 4B's 40-pin header.
| Adapter signal | Pi 4B physical pin | BCM GPIO |
|---|---|---|
INT | 11 | GPIO17 |
DET | 22 | GPIO25 |

For additional wiring information, see the RK628 driver hardware instructions.
For audio capture, also connect the pins below. Leave I2S_MCLK unconnected. You can connect GND to any ground pin on the Pi 4B.
| Adapter signal | Pi 4B physical pin | BCM GPIO |
|---|---|---|
I2S_D0 (data out) | 38 | GPIO20 (PCM DIN) |
I2S_LRCK (frame clock) | 35 | GPIO19 |
I2S_SCLK (bit clock) | 12 | GPIO18 |
GND | 39 (example) | Ground |

Install the driver and enable the overlay
Installing from a .deb package is recommended. You can also download the source and run the installation script. Choose either method below, then configure the overlay and reboot.
Install from a .deb package (recommended)
Download the rk628-rpi-dkms package and run the commands below from the download directory. Replace PACKAGE.deb with the downloaded filename. Driver releases
sudo apt update
sudo apt install "linux-headers-$(uname -r)"
sudo apt install ./PACKAGE.deb
Install from source
Install the build tools and kernel headers. Confirm that the last command finds the kernel build Makefile before continuing.
sudo apt update
sudo apt install git ca-certificates build-essential dkms device-tree-compiler \
"linux-headers-$(uname -r)"
ls -l "/lib/modules/$(uname -r)/build/Makefile"
Clone the source and run the installer. For a reproducible installation, check out the desired release tag before running the script.
git clone https://github.com/NujoulDev/rk628-rpi-driver.git
cd rk628-rpi-driver
sudo ./scripts/install.sh
After installation, run dkms status and confirm the RK628 module is installed for the running kernel. Resolve any DKMS build errors before enabling the overlay.
Configure the overlay and reboot
Back up /boot/firmware/config.txt and open it with sudoedit /boot/firmware/config.txt. In the active [all] section, set camera_auto_detect to 0 and use one dtoverlay line based on your wiring.
For video capture only, use the following settings.
camera_auto_detect=0
dtoverlay=rk628-pi4
For video and audio capture, add the audio option.
camera_auto_detect=0
dtoverlay=rk628-pi4,audio
Disable any other overlay that uses the same CSI connector or I2S pins, then run sudo reboot.
Check devices and configure video capture
Install the configuration tools and check that the RK628 devices were created after reboot.
sudo apt update
sudo apt install v4l-utils
ls -l /dev/rk628-*
All three device aliases below should be present. This example shows only the link targets. The target device numbers may differ.
/dev/rk628-media -> media0
/dev/rk628-subdev -> v4l-subdev0
/dev/rk628-video -> video0
| Device path | Purpose |
|---|---|
/dev/rk628-video | Capture video and query HDMI input timings |
/dev/rk628-media | Inspect the capture pipeline; also used by the automatic configuration service |
/dev/rk628-subdev | Query RK628 audio status |
Then check the driver log.
sudo dmesg | grep -i rk628
When the driver loads correctly, the log should contain messages similar to these:
RK628 I2C driver version: 00.01.00
rk628 version is: RK628F/H (20230321)
rk628-csi-v4l2 found @ 0xa0 (rk3x-i2c)
rk628_csi_format_change: New format: 1920x1080p60.00 (2200x1125)
Once all three aliases are present and the log shows that RK628 was detected, choose either video configuration method below. If a device is missing or the log reports errors, check dkms status, config.txt, and the FPC, INT, and DET connections.
Configure manually
Connect and turn on the HDMI source. Check that --query-dv-timings returns valid timings before setting the capture format. This example uses 1920 × 1080. Set the width and height to the reported Active width and Active height for your source.
v4l2-ctl -d /dev/rk628-video --query-dv-timings
v4l2-ctl -d /dev/rk628-video \
--set-fmt-video=width=1920,height=1080,pixelformat=UYVY,field=none
v4l2-ctl -d /dev/rk628-video --get-fmt-video
After switching sources, changing the input resolution, or reconnecting HDMI, stop capture and repeat the timing query and format setup.
Configure automatically with rk628-media-initd (optional)
Follow the media-initd installation guide to install the service. Each time the service starts, it waits for a stable HDMI signal and configures the capture device once. Look for Ready: in the current boot log before starting capture. After switching sources, changing the input resolution, or reconnecting HDMI, stop capture and restart the service.
systemctl status rk628-media-initd.service
sudo journalctl -u rk628-media-initd.service -b
# Restart after an HDMI input change, once capture has stopped.
sudo systemctl restart rk628-media-initd.service
Capture HDMI video
Capture 300 frames to /dev/null and check the reported frame rate and dropped frames. The command should finish normally at a frame rate close to the HDMI input. If it hangs or reports a VIDIOC_STREAMON error, press Ctrl+C, check whether another process is using the capture device, and verify the input timings and capture format.
v4l2-ctl -d /dev/rk628-video \
--stream-mmap=4 --stream-count=300 --stream-to=/dev/null
Run the preview from a terminal on the Pi 4B desktop. Both preview examples use 1920 × 1080 at 60 fps. Adjust width, height, and framerate to match the HDMI input timings.
sudo apt install gstreamer1.0-tools gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good gstreamer1.0-gl
gst-launch-1.0 -e \
v4l2src device=/dev/rk628-video io-mode=dmabuf do-timestamp=true ! \
video/x-raw,format=UYVY,width=1920,height=1080,framerate=60/1 ! \
queue max-size-buffers=2 max-size-bytes=0 max-size-time=0 leaky=downstream ! \
glimagesink sync=true
If V4L2 capture works but the preview is blank or reports a negotiation error, check that you are running it from a local graphical session. Try removing io-mode=dmabuf and adding videoconvert ! before glimagesink.
Record HDMI audio
Confirm that the I2S and ground wires are connected, dtoverlay=rk628-pi4,audio is enabled, and the source is playing sound over HDMI.
sudo apt install alsa-utils
arecord -l
v4l2-ctl -d /dev/rk628-subdev --get-ctrl=audio_sampling_rate,audio_present
arecord -l should list RK628HDMI. When audio_present is 1, use the reported audio_sampling_rate. The example uses 48000 Hz. If the driver reports 44100 Hz, set -r in the recording command and rate in the audio and video preview example to 44100.
arecord -D hw:CARD=RK628HDMI,DEV=0 \
-t wav -f S32_LE -r 48000 -c 2 -d 10 rk628-audio.wav
aplay rk628-audio.wav
If the sound card appears but the recording is silent, check the HDMI source's audio output and sample rate. Then try recording again while video capture is running in another terminal. To choose a different playback device, use aplay -l to list the devices and select one with aplay -D.
Play video and audio together
Stop the earlier capture and recording commands. On the Pi 4B desktop, select the audio output device. The example uses pulsesink, which requires a PulseAudio-compatible desktop service. If gst-inspect-1.0 pulsesink cannot find the plugin, install gstreamer1.0-pulseaudio and try again.
sudo apt install gstreamer1.0-alsa
gst-launch-1.0 -e \
v4l2src device=/dev/rk628-video io-mode=dmabuf do-timestamp=true ! \
video/x-raw,format=UYVY,width=1920,height=1080,framerate=60/1 ! \
queue max-size-buffers=2 max-size-bytes=0 max-size-time=0 leaky=downstream ! \
glimagesink sync=true \
alsasrc device="hw:CARD=RK628HDMI,DEV=0" \
buffer-time=40000 latency-time=5000 ! \
audio/x-raw,format=S32LE,rate=48000,channels=2 ! \
queue ! audioconvert ! audioresample ! \
pulsesink buffer-time=40000 latency-time=5000 sync=true
Upgrade and uninstall
- Upgrade by installing a newer
rk628-rpi-dkmspackage with APT or runningsudo ./scripts/install.shfrom the desired source release. Checkdkms status, reboot, and verify capture again. If you userk628-media-initd, update it separately from its project releases. - Uninstall the automatic configuration service first if installed (
sudo apt purge rk628-media-initd). To remove a packaged driver, runsudo apt purge rk628-rpi-dkms. For a source installation, runsudo ./scripts/uninstall.shfrom the corresponding source directory. Remove thedtoverlay=rk628-pi4line and its options from/boot/firmware/config.txt, restorecamera_auto_detectand any overlays you disabled during setup, and reboot.
Further reading
For PiKVM OS, the pikvm-rk628 project provides a preconfigured Raspberry Pi 4 image and instructions for manual installation. PiKVM OS installation guide