Skip to content

Instantly share code, notes, and snippets.

@josuecau
Last active Feb 24, 2019
Embed
What would you like to do?
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