Skip to content

Instantly share code, notes, and snippets.

@bivald

bivald/ffmpeg.sh

Last active Sep 26, 2017
Embed
What would you like to do?
FFmpeg commands
# TO MP4 (with quicktime/windows media player support)
# Convert to 720 MP4 (roughly 7MB for 30 seconds)
ffmpeg -i input.mp4 -s hd720 -c:v libx264 -crf 23 -c:a aac -strict -2 -pix_fmt yuv420p output.mp4
# Convert to 1080 MP4 (roughtly 60MB for 30 seconds) - high resolution, but not RAW
ffmpeg -i input.mp4 -s hd1080 -c:v libx264 -crf 23 -c:a aac -strict -2 -pix_fmt yuv420p output.mp4
# Animated gif to mp4
ffmpeg -i input.gif -strict -2 -pix_fmt yuv420p output.mp4
# Convert to AVI
ffmpeg -i input.mp4 -q:a 2 -q:v 2 -s hd720 output.avi
# Convert to WMV
ffmpeg -i input.mp4 -q:a 2 -q:v 2 -s hd720 output.wmv
@bivald

This comment has been minimized.

Copy link
Owner Author

@bivald bivald commented Jun 3, 2014

Or to run them via shell (run with original filename as first parameter)

#!/bin/bash
ffmpeg -i $1 -s hd1080 -c:v libx264 -crf 23 -c:a aac -strict -2  -pix_fmt yuv420p $1-mp4-output.mp4
ffmpeg -i $1 -q:a 2 -q:v 2 -s hd720 $1-avi-output.avi
ffmpeg -i $1 -q:a 2 -q:v 2 -s hd720 $1-wmv-output.wmv
@bivald

This comment has been minimized.

Copy link
Owner Author

@bivald bivald commented Apr 2, 2016

Or for youtube-dl: youtube-dl https://youtu.be/.... --recode-video mp4 --postprocessor-args ' -s hd1080 -c:v libx264 -crf 23 -c:a aac -strict -2 -pix_fmt yuv420p '

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.