transcode-youtube() {
    # Check if both input and output files are provided
    if [ "$#" -ne 1 ]; then
        echo "Usage: transcode-youtube <video number>"
        return 1
    fi

    ffmpeg -vaapi_device /dev/dri/renderD128 -i "youtube-raw/vid$1.mov" \
      -vf "format=nv12,hwupload" \
      -c:v h264_vaapi -profile:v high -level 4.2 \
      -rc_mode VBR -b:v 50M -maxrate 70M -bufsize 100M \
      -g 120 -bf 2 \
      -color_primaries bt709 -color_trc bt709 -colorspace bt709 \
      -c:a aac -b:a 384k -ar 48000 \
      -movflags +faststart \
      "youtube-archive/vid-$1.mp4"
}
