Useful commands for FFMPEG used to convert video and audio files. Feel free to contribute with a PR!
$
. $FILE
for your input or output file, $INPUT
for your input file, $OUTPUT
for your output file, etc
Installation
Integration
Packages
Where $WITH
is the desired video width.
VP9 (.webm)
ffmpeg -i $INPUT -vcodec libvpx -acodec libvorbis -ac 2 -b:a 96k -ar 44100 -vf scale=$WIDTH:-1 -map 0 $OUTPUT.webm
H264 (.mp4)
ffmpeg -i $INPUT -vcodec libx264 -acodec libfdk_aac -ac 2 -ar 48000 -b:a 96k -vf scale=$WIDTH:-1 -map 0 $OUTPUT.mp4
Vorbis (.ogv)
ffmpeg -i $INPUT -vcodec libtheora -acodec libvorbis -b:a 96k -vf scale=$WIDTH:-1 -map 0 $OUTPUT.ogv
ffmpeg -i $INPUT $OUTPUT.gif
Where $START
and $END
are the timecodes in format HH:MM:SS
.
ffmpeg -i $INPUT -ss $START -to $END -c copy $OUTPUT
# Ex: ffmpeg -i video.mp4 -ss 00:00:00 -to 00:01:30 -c copy cut.mp4
Where $RATE
is desired images per second: 0.5
for 1 image every 2 seconds, 0.1
for 1 image every 10 seconds, etc).
ffmepg -i $INPUT -r $RATE -f image2 $OUTPUT_%05d.jpg
# Ex: ffmepg -i awesome_goal.mp4 -r 0.1 -f image2 goal_%05d.jpg
Where $ITERATION
is the desired video loops.
ffmpeg -stream_loop $ITERATION -i $INPUT -c copy $OUTPUT
Where $PATH
is your DVD path containing .VOB
files. $QUALITY
is the desired video quality (0 is lossless, 51 is highly compressed, 23-28 is nice).
cat $PATH/VTS_0_*.VOB | ffmpeg -i - -c:v libx264 -crf $QUALITY $OUTPUT.mp4
Where $BITRATE
is the desired audio bitrate (96, 128, 192, 256, 320).
ffmpeg -i $INPUT -vn -ar 44100 -ac 2 -ab $BITRATE -f mp3 $OUTPUT.mp3
# Ex: ffmpeg -i i_love_rock_n_roll.mp4 -vn -ar 44100 -ac 2 -ab 192 -f mp3 i_love_rock_n_roll.mp3
ffmpeg -i $FILE
ffprobe -loglevel quiet -show_format -show_streams -print_format json $FILE
Video
Audio
Miscellaneous