Video & Audio
Desktop-environment tools (gnome-screenshot, spectacle, flameshot) come with the desktop; scrot and maim work anywhere on X11, grim on Wayland.$ import -window root [fileName].png
Record the screen with ffmpeg on X11 or wf-recorder on Wayland. For terminal sessions, asciinema records text instead of pixels.$ ffmpeg -f x11grab -i :0.0 recording.mp4
Take a photo from the webcam.$ ffmpeg -f v4l2 -i /dev/video0 -frames:v 1 [fileName].jpg
mpv and vlc play virtually anything. ffplay is ffmpeg's bare-bones player; aplay and play handle simple sound files.
alsamixer and pavucontrol are the interactive mixers. From scripts, pactl controls the PulseAudio/PipeWire default output.$ pactl set-sink-volume @DEFAULT_SINK@ +5% $ pactl set-sink-mute @DEFAULT_SINK@ toggle
Record from the default microphone.$ ffmpeg -f alsa -i default [fileName].wav
Make the computer talk, or play the classic PC speaker beep.
Show codecs, resolution, duration, and bitrate.
ffmpeg picks the output format from the file extension, so plain conversion needs no flags.$ ffmpeg -i input.avi output.mp4 $ ffmpeg -i input.mp4 output.webm Extract the audio track as MP3 (-vn drops the video, -b:a sets the audio bitrate; -q:a 0 uses best variable quality instead).$ ffmpeg -i video.mp4 -vn -b:a 192k audio.mp3 $ ffmpeg -i video.mp4 -vn -q:a 0 audio.mp3 Resize a video; -1 keeps the aspect ratio.$ ffmpeg -i input.mp4 -vf scale=1280:-1 output.mp4
-ss sets the start, -t the duration. -c copy cuts without re-encoding: instant and lossless, but only accurate to the nearest keyframe.$ ffmpeg -ss 00:01:30 -i input.mp4 -t 00:00:20 -c copy clip.mp4 $ ffmpeg -ss 00:01:30 -i input.mp4 -t 00:00:20 clip.mp4
Turn a numbered image sequence into a video and back, or make an animated GIF.$ ffmpeg -framerate 24 -i image%d.jpg video.mp4 $ ffmpeg -i video.mp4 image%d.jpg $ ffmpeg -i video.mp4 -vf "fps=10,scale=480:-1" animation.gif Convert images to the WebP format.
Copied to clipboard