homebridge-camera-ui icon indicating copy to clipboard operation
homebridge-camera-ui copied to clipboard

nvencoders don't support ultrafast and zerolatency

Open Littlericket opened this issue 2 years ago • 1 comments

Describe the bug Preset ultrafast and zerolatency are getting added regardless of the vcodec (except when using copy, the encoderOptions get removed in /src/accessories/camera.js:565). When using nvenc encoders, these presets have to be removed in order to use the nvenc encoder.

By setting the ffmpeg encoder options in camera.ui to an empty string or a whitespace (to remove the preset arguments), the plugin generates two empty bash arguments, which break the "-f rawvideo" argument before, so this is not an option.

To Reproduce Use nvenc_h264 as encoder

Expected behavior Working.

Logs ffmpeg crashes with RC 1

[nvenc_h264 @ 0x5652fce04640] Unable to parse option value "zerolatency"
[nvenc_h264 @ 0x5652fce04640] Error setting option tune to value zerolatency.
[nvenc_h264 @ 0x55f4acb1cb40] Unable to parse option value "ultrafast"
[nvenc_h264 @ 0x55f4acb1cb40] Error setting option preset to value ultrafast.

Littlericket avatar Sep 14 '22 11:09 Littlericket

Replacement preset should be "llhq" or "ll" (as listed at https://ffmpeg.org/doxygen/trunk/nvenc__h264_8c_source.html:44) Zerolatency works when using "-zerolatency 1" as an argument, also available https://ffmpeg.org/doxygen/trunk/nvenc__h264_8c_source.html:133

This enables stutter-free homekit streaming with nvenc. Without the presets its choppy (5-8 secs refresh rate).

Littlericket avatar Sep 16 '22 20:09 Littlericket

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 19 '22 16:11 stale[bot]