javacv
javacv copied to clipboard
FFmpegFrameGrabber Hardware accelerated decoding does not take effect
Hello developer, I am making FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(rtsp); When, GPU accelerated decoding does not take effect
String rtsp = "rtsp://admin:[email protected]:554/smart265/ch1/main/video"; FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(rtsp); grabber.setVideoCodec(avcodec.AV_CODEC_ID_H265); try { grabber.start(); } catch (FFmpegFrameGrabber.Exception e) { throw new RuntimeException(e); } Frame frame; try { while ((frame = grabber.grabImage()) != null) { System.out.println(frame.imageWidth); } } catch (FFmpegFrameGrabber.Exception e) { throw new RuntimeException(e); }
You'll need to call setVideoCodeName() with the name of the hardware accelerated codec you want to use: https://trac.ffmpeg.org/wiki/HWAccelIntro
"Thank you very much. I have resolved the issue."