OFark / Compressarr

37 stars 0 forks source link

Multithreading #7

Closed acrane1 closed 1 year ago

acrane1 commented 2 years ago

Not really an issue, but a question/feature request. Can you enable multithreading, so that multiple conversions can be running at the same time? My GPU can handle multiple and would be a lot cleaner doing it through the app instead of running multiple instances.

OFark commented 2 years ago

As I see it there are no benefits to encoding multiple videos at the same time. It would just introduce a whole cycle of problems when it comes to testing and processing. However, you can tell FFmpeg to use multiple threads to encode. By default, this is already enabled.

However; I have no idea if the Nvidia card in a system can support more than one encoding stream at once, and if it does how many. That said FFmpeg and nvenc should use all available nvenc cores to process the video. This isn't the same as GPU cores, your GPU may look near idle but could be using all the nvenc cores, as it is supposed to when encoding.

Extra However, It is widely regarded that Hardware encoding is a really bad idea for long-term storage of videos. The size is bigger, the quality worse and the feature support lacking. It is faster, a lot faster. But you will not get as good a quality video in the same file size as you will with software encoding. But this is all subjective and depends on the content of the video, you may be perfectly happy with the quality and not have any space requirements.

acrane1 commented 2 years ago

Thanks for the clarification. So doing x265 through nvenc wouldn't yield the same quality results as going x265 through CPU. I wasn't aware of that. I knew nvenc simulated HVEC to allow use of the GPU, I wasn't aware there was a noticeable quality drop between the two.

OFark commented 2 years ago

Yeah, you can use the SSIM calculation to see the difference between the two. Create a radarr or sonarr source of one video. Create two FFmpeg presets, one for HW encoding and one not. You should be able to get something very similar in terms of numbers and see how the SSIM values compare. I find, in fast-moving videos the artifacting around objects is noticeable with HW encoding. Not so much with animated content.