Skip to content

Instantly share code, notes, and snippets.

@ocdude
Last active April 17, 2016 20:36
Show Gist options
  • Save ocdude/2f142e5012cffadb355521a62caee21d to your computer and use it in GitHub Desktop.
Save ocdude/2f142e5012cffadb355521a62caee21d to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script is for encoding videos in 1080p60 for YouTube using YouTube's recommendations
# Optionally allows for usage of nvenc instead of libx264
# Usage: yt-1080p60.sh INFILE OUTFILE [nvenc]
INFILE="$1"
OUTFILE="$2"
ENCODER="$3"
if [ "$ENCODER" = "nvenc" ]; then
ENC="nvenc_h264"
else
ENC="libx264"
fi
# encoding for YouTube 1080p60
ffmpeg -hide_banner -i "$INFILE" \
-c:v "$ENC" \
-crf 12 \
-r 60 \
-g 30 \
-bf 2 \
-b:v 12M \
-profile:v high \
-preset slow \
-pix_fmt yuv420p \
-movflags +faststart \
-c:a aac \
-b:a 384k \
-ar 48000 \
"$OUTFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment