RaspiOSのデスクトップを録画

 Waylandのキャプチャ録画には、wf-recorderが便利だそうなので入れてみる。

 パッケージでインストール。

fd@pi4:~ $ sudo apt install -y wf-recorder slurp

slurp is already the newest version (1.5.0-1+b1).

slurp set to manually installed.

The following packages were automatically installed and are no longer required:

autotouch libxcb-errors0 p11-kit

fonts-cantarell libxcb-ewmh2 p11-kit-modules

gldriver-test libxcb-res0 pcmanfm

gnome-keyring lpplug-batt pi-greeter

gtk-nop lpplug-bluetooth plymouth

gui-pkinst lpplug-clock plymouth-label

kanshi lpplug-cpu plymouth-themes

labwc lpplug-cputemp pprompt

laptop-detect lpplug-ejecter qt5-gtk2-platformtheme

libdisplay-info2 lpplug-gpu qt5-style-plugin-cleanlooks

libgdata-common lpplug-magnifier qt5-style-plugin-motif

libgdata22 lpplug-menu qt5-style-plugin-plastique

libgoa-1.0-0b lpplug-netman qt5-style-plugins

libgoa-1.0-common lpplug-power qt5ct

libkeybinder-3.0-0 lpplug-updater rpd-plym-splash

libliftoff0 lpplug-volumepulse swayidle

libmsgraph-1-1 lxpanel-pi swaylock

libobrender32v5 lxpolkit wlopm

libobt2v5 lxsession xcompmgr

libplymouth5 lxsession-data xinit

libqt5ct-common1.8 lxsession-logout xmlstarlet

libseat1 mate-polkit xsettingsd

libsoup-2.4-1 mate-polkit-bin xwayland

libsoup2.4-common mate-polkit-common

libwlroots-0.18 openbox

Use 'sudo apt autoremove' to remove them.

Installing:

wf-recorder

Summary:

Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 0

Download size: 48.5 kB

Space needed: 152 kB / 20.5 GB available

Get:1 http://deb.debian.org/debian trixie/main arm64 wf-recorder arm64 0.5.0-2 [48.5 kB]

Fetched 48.5 kB in 0s (155 kB/s)

Selecting previously unselected package wf-recorder.

(Reading database ... 119732 files and directories currently installed.)

Preparing to unpack .../wf-recorder_0.5.0-2_arm64.deb ...

Unpacking wf-recorder (0.5.0-2) ...

Setting up wf-recorder (0.5.0-2) ...

Processing triggers for man-db (2.13.1-1) ...

 録画はこれだけ。

fd@pi4:~ $ wf-recorder -f out.mp4

selected region 0,0 0x0

Setting codec option: crf=20

Setting codec option: preset=ultrafast

Setting codec option: tune=zerolatency

Using video filter: null

[libx264 @ 0x7f7c0020c0] using SAR=1/1
[libx264 @ 0x7f7c0020c0] MB rate (1500000000) > level limit (16711680)
[libx264 @ 0x7f7c0020c0] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x7f7c0020c0] profile Constrained Baseline, level 6.2, 4:2:0, 8-bit
[libx264 @ 0x7f7c0020c0] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0

Output #0, mp4, to 'out.mp4':

Stream #0:0: Video: h264, yuv420p(pc), 800x480 [SAR 1:1 DAR 5:3], q=2-31

Side data:

cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A

[Source @ 0x7f7c003dc0] Changing video frame properties on the fly is not supported by all filters.
[Source @ 0x7f7c003dc0] filter context - w: 800 h: 480 fmt: 119 csp: gbr range: unknown, incoming frame - w: 800 h: 480 fmt: 119 csp: unknown range: unknown pts_time: 0

^C[libx264 @ 0x7f7c0020c0] frame I:15 Avg QP:11.47 size: 9575

[libx264 @ 0x7f7c0020c0] frame P:3599  Avg QP:14.16  size:   112
[libx264 @ 0x7f7c0020c0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x7f7c0020c0] mb P  I16..4:  0.4%  0.0%  0.0%  P16..4:  0.2%  0.0%  0.0%  0.0%  0.0%    skip:99.4%
[libx264 @ 0x7f7c0020c0] coded y,uvDC,uvAC intra: 8.4% 5.3% 4.7% inter: 0.1% 0.1% 0.0%
[libx264 @ 0x7f7c0020c0] i16 v,h,dc,p: 70% 18% 12%  1%
[libx264 @ 0x7f7c0020c0] i8c dc,h,v,p: 83% 12%  5%  0%
[libx264 @ 0x7f7c0020c0] kb/s:1207360.25

 Ctrl+Cで終わると録画も終わる。これで録画した画像ファイルが壊れたりはしない模様。

 動画ファイルができている。

fd@pi4:~ $ file out.mp4

out.mp4: ISO Media, MP4 Base Media v1 [ISO 14496-12:2003]

 1分半くらいはある動画なのだけど、フルスクリーンアプリで画面構成がシンプルなので、圧縮が効いてえらく小さい動画になった。

fd@pi4:~ $ ls -alh out.mp4

-rw-rw-r-- 1 fd fd 588K Oct 6 17:25 out.mp4

 他には、ドラッグして範囲指定した録画もできるそうな。

wf-recorder -g "$(slurp)" -f out.mp4

 音声もとりたいときは、デフォルトの入力デバイスを使うなら、これでいいらしい。

wf-recorder -f out.mp4 --audio=default

 --audioでPipeWire/PulseAudio の入力ソース名を指定することもできる。

wf-recorder -f out.mp4 --audio=alsa_input.usb-Mic_Device-00.mono-fallback

 Audioリソース名を調べるにはこれ。

fd@pi4:~ $ pactl list sources short

57 alsa_output.platform-fe00b840.mailbox.stereo-fallback.monitor PipeWires16le 2ch 48000Hz RUNNING

 普通すぎてつまらんな...


オリジナル投稿:
RaspiOSのデスクトップを録画|kinneko|pixivFANBOX
https://kinneko.fanbox.cc/posts/10694802