-
Notifications
You must be signed in to change notification settings - Fork 1
H.264 NVENC fails even at 480p export (encoder still initialized with source resolution (5760x2880)) #16
Description
When exporting using H.264 NVENC (GPU), encoding fails even if the export resolution is set to 480p (854x480).
And setting the quality to 480p takes the same amount of time to process on CPU as "Match Source Resoulution" (my case: 5.7k 25fps)
The same file works correctly when:
Using CPU (x264)
Using HEVC NVENC (encoding manually via ffmpeg with proper resolution)
However, when selecting H.264 NVENC inside 360Mash, ffmpeg fails with:
Video width 5760 not within range from 48 to 4096
Device does not support required NVENC features
Error while opening encoder
AI Analysis of source code:
I am not the best of programmers, if you can even call me that. But prompting AI to examine the source code of 360Mash resulted in this suggested answer:
Analysis
RTX 30-series NVENC (including RTX 3070 Ti) has a hardware limitation for H.264:
Max encode width: 4096 pixelsThe source file is: 5760x2880 (5.7K equirectangular)
The error suggests that even when selecting Full HD export, the encoder is still initialized with the source resolution (5760x2880) instead of the selected export resolution (1920x1080).
In codec.ts → startEncoding(), ffmpeg arguments are constructed using:
let resStr = encoderDesc.width + "x" + encoderDesc.height; ... "-video_size", resStr,This implies that encoderDesc.width/height may still reflect source dimensions instead of the chosen export resolution when using NVENC.
Expected Behavior
When selecting Full HD export:The encoder should be initialized with 1920x1080
H.264 NVENC should work (since 1920 < 4096)Suggested Fix
One of the following:
- Ensure encoderDesc.width/height reflects the selected export resolution, not the source resolution.
- Automatically switch to hevc_nvenc when width > 4096.
- Add validation to prevent H.264 NVENC initialization when width exceeds hardware limits.
My source file:
5760x2880 (5.7K equirectangular) from YI 360 camera, stitched in official YI 360 software.
My system:
GPU: RTX 3070 Ti (RTX 3070 Ti NVENC has a hardware limitation for H.264: Max encode width: 4096 pixels)
OS: Windows 11
FFmpeg: 8.0.1 (Gyan full build, NVENC enabled)
Source: 5760x2880 25fps 360 video