Skip to content

Instantly share code, notes, and snippets.

@josuecau
Last active February 24, 2019 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josuecau/2800c91dc287404faa44b6036fa35e49 to your computer and use it in GitHub Desktop.
Save josuecau/2800c91dc287404faa44b6036fa35e49 to your computer and use it in GitHub Desktop.
Convert H.265 (HEVC) to H.264 (MPEG-4 AVC)
#!/usr/bin/env bash
#
# Description: Convert H.265 (HEVC) to H.264 (MPEG-4 AVC)
# Author: Josué Cau <me@josuecau.com>
# Date: 2018-02-16
# Dependencies: ffmpeg(1)
set -e
if [ "$#" -ne 3 ]; then
echo "Usage: $(basename "$0") INPUT OUTPUT"
exit 1
fi
if ! type ffmpeg >/dev/null 2>&1; then
echo 'ffmpeg(1) not found'
exit 1
fi
input="$1"
output="$2"
# https://gist.github.com/davidtron/52f6805e7a46605359c7
# ffmpeg -i "$input" -map 0:v -c:v libx264 -preset slow -crf 22 -map 0:a -c:a copy -strict -2 -c:a aac "$output"
# https://superuser.com/a/1381151
ffmpeg -i "$input" -c:v libx264 -crf 18 -c:a copy "$output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment