I'm in process of updating my screenshot/screen capture script that uses ffmpeg to capture screen (and optionally audio). Note the captures are generally intended to be uploaded to the web, which is why I'm using webm format; e.g. to incorporate them in issue reports on github.
It used to work fine just fine ("fine" as in subjectively solid quality/size relation), but recently found the recordings are now super choppy — both audio and video start skipping after the first few seconds.
Example command:
ffmpeg -f x11grab -video_size 1920x1080 -i :0.0 -f pulse \
-i alsa_output.usb-Generic_ThinkPad_Dock_USB_Audio-00.analog-stereo.monitor \
-- output.webm
Also tried playing around with video & audio codecs (e.g. -c:v vp9 and -c:a libopus respectively), but essentially found no reasonable improvement.
Played around with following options as well (was expecting -thread_queue_size option at least to make a difference), but no joy:
-framerate 30
-thread_queue_size 4096
-preset ultrafast
-crf 20
-fragment_size 2048
Any pointers how to improve the ffmpeg command to grab video and audio for web uploads in a reasonable size/quality ratio?
Unsure what has changed compared to few years back; think last time I recorded using this command was before migrating from pulse to pipewire, although skipping audio recording still results in a choppy video.
Ideas:
- Perhaps record lossless and post-process into a format more suitable for web?