extract audio from video

ffmpeg -i input-video.mkv -q:a 0 -map a output-audio.mp3

remove audio from a video

ffmpeg -i video.mkv -c copy -an video-nosound.mkv

record a video

without audio

ffmpeg -f x11grab -r 15 -i :0.0 -acodec libmp3lame -vcodec mpeg4 -ar 48000 -qscale 0 -framerate 24 outputvideo.avi

with audio

ffmpeg  -f alsa -ac 2 -i alsa -f x11grab -r 15 -i :0.0 -acodec libmp3lame -vcodec mpeg4 -ar 48000 -qscale 0 -framerate 24 outputvideo.avi

convert video format

ffmpeg -i videofile.mp4 videofile.webm

adjust crf

adjust constant rate factor to lower bit rate

ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4

remove id3 tag image and metadata from audio file

ffmpeg -i input.mp3 -vn -codec:a copy -map_metadata -1 output.mp3

trim start and end of video file

ffmpeg -i input.mp4 -ss 00:00:10 -to 01:23:14 -async 1 -c copy output.mp4

rotate video

  • 90° clockwise - increase transpose number for greater rotation
    ffmpeg -i input.mp3 -vf "transpose=1" output.mp4

firefox corrupt file

firefox complains about videos recorded with ffmpeg, saying they are corrupt. apparently using the following options fixes this (mentioned by seninha in #nixers irc)

-vf format=yuv420p