_ _
___ | |__ __ _ _______ | |_
/ _ \| '_ \ / _` |_ / _ \| __|
| (_) | | | | (_| |/ / (_) | |_
\___/|_| |_|\__,_/___\___/ \__|
ffmpeg —
usage, 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
- Find the output monitor source:
pactl list sources
Source #0
State: SUSPENDED
Name: alsa_output.pci-0000_09_00.6.analog-stereo.monitor
- 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
[0:a]volume=0.1[desk_audio]
, [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