Is it possible to record audio on a wayland desktop with ffmpeg?
0
votes
1
answer
43
views
I've figured out a way to capture video on wayland (hyprland) with ffmpeg, but that method does not cover audio.
Most people on wayland will be using pipewire, pipewire has a compatibility layer for pulseaudio called pipewire-pulse which allows most audio designed for pulseaudio to be played or recorded through pipewire.
But in ffmpeg's case it doesn't seem to work.
ffmpeg -device /dev/dri/card1 -vaapi_device /dev/dri/renderD129 -f pulse -ac 2 -i easyeffects_sink.monitor -c:a libopus -framerate 60 -f kmsgrab -i - -c:v h264_vaapi -rc_mode QVBR -q:v 10 -maxrate 327680 -b 81920 -pix_fmt vaapi -vf hwmap=derive_device=vaapi,scale_vaapi=format=nv12:out_range=full out.mp4
The above command fails with
Option device not found.
Error opening input file easyeffects_sink.monitor.
Error opening input files: Option not found
But if I remove this part:
-f pulse -ac 2 -i easyeffects_sink.monitor -c:a libopus
It will work relatively fine. and if I am on x11 instead of wayland, using x11grab instead of kmsgrab
ffmpeg -vaapi_device /dev/dri/renderD129 -f pulse -ac 2 -i easyeffects_sink.monitor -c:a libopus -video_size 2560x1600 -framerate 60 -f x11grab -i :1.0 -c:v h264_vaapi -rc_mode QVBR -q:v 10 -maxrate 327680 -b 81920 -pix_fmt vaapi -vf format=nv12,hwupload out.mp4
That command works perfectly fine even if it uses the exact same options that didn't work on kmsgrab.
Which leaves me with the question of whether ffmpeg is capable of capturing audio from a wayland environment at all.
Asked by Cestarian
(2438 rep)
Aug 3, 2025, 10:28 PM
Last activity: Aug 4, 2025, 08:28 AM
Last activity: Aug 4, 2025, 08:28 AM