# Full examples: ffmpeg -i input.mov -vcodec h264 -acodec aac output.mp4 ffmpeg -i input.mov -vcodec libvpx -acodec libvorbis output.webm ffmpeg -i input.mp4 -b:a 96k -vf scale="iw/4:-1" -crf 80 out.mp4 # List of things you can do: # Usage: ffmpeg -i input.file output.file # where equals the code pieces from this list // Convert Music to lower bitrate -map 0:a:0 -b:a 96k //Aspect ratio ffmpeg -i input.mp4 -aspect 16:9 output.mp4 //Double Speed (0.5 = x2) ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" output.mp4 //Double audio speed ffmpeg -i input.mp4 -filter:a "atempo=2.0" -vn output.mp4 //Set bitrate (compresses if lower than source, a = audio, v = video) -b:v 1M -b:a 96k //Volume of audio ffmpeg -i input.mp3 -af 'volume=1.5' output.mp3 //Change scale of video (iw = width, ih = height, -1 means auto) -vf scale="iw/2:-1" -vf scale="1280:720" //Crop (Cut) Video, w=width, x=startpoint for the rectangle w/h ffmpeg -i input.mp4 -filter:v "crop=w:h:x:y" output.mp4 //Quicker video scaling -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4 //Video to images (Names are image-001.png, image-002.png, ...) //-r = framerate in which screenshots are taken, default=25 //%3d = name, 001 - 999 ffmpeg -i input.mp4 -r 1 -f image2 image-%3d.png //Add Text to the video -vf drawtext="text='MyTextHere': fontcolor=white: fontsize=24: x=(w-text_w)/2: y=(h-text_h)/2" //Combine 2 videos ffmpeg -i in_one.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts _1.ts ffmpeg -i in_two.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts _2.ts ffmpeg -i "concat:_1.ts|_2.ts" -c copy -bsf:a aac_adtstoasc together.mp4 //Compress video (Should be between 20 and 28, 51 is max and looks ew) -crf 24 -crf 51 //Change Video Codec ('copy' means copy the input video codec) -vcodec h264 -vcodec libvpx -vcodec copy //Change Audio Codec -acodec aac -acodec mp3 -acodec copy //Remove Audio / Video -an -vn //Remove video would be: ffmpeg -i input_video.mp4 -vn output_audio.mp3 //Example mp4 to mp3 convert ffmpeg -i in.mp4 -vn -acodec mp3 out.mp3 //Convert a video from 30 to 60 FPS ffmpeg -i Input.mp4 -filter:v "minterpolate='fps=60'" Out60.mp4 //Make 2 input files side by side (-r makes the framerate be 60) ffmpeg -i 30.mp4 -i 60.mp4 -r 60 -filter_complex hstack comparison.mp4 //Cut Video (time either in 00:01:23.000 or in seconds format, here seconds are used) //This would cut the video, so that only second 3 to 8 plays (5 seconds long) // -t = duration, -ss = starttime -ss 3 -t 5 //Burn in subtitles ffmpeg -i in.mkv -vf subtitles=in.mkv out.mp4 //Meme top and bottom text with white padding background ffmpeg -i input.mp4 -filter_complex \ "[0:v]pad=iw:ih+100:0:(oh-ih)/2:color=white, \ drawtext=text='ONE DOES NOT SIMPLY':fontsize=24:x=(w-tw)/2:y=(50-th)/2, \ drawtext=text='STOP ME FROM FILTERING':fontsize=24:x=(w-tw)/2:y=h-25-(th/2)" \ output.mp4 //Convert a folder from mp4 to mp3 for i in *.mp4; do ffmpeg -i "$i" "$(basename "$i" .mp4)".mp3 ; done // Copy codes (copy video and audio stream, makes video cutting way quicker) -c copy