_                    _
  ___ | |__   __ _ _______ | |_
 / _ \| '_ \ / _` |_  / _ \| __|
| (_) | | | | (_| |/ / (_) | |_
 \___/|_| |_|\__,_/___\___/ \__|

ffmpegusage, edit and tips.

-f FORMAT : See available formats with ffmpeg -formats
-i INPUT

$ ffmpeg -f FORMAT1 [FORMAT1_OPTIONS] -i INPUT1 [-f FORMAT2 [FORMAT2_OPTIONS] -i INPUT2 -f ...] OUTPUT_FILE

codecs : ffmpeg -codecs
formats : ffmpeg -formats
pixel formats : ffmpeg -pix_fmts

back to top

extract video : ffmpeg -i INPUT_FILE -c copy -an OUTPUT_FILE
extract audio : ffmpeg -i INPUT_FILE -c copy -vn OUTPUT_FILE
extract part of the file : ffmpeg -i INPUT_FILE -ss START_TIME -to END_TIME OUTPUT_FILE
record desktop : ffmpeg -f x11grab -s WIDTHxHEIGHT -i DISPLAY OUTPUT_FILE
record microphone audio : ffmpeg -f [alsa|pulse] -i default OUTPUT_FILE
START_TIME and END_TIME use the format HH:MM:SS[.MS].

offset : -i DISPLAY+X_OFFSET,Y_OFFSET
framerate : -framerate FRAMERATE
video codec : -c:v CODEC
pixel format : -pix_fmt FORMAT

back to top

  1. Find the output monitor source: pactl list sources
    Source #0
            State: SUSPENDED
            Name: alsa_output.pci-0000_09_00.6.analog-stereo.monitor
  2. Record from the monitor source: ffmpeg -f pulse -i 0 OUTPUT_FILE

back to top

-filter_complex '[INPUT_ID:INPUT_CHANNEL]FILTER[MAP]'

Mixing desktop and microphone audio:

-f pulse -i 0 -f alsa -i default -filter_complex '[0:a][1:a]amerge=inputs=2'
  • [0:a] refers to input 0 (desktop in this case) and 'a' is the audio channel.
  • inputs=2 input count.
Managing volume: This adjusts the volume based on input, eg.: 0.1 from the input volume, not the output.
-f pulse -i 0 -f alsa -i default -filter_complex '[0:a]volume=0.1[desk_audio];[1:a]volume=5[mic_audio];[mic_audio][desk_audio]amerge=inputs=2' -c:a pcm_s24le
  • , [desk_audio] is a map to use later with the filter amerge.
  • set volume for each input (desk and mic) and merge them using the mapping: [mic_audio][desk_audio]amerge=inputs=2

back to top

- Archlinux manpages: ffmpeg(1)

- FFMPEG Documentation
- FFMPEG Trac wiki
- FFMPEG Trac wiki - Capture PulseAudio
- FFMPEG Documentation - x11grab
- FFMPEG Documentation - metadata
- FFMPEG Trac wiki - ALSA
- FFMPEG Trac wiki - Desktop
- FFMPEG Trac wiki - AudioVolume
- FFMPEG Trac wiki - Audio Channel Manipulation

back to top

ohazot | about | ohazot.com <admin@ohazot.com>

This document applies to: linux , OpenBSD 7.8 | Created:2026-03-23|Updated:2026-03-28|