Skip to content

Instantly share code, notes, and snippets.

@Aldarone
Last active May 10, 2018 15:43
Show Gist options
  • Save Aldarone/7e9e670a065ca390dd8fd23449937579 to your computer and use it in GitHub Desktop.
Save Aldarone/7e9e670a065ca390dd8fd23449937579 to your computer and use it in GitHub Desktop.
Small script to encode your vlog to VP9+Opus in webm before sending it to Peertube
#!/bin/env bash
# Usage :
# ffwebm input_file output_file [video_bitrate [audio_bitrate]]
INPUT=${1}
OUTPUT=${2}
BITRATE=${3:-1000k}
AUDIO_BITRATE=${4:-64k}
ffmpeg -i ${INPUT} -c:v libvpx-vp9 -pass 1 -b:v ${BITRATE} -threads $(nproc) -speed 4 \
-tile-columns 4 -frame-parallel 1 \
-g 9999 -aq-mode 0 -an -f webm - > /dev/null
ffmpeg -i ${INPUT} -c:v libvpx-vp9 -pass 2 -b:v ${BITRATE} -threads $(nproc) -speed 1 \
-tile-columns 4 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 \
-g 9999 -aq-mode 0 -c:a libopus -b:a ${AUDIO_BITRATE} \
-af aformat=channel_layouts="7.1|5.1|stereo" -f webm ${OUTPUT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment