ffmpeg settings
OSX readable mov > mp4
add -pix_fmt yuv420p
additionaly define codec: -vcodec libx264 respectively -codec:v libx264
(copy/paste: )
Encode for YouTube:
ffmpeg -i <input file> -codec:v libx264 -crf 21 -bf 2 -flags +cgop -pix_fmt yuv420p -codec:a aac -strict -2 -b:a 384k -r:a 48000 -movflags faststart <output_name>.mp4
Source
Scaling
e.g: -vf scale=320:-1 source
Inputs: integer (eg. 320) , -1 (preserve aspect ratio) or iw / ih (input width/height) source
Rotate
eg. (90 deg Clockwise):
-vf "transpose=1" 0 = 90CounterCLockwise and Vertical Flip (default) 1 = 90Clockwise 2 = 90CounterClockwise 3 = 90Clockwise and Vertical Flip
180 deg: -vf "transpose=2,transpose=2"
Source
Batch processing
for i in *.mov;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i "$i" -pix_fmt yuv420p -vcodec libx264 "${name}.mp4";
done
stop motion
Image sequence to video
ffmpeg -f image2 -i image%d.jpg -vcodec libx264 -b 800k video.mp4
Framerate
-framerate 15
see: FFMPEG An Intermediate Guide/image sequence / stackoverflow
Metadata
see: Supplying FFmpeg With Metadata
Analyse videos with ffprobe
basic usage: ffprobe file.mp4
only show width and height
ffprobe -v error -show_entries stream=width,height \
-of default=noprint_wrappers=1 input.mp4
source
only show framerate
ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 input.mp4
Example output for a NTSC-film video: 24000/1001
Example output for a PAL video: 25/1
Varia
remove audio: -an
remove video: -vn
source
Further Reading