Skip to content

Instantly share code, notes, and snippets.

@omeroot
Created December 29, 2015 10:11
Show Gist options
  • Select an option

  • Save omeroot/e0dac84987de0255ce98 to your computer and use it in GitHub Desktop.

Select an option

Save omeroot/e0dac84987de0255ce98 to your computer and use it in GitHub Desktop.
#!/bin/bash
#transcode your video and outputs is video_1080p.mp4,video_720p.mp4,video_480p.mp4
output_directory=$1
extention=$2
echo $output_directory
main_video="$output_directory/video.$2"
out_1080="$output_directory/video_1080p.mp4"
out_720="$output_directory/video_720p.mp4"
out_480="$output_directory/video_480p.mp4"
ffmpeg -i $main_video \
-s 1920x1080 -c:v libx264 -b:v 2000k -bufsize 2000k -maxrate 2100k -bf 2 -g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 128k -ar 48000 $out_1080 \
-s 1280x720 -c:v libx264 -b:v 1200k -bufsize 1200k -maxrate 1400k -bf 2 -g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 44100 $out_720 \
-s 854x480 -c:v libx264 -b:v 400k -bufsize 400k -maxrate 500k -bf 2 -g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 64k -ar 44100 $out_480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment