body { font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .cool-background { background-color: #f3f4f6; /\* Tailwind gray-100 \*/ } .content-card { transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out; } .content-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); } .code-block { position: relative; background-color: #202124; /\* Dark background like Material style \*/ border-radius: 0.5rem; /\* 8px \*/ padding: 1.5rem; margin-top: 0.5rem; } .code-block pre { color: #e8eaed; /\* White/light gray text like Material style \*/ font-family: 'Roboto Mono', monospace; font-size: 0.9rem; white-space: pre-wrap; word-wrap: break-word; } .copy-btn { position: absolute; top: 0.75rem; right: 0.75rem; background: rgba(255, 255, 255, 0.1); color: #fff; border: none; border-radius: 0.25rem; /\* 4px \*/ padding: 0.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s ease, background-color 0.2s ease; } .code-block:hover .copy-btn { opacity: 0.7; } .copy-btn:hover { opacity: 1; background: rgba(255, 255, 255, 0.2); } .section-header { display: flex; align-items: center; border-bottom: 2px solid #e5e7eb; /\* gray-200 \*/ padding-bottom: 0.5rem; } .section-header .icon { margin-right: 1rem; color: #4f46e5; /\* indigo-600 \*/ flex-shrink: 0; } .custom-ol { list-style: none; padding-left: 0; counter-reset: custom-counter; } .custom-ol > li { counter-increment: custom-counter; margin-bottom: 1.5rem; display: flex; align-items: flex-start; position: relative; padding-left: 44px; /\* Space for the counter \*/ } .custom-ol > li::before { content: counter(custom-counter); background-color: #4f46e5; /\* indigo-600 \*/ color: white; font-weight: 600; font-size: 0.875rem; border-radius: 50%; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; position: absolute; left: 0; top: 0; }

Rockchip Guide Banner

Rockchip Hardware Acceleration & Automated Conversion

Last updated:

A complete guide to enabling hardware acceleration and setting up an automated conversion service on your Rockchip-powered SBC. This post will walk you through installing the necessary drivers and deploying a systemd service to watch for and convert video files automatically.

Part 1: Installing Hardware Acceleration Libraries

For ffmpeg to use your Rockchip VPU (Video Processing Unit), it needs the correct driver libraries. There are two primary methods to get these essential components installed on your system.

Method A: Using a PPA (Recommended)

This is the easiest and most reliable method as it uses a pre-built package archive.

  1. Install PPA Tool:

    sudo apt update
    sudo apt install software-properties-common -y
    
  2. Add Rockchip PPA:

    sudo add-apt-repository ppa:liujianfeng1994/rockchip-multimedia
    
  3. Update & Install:

    sudo apt update
    sudo apt install rockchip-multimedia-config -y
    

Method B: Manual Installation

If the PPA command fails, you can add the repository manually.

  1. Add GPG Key:

    curl -s "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x8065BE1FC67AABDE" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/rockchip-multimedia.gpg >/dev/null
    
  2. Add Repository Source:

    echo "deb [signed-by=/etc/apt/trusted.gpg.d/rockchip-multimedia.gpg] https://ppa.launchpadcontent.net/liujianfeng1994/rockchip-multimedia/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/rockchip-multimedia.list
    
  3. Update & Install:

    sudo apt update
    sudo apt install rockchip-multimedia-config -y
    

Important: After either installation method, reboot your SBC to ensure all drivers are loaded correctly.

Part 2: The Automation Scripts and Service

This service automatically finds and converts your files. It consists of a conversion script and two systemd files to manage and schedule it.

1. The Conversion Script

This script finds HEVC files, converts them using hardware acceleration, and deletes the original upon success. Save it as /home/manupa/bin/convert_hevc.sh.

#!/bin/bash
WATCH_DIR="/home/manupa/Downloads/SD/TVSeries"
LOG_FILE="/home/manupa/Downloads/converter.log"

log() { echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE"; }

log "--- Starting conversion scan ---"
find "$WATCH_DIR" -type f \( -iname "*hevc*.mkv" -o -iname "*h265*.mkv" \) | while IFS= read -r i; do
    o="$(dirname "$i")/$(basename "$i" .mkv).mp4"
    log "Found: $i"
    if [ -f "$o" ]; then
        log "Skipping, output exists. Deleting original: $i"
        rm "$i"
        continue
    fi
    log "Converting to: $o"
    ffmpeg -c:v hevc_rkmpp -i "$i" -c:v h264_rkmpp -c:a copy "$o"
    if [ $? -eq 0 ]; then
        log "SUCCESS. Deleting original: $i"
        rm "$i"
    else
        log "ERROR: ffmpeg failed on $i"
    fi
done
log "--- Scan finished ---"

2. Systemd Service

Tells systemd what to run. Save as hevc_converter.service.

[Unit]
Description=HEVC to H264 Conversion Service

[Service]
Type=oneshot
ExecStart=/home/manupa/bin/convert_hevc.sh

3. Systemd Timer

Tells systemd when to run it. Save as hevc_converter.timer.

[Unit]
Description=Run HEVC converter every 30 minutes

[Timer]
OnBootSec=5min
OnUnitActiveSec=30min
Unit=hevc_converter.service

[Install]
WantedBy=timers.target

Part 3: Full Setup Procedure

  1. Create Directories & Files:

    Create the necessary directories and place the service/timer files from Part 2 into /home/manupa/.config/systemd/user/.

    mkdir -p /home/manupa/bin
    mkdir -p /home/manupa/.config/systemd/user
    
  2. Make Script Executable:

    chmod +x /home/manupa/bin/convert_hevc.sh
    
  3. Enable and Start the Timer:

    This command must be run without `sudo`.

    systemctl --user enable --now hevc_converter.timer
    
  4. Enable User Linger (For Servers):

    This ensures your timer runs even when you are not logged in. This command requires sudo.

    sudo loginctl enable-linger $(whoami)
    

Setup Complete! Your automated hardware conversion service is now active. Monitor its progress with: tail -f /home/manupa/Downloads/converter.log

Rockchip Guide ©

const copyIcon = \`<span class="icon"><svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 96 960 960" width="24" fill="currentColor"><path d="M180 976q-24 0-42-18t-18-42V316q0-24 18-42t42-18h440v60H180v600h440v60H180Zm120-120q-24 0-42-18t-18-42V216q0-24 18-42t42-18h440q24 0 42 18t18 42v580q0 24-18 42t-42 18H300Zm0-60h440V216H300v580Zm0 0V216v580Z"/></svg></span>\`; const copiedIcon = \`<span class="icon"><svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 96 960 960" width="24" fill="currentColor"><path d="M382 816 154 588l43-43 185 185 382-382 43 43-425 425Z"/></svg></span>\`; document.querySelectorAll('.copy-btn').forEach(button => { button.innerHTML = copyIcon; }); function copyToClipboard(button) { const pre = button.nextElementSibling; const text = pre.innerText; navigator.clipboard.writeText(text).then(() => { button.innerHTML = copiedIcon; setTimeout(() => { button.innerHTML = copyIcon; }, 2000); }).catch(err => { console.error('Failed to copy: ', err); }); } document.getElementById('generation-date').innerText = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); ```