Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some default presets in the 'Hardware' category have undefined/blank enocders. #205

Open
9 tasks
TheNickOfTime opened this issue Aug 26, 2024 · 5 comments
Open
9 tasks
Assignees
Labels
type/bug Something isn't working

Comments

@TheNickOfTime
Copy link
Owner

TheNickOfTime commented Aug 26, 2024

This is a byproduct of how HandBrake itself handles exposing presets to users - if HandBrake cannot detect a type of hardware encoding is available, it disables/obfuscates the information about that hardware transcoder.

This is the case via the desktop version of HandBrake, which leaves the default presets .json file with a blank encoder value. This is also the case for the CLI, which when using the command HandBrakeCLI --preset-export 'preset name' will say the encoder is simply 'x264'.

Unfortunately HandBrake's own documentation must have been written by someone who has an nvidia machine, because their own CLI reference only lists nvidia hardware encoders. While I could likely guess at what these values are based on how other presets are formatted, I would prefer to leave them blank until I have a more definitive answer.

I believe the current list of unknown encoders is:

  • AV1 QSV
  • AV1 QSV (10 bit)
  • H.265 QSV
  • H.265 QSV (10 bit)
  • H.264 QSV
  • AV1 NVENC? (unsure if this is a thing)
  • Any AMD VCN encoder (currently unsupported)
  • Any Apple VideoToolbox encoder (unsupported)
  • Any Media Foundation encoder (unsupported)

If you find yourself using a platform where you could provide any of this information here is how to help:

Desktop
  1. Create custom presets with one of the above encoders (can copy one of the default presets if you like).
  2. Export the preset to file
  3. Look for the value in the .json file called 'VideoEncoder'
CLI
  1. Create a custom preset or use one of the default presets.
  2. Enter the command HandBrakeCLI --preset-export 'preset name'
  3. Look for the value in the console output called 'Video Encoder'

If you are able to obtain any of that information (even the unsupported encoders), it would be great if you could leave a comment below!

@TheNickOfTime TheNickOfTime added the type/bug Something isn't working label Aug 26, 2024
@TheNickOfTime TheNickOfTime self-assigned this Aug 26, 2024
@TheNickOfTime TheNickOfTime moved this to In Progress in Development Sep 5, 2024
@imichaelwong
Copy link

hi,
I am using the docker version(jlesage/handbrake:v24.09.1) of handbrake(v1.8.2) in my NAS, with intel N5105 CPU.
I duplicated the default hardware preset 'H.265 QSV', and export it from GUI, it shows:
"VideoEncoder": "qsv_h265",
then import it into this app, the Encoder part is missing in my preset:
image
the wired thing is that it still works, but exit after several minutes transcoding, with a 100-200M mp4 file left.

when I export it with the cli, HandBrakeCLI --preset-export 'preset name'
however, it shows:
"VideoEncoder": "x264",
not sure if it is a bug of cli.

hope this helps.
really want to use your web app for transcoding, the docker version is quite difficult for using, from GUI PoV, but it works.
please just ask if you need more information.

br

@imichaelwong
Copy link

hi,
it turns out that the cli export is not an exporting but a creation.
image
that's why the exported one is using the x264 encoder.

br

@imichaelwong
Copy link

Hi,
for the other encoders, here is my exported presets from handbrake1.8.1
presets.json

@imichaelwong
Copy link

hi, @TheNickOfTime
I did some test and found out there might be some bugs with hb cli, it always fails with preset, but work with the cli options, so I did some changes in code to hardcode to use the cli opts for my transcoding.

if (jobData.preset_id == '2m-x265') {
			jobLogger.info(
				`[worker] with preset 2m-x265, ${jobData.preset_id}, using qsv_h265 encoder.`
			);
			handbrake = spawn('HandBrakeCLI', [
				'-e',
				'qsv_h265',
				'-b',
				'2000',
				'-B',
				'160',
				'-x',
				'lowpower=1:force-cqp=1',
				'-i',
				jobData.input_path,
				'-o',
				tempOutputName,
				'--json',
			]);
		} else if (jobData.preset_id == '4m-x265') {
			jobLogger.info(
				`[worker] with preset 4m-x265, ${jobData.preset_id}, using qsv_h265 encoder.`
			);
			handbrake = spawn('HandBrakeCLI', [
				'-e',
				'qsv_h265',
				'-b',
				'4000',
				'-B',
				'160',
				'-x',
				'lowpower=1:force-cqp=1',
				'-i',
				jobData.input_path,
				'-o',
				tempOutputName,
				'--json',
			]);
		} else {
			jobLogger.info(`[worker] with another preset, using ${jobData.preset_id}`);
			handbrake = spawn('HandBrakeCLI', [
				'--preset-import-file',
				presetPath!,
				'--preset',
				jobData.preset_id,
				'-i',
				jobData.input_path,
				'-o',
				tempOutputName,
				'--json',
			]);

and it works well.

I suggest maybe you can add the cli opts in the preset creation feature, we can create a simplified preset with a few of opts.
and here are some other suggestions:

  1. selectable default file ext, currently it is mkv but I think some may prefer mp4.
  2. default preset category and preset, so user don't need to select it for every transcoding.
  3. I found the latest version 1.8.2 of handbrake bring big improvement on CPU usage, at least in my env, the usage reduced to 60% from 95%, with same speed, please consider upgrading it, or even you can use the docker version as the base image.

really like your work, appreciate it if you can consider my suggestions.
(I used to work on backend development with Java and Golang, not good at typescript, but I am trying to do the changes in my local env)

br

Michael

@TheNickOfTime
Copy link
Owner Author

Thank you for this information, as far as the encoder not appearing in the UI goes - that's definitely what is covered by this issue. In terms of the preset not exporting properly, I'll have to look into it. I need to look at the code, but I'm pretty sure when a preset is imported, no modifications are applied so the program shouldn't be changing any of the preset options.

I'll look into updating the handbrake version, right now it is just using the version available in the Debian repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

7 participants
@imichaelwong @TheNickOfTime and others