javacv
javacv copied to clipboard
x11grab gpu accelerate
I want to use gpu acceleration when record x11 screen, code below:
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(":0.0");
grabber.setFormat("x11grab");
grabber.setFrameRate(20);
grabber.setOption("hwaccel", "cuda");
grabber.setOption("hwaccel_device", "0");
when i see output in nvidia-smi
, but the process is not showing up. is something wrong with the code ?
BTW, the command line takes effect
ffmpeg -f x11grab -framerate 20 -hwaccel cuda -i :0.0 out.mp4
We probably need to enhance FFmpegFrameGrabber somehow for that to work, but contributions are welcome!