FallingSnow / h265ize

A node utility utilizing ffmpeg to encode videos with the hevc codec.
MIT License
527 stars 81 forks source link

Performance #118

Open justinglock40 opened 6 years ago

justinglock40 commented 6 years ago

Any idea why the CPU and GPU are both getting blasted? I have hevc_nvenc enabled. All the work should be happening on the GPU?

justinglock40 commented 6 years ago
screenshot at feb 05 09-32-25
FallingSnow commented 6 years ago

Can you run h265ize with the --debug flag and provide the ffmpeg query?

Firstly, cpu will always have to do some work, it is still moving the video frames in and out of memory as well as writing them to disk. From my tests with a 6700hq, I get about 30% cpu and 100% gpu when encoding with intel quicksync.

Second you might be decoding with the cpu and encoding with the gpu, which is probably what is happening here. Maybe you would be able to do both encoding and decoding on the gpu. But even in that case you would still have to use the cpu to move frames: ram -> gpu (decode) -> ram -> gpu(decode) -> ram -> disk. I believe I've read of ways to do it without copying an extra time to ram but I don't think I've ever done it.

TL;DR Either way the cpu is gonna have to feed the gpu and use some cpu, so don't expect 3% cpu usage.

justinglock40 commented 6 years ago

What flags should be used to encode/decode on the GPU

Sent from my iPhone

On Feb 5, 2018, at 23:44, Ayrton Sparling notifications@github.com wrote:

Can you run h265ize with the --debug flag and provide the ffmpeg query?

Firstly, cpu will always have to do some work, it is still moving the video frames in and out of memory as well as writing them to disk. From my tests with a 6700hq, I get about 30% cpu and 100% gpu when encoding with intel quicksync.

Second you might be decoding with the cpu and encoding with the gpu, which is probably what is happening here. Maybe you would be able to do both encoding and decoding on the gpu. But even in that case you would still have to use the cpu to move frames: ram -> gpu (decode) -> ram -> gpu(decode) -> ram -> disk. I believe I've read of ways to do it without copying an extra time to ram but I don't think I've ever done it.

TL;DR Either way the cpu is gonna have to feed the gpu and use some gpu, so don't expect 3% cpu usage.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

FallingSnow commented 6 years ago

This is outside the scope of h265ize since h265ize doesn't even support hw encoding but you would want to specify a hw decoder codec for the input and a hw encoder codec for the output. Ex. ffmpeg -v:c hevc_nvenc -i video.mkv -c:v hevc_nvenc output_video.mkv

RCFilm commented 5 years ago

This is outside the scope of h265ize since h265ize doesn't even support hw encoding but you would want to specify a hw decoder codec for the input and a hw encoder codec for the output. Ex. ffmpeg -v:c hevc_nvenc -i video.mkv -c:v hevc_nvenc output_video.mkv

Could you add to this.... I am building an unraid pkg with Nvidia support. Here is my git. ... https://github.com/RCFilm/h265ize-nvidia-docker/ ... just having some trouble adding the (-v:c hevc_nvenc -i video.mkv -c:v hevc_nvenc output_video.mkv) for h265ize to use...

Any help would be great