Moving efficiently in the CLI
Copied from: Moving efficiently in the CLI
Copied from: Moving efficiently in the CLI
Capture a video of a given X Window with gstreamer.
xwininfo
#!/bin/bash | |
# ================================================================== | |
# This script will compile and install a static ffmpeg build with | |
# support for NVENC in Ubuntu. Developed in Ubuntu 22.04 LTS, | |
# with NVIDIA Drivers v510.73 and CUDA v11.6 | |
# It assumes NVIDA drivers are installed and that you have a | |
# CUDA-compatible GPU. You can check installed drivers with: | |
# $ apt list *nvidia-driver-* | grep installed | |
# $ nvidia-smi | |
# ================================================================== |
# https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks | |
# https://forums.developer.nvidia.com/t/does-modprobe-d-nvidia-conf-nvreg-enablestreammemops-need-to-be-set-for-gpudirect-to-work/79511 | |
# https://github.com/NVIDIA/open-gpu-kernel-modules/blob/main/src/nvidia/interface/nvrm_registry.h | |
# Requires nvidia.ko >= 510.40.3 loaded with PeerMappingOverride=1. https://docs.nvidia.com/nvshmem/install-guide/index.html | |
# https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers/en | |
# https://github.com/ventureoo/nvidia-tweaks | |
# https://nvdam.widen.net/s/k8vrp9xkft/tech-overview-magnum-io-1790750-r5-web | |
# https://developer.download.nvidia.com/devzone/devcenter/cuda/docs/GPUDirect_Technology_Overview.pdf | |
# https://docs.nvidia.com/nvshmem/pdf/NVSHMEM-Installation-Guide.pdf |
#!/usr/bin/env bash | |
# 1. Download and install the QEMU hook helper from here: https://github.com/PassthroughPOST/VFIO-Tools | |
# 2. Place this file in /etc/libvirt/hooks/qemu.d/NAME OF YOUR VM/prepare/begin/disable-fb.sh | |
# 3. Make disable-fb.sh executable. | |
VM_NAME="$1" | |
echo "libvirt-qemu disable-fb: Disabling efi-framebuffer to prepare to pass GPU to VM $VM_NAME" > /dev/kmsg 2>&1 | |
echo "efi-framebuffer.0" > /sys/bus/platform/devices/efi-framebuffer.0/driver/unbind |
If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.
Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:
ffmpeg -i <inputfile> -pass 1 \
-filter:v hwupload_cuda,scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos,hwdownload,format=nv12 \
-c:v hevc_nvenc -profile main -preset slow -rc vbr_2pass \
Because PowerMizer settings in NVIDIA X Server Settings doesn't persist across sessions, | |
attempts to overclock can become a nuisance. | |
The following documents the three CLI settings to modify the Preferred Mode as desired: | |
# Auto: | |
nvidia-settings -a [gpu:0]/GPUPowerMizerMode=2 | |
# Adaptive: | |
nvidia-settings -a [gpu:0]/GPUPowerMizerMode=0 |
It "types" the contents of the clipboard.
Why can't you just paste the contents you ask? Sometimes pasting just doesn't work.
The Windows version is written in AutoHotKey and easily compiles to an executable. It's a single line script that maps Ctrl-Shift-V to type the clipboard.
Debian or Kali Linux installed to as KVM (libvirtd) guests do not automatically have qemu-guest-agent or spice-vdagent installed. This will prevent seamless movement of the mouse cursor between the guest and host desktop in Virtual Machine Manager (requiring the use of a Ctrl-Alt to release the cursor from the guest window).
To cure this, install both qemu-guest-agent and spice-vdagent on each guest and reboot (the guests).
$ sudo apt install qemu-guest-agent
$ sudo apt install spice-vdagent
sudo pacman -S qemu python python-pip
sudo pacman -S qemu virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat
sudo pacman -S ebtables iptables
sudo systemctl enable libvirtd.service
sudo systemctl restart libvirtd.service
sudo virsh net-start default