This is a list of commands for editing video using ffmpeg.
Cut and Fade
Start the video at minute 1, make it last 20 seconds and fade the first and last 4 seconds of audio and video:
ffmpeg \
# start at minute 1 \
-ss 00:01:00 \
# duration 20 seconds \
-t 20 \
# input video \
-i myinvideo.webm \
# audio fade \
-af "afade=in:d=4,afade=t=out:st=16:d=4" \
# video fade \
-vf "fade=in:d=4,fade=out:st=16:d=4" \
# output video \
myoutvideo.webm
Normalize audio
ffmpeg \
-i myinvideo.webm \
# integrated loudness (I) -16 \
# loudness range (LRA) 11 \
# max true peak (TP) -1.5 \
-af loudnorm=I=-16:LRA=11:TP=-1.5 \
myoutvideo.webm
Shift audio
Take the video of file 0 and the audio of file 1, leave the video of file 0 alone and apply the offset to the audio of file 1 and merge them into a new output file
ffmpeg \
-i myinvideo.webm \
# delay audio by 1.0 second \
# negatives are also valid \
-itsoffset 1.0 \
-i myinvideo.webm \
-vcodec copy -acodec copy \
-map 0:0 -map 1:1 \
myoutvideo.webm
Trim first n seconds from audio
ffmpeg \
-i myinaudio.ogg \
# trim first 10 seconds \
-ss 10 \
# copy audio stream \
-acodec copy \
myoutaudio.ogg