lattepanda-sigma2-gpu-ffmpeg-hw-encode-9.ino

LattePanda Sigma 2: Intel Core Ultra X7 358H Single-Board Server · File : lattepanda-sigma2-gpu-ffmpeg-hw-encode-9.ino · Language : bash · Use case : Utiliser l'accélération matérielle du GPU Intel Arc B390 pour encoder une vidéo en HEVC/AV1 à haute résolution.

Bash script leveraging Quick Sync Video (QSV) via FFmpeg to exploit the integrated Intel Arc GPU. Enables high-performance, low-power HEVC/AV1 encoding.

This script requires FFmpeg and Intel Media support libraries (libva-intel-driver or intel-media-va-driver). On the pre-installed Ubuntu 26.04, ensure the Arc GPU is enabled in BIOS and drivers are updated. Run the script via terminal after placing an 'input.mp4' in the current directory. Use 'watch -n 1 intel_gpu_top' to monitor GPU usage during encoding.

lattepanda-sigma2-gpu-ffmpeg-hw-encode-9.ino

#!/bin/bash
# Vérification des outils nécessaires
if ! command -v ffmpeg &> /dev/null; then
  echo "FFmpeg non trouvé. Installation..."
  sudo apt update && sudo apt install -y ffmpeg libva2 libva-drm2
fi

# Définir les chemins
INPUT_FILE="input.mp4"
OUTPUT_FILE="output_hevc.mkv"

# Vérifier si le fichier d'entrée existe
if [ ! -f "$INPUT_FILE" ]; then
  echo "Fichier $INPUT_FILE introuvable. Créez un fichier de test ou changez la variable."
  exit 1
fi

# Commande FFmpeg avec accélération matérielle Intel Arc (QSV)
# -c:v h264_qsv ou hevc_qsv ou av1_qsv selon la version de libva supportée
# -global_quality: Qualité CQP (constante), 0 (max) à 51 (min). 20-28 est un bon compromis.
echo "Démarrage de l'encodage matériel (Intel Arc)..."
ffmpeg -y \
  -hwaccel qsv \
  -hwaccel_output_format qsv \
  -c:v h264_qsv \
  -preset veryfast \
  -global_quality 20 \
  -look_ahead 1 \
  -vframes 5 \ # Limite pour le test, supprimez cette ligne pour tout encoder
  -i "$INPUT_FILE" \
  -c:a copy \
  "$OUTPUT_FILE"

if [ $? -eq 0 ]; then
  echo "Encodage terminé avec succès : $OUTPUT_FILE"
else
  echo "Échec de l'encodage. Vérifiez que les drivers Intel Media SDK/OneAPI sont installés."
fi

← Back to the board