Last active
September 7, 2015 03:10
-
-
Save jasonhejna/06970b4b7eac94a63803 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! | |
# These are the ffmpeg commands I use to convert a movie into multiple formats, and aspect ratios. | |
# Used as background video for a web app. | |
# The goals is efficient streaming to every device screen size in the browser. | |
# Using video.js formats: MP4, WebM, OGV | |
# | |
# Using myvideo.mp4. Dimensions are 1280px by 720px. | |
# | |
# STOP! Don't use these dimensions! Instead, decide on dimensions that work well with your site, and media queries. | |
# Crop the video. Save as myvideo_1170x_333y.mp4. Dimensions are 1170px x by 333px y. 55:185 means start crop from the left:top. | |
ffmpeg -i myvideo.mp4 -filter:v "crop=1170:333:55:185" myvideo1170x333y.mp4 | |
# Crop again for vertical mobile devices | |
ffmpeg -i myvideo.mp4 -filter:v "crop=513:720:383:0" myvideo513x720y.mp4 | |
# | |
# Loop though the next two commands for each crop size. Generates other formats (WebM, OGV). | |
# Save mp4 as WebM | |
ffmpeg -i myvideo_1170x_333y.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a myvideo1170x333y.webm | |
# Save mp4 as ogv | |
ffmpeg -i myvideo_1170x_333y.mp4 -c:v libtheora -c:a libvorbis myvideo1170x333y.ogv | |
#! Congrats! You're Done | |
# | |
# OTHER HELPFUL COMMANDS | |
# Install ffmpeg. This command will install ffmpeg with needed codecs on mac using homebrew. | |
brew install ffmpeg --with-libvpx --with-libvorbis --with-theora | |
# Just a useful command. For when you download .mp4 files from youtube, and want to add silent acc audio so they will import into iMovie. | |
ffmpeg -f lavfi -i aevalsrc=0 -i spaceshuttle.mp4 -vcodec copy -acodec aac -map 0:0 -map 1:0 -shortest -strict experimental -y newspace_shuttle.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment