Created
July 12, 2012 19:34
-
-
Save MorsCode/3100383 to your computer and use it in GitHub Desktop.
FFmpeg
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
# FFmpeg encoding defaults | |
use warnings; | |
$dir = 'C:/Steven/Desktop/ffmpeg-02b651a/libavformat'; | |
@files = glob "$dir/*"; | |
local $/; | |
$re = qr/AVOutputFormat.*?;/s; | |
for (@files) { | |
open FILE, $_; | |
@matches = <FILE> =~ /$re/g; | |
print @matches; | |
} |
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
# Cross platform | |
# FFmpeg, Extract a frame | |
# The correct way is to put -ss first, then -i. | |
# If you put -i first it will cause sync issues. | |
ffmpeg -ss 10 -i in.mp4 -vframes 1 out.png |
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
# Cross platform | |
# FFmpeg will assume | |
# -c:a aac | |
# -c:v libx264 | |
# -ar [same as input] | |
ffmpeg -i in.avi -ac 2 -ab 320k -strict experimental -threads 6 out.mp4 |
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
# Cross platform | |
# Video from song and image | |
# trunc rounds towards zero | |
# youtube will reencode the audio so you need -c:a copy | |
# standard | |
ffmpeg -loop 1 -i image.jpg -i audio.mp3 -c:v libx264 -vprofile main -vf scale=trunc(oh*a/2)*2:480 -c:a copy -shortest out.flv | |
# wide | |
ffmpeg -loop 1 -i image.jpg -i audio.mp3 -c:v libx264 -vprofile main -vf scale=854:trunc(ow/a/2)*2 -c:a copy -shortest out.flv |
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
# Cross platform | |
# The correct way is to put -ss first, then -i. | |
# If you put -i first it will cause sync issues. | |
ffmpeg -ss [start] -t [duration] -i in.mp4 -c copy out.mp4 |
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
# Cross platform | |
# FFmpeg join video files | |
ffmpeg -ss 100 -t 10 -i in.mp4 -c copy -bsf h264_mp4toannexb 100.h264 | |
ffmpeg -ss 200 -t 10 -i in.mp4 -c copy -bsf h264_mp4toannexb 200.h264 | |
ffmpeg -i concat:"100.h264|200.h264" -i in.mp3 -c copy out.mp4 |
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
# FFmpeg Screencast Linux | |
ffmpeg -an -s hd1080 -r 24000/1001 -f x11grab -i :0.0 -sameq out.avi |
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
:: FFmpeg Screencast Windows | |
ffmpeg -f dshow -i video=screen-capture-recorder -r 24000/1001 -q 1 out.avi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment