Skip to content

Instantly share code, notes, and snippets.

@tebriel
Created May 4, 2023 13:14
Show Gist options
  • Save tebriel/9beb1ebe34d4a0d95fe1dd179069b170 to your computer and use it in GitHub Desktop.
Save tebriel/9beb1ebe34d4a0d95fe1dd179069b170 to your computer and use it in GitHub Desktop.
Script to convert .vc1 files using ffmpeg
#!/usr/bin/env bash
set -euo pipefail
FILENAME=${1?"Must specify filename"}
OUTPUT=${2?"Must specify output file"}
TYPE=$(ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "${FILENAME}")
if [ "${TYPE}" == "vc1" ]; then
echo "converting ${FILENAME} it's ${TYPE}"
ffmpeg -i "${FILENAME}" -c:v hevc -preset slow -crf 25 -tag:v hvc1 -q:a 100 "${FILENAME%.*}.x265.mp4"
exitcode=$?
if [ "${exitcode}" -neq 0 ]; then
echo "${FILENAME}: FAILED" >> "${OUTPUT}"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment