webm
copy video codec
ffmpeg -i input.mkv -c:v copy -c:a libopus output.webm
two pass
ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 0 -crf 30 -pass 1 -an -f null /dev/null && \
ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 0 -crf 30 -pass 2 -c:a libopus output.webm
single pass
Note: vp9 is designed for a 2-pass encoding so using a single pass will give sub-optimal compression, but it can be done as so in a pinch:
ffmpeg -i <oldfile> -c:a libopus \
-c:v libvpx-vp9 -crf <quality> \
-b:v 0 -pix_fmt yuv420p -movflags faststart <newfile>
lossless
ffmpeg -i input.mp4 -c:v libvpx-vp9 -lossless 1 output.webm
trim
To trim a video, first seek to the correct position in the file with -ss then
using the -t option to set a duration. Alternatively, and often much easier to
use is the -to option which is to indicate a position in time to stop reading.
The only other key detail is to use the options to simply copy the existing video and audio codecs without any conversion.
ffmpeg -ss 00:01:00 -to 00:02:00 -i input.mp4 -c copy output.mp4
accurate trimming
The above example is fine if you're just quickly extracting a clip from a movie or something, but if you need perfect accuracy you need to actually re-encode the video. You can of course re-encode it to a lossless format and you don't have to re-encode the audio, but something like this would trim off the first 193 frames accurately:
ffmpeg -ss 193 -i vid.mp4 -c:v libx264 -crf 20 -c:a copy -t 4 accurateoutput.mp4
screen record
xorg
ffmpeg -f x11grab -framerate 30 -i :0.0 out.mpg
combine
$ cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
$ ffmpeg -f concat -i mylist.txt -c copy output.mp4