javacv icon indicating copy to clipboard operation
javacv copied to clipboard

x11grab gpu accelerate

Open tank520 opened this issue 1 year ago • 1 comments

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

tank520 avatar Jan 11 '24 07:01 tank520

We probably need to enhance FFmpegFrameGrabber somehow for that to work, but contributions are welcome!

saudet avatar Jan 11 '24 08:01 saudet