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

[Feature] Hardware transcoding on macOS (VideoToolbox) #4945

Closed
honeybeaver opened this issue Jun 7, 2024 · 2 comments · Fixed by #4986
Closed

[Feature] Hardware transcoding on macOS (VideoToolbox) #4945

honeybeaver opened this issue Jun 7, 2024 · 2 comments · Fixed by #4986

Comments

@honeybeaver
Copy link

Is your feature request related to a problem? Please describe.

In connection to this feature in the 0.26.0:

When enabled, full hardware transcoding is used where possible. (#4765)

I tested this on a Mac with Apple Silicon. It appears ffmpeg HW transcoding does not use VideoToolbox on Mac yet, when streaming media.

Describe the solution you'd like

When on macOS, test & use these flags in ffmpeg to enable HW transcoding using VideoToolbox (from ffmpeg docs):

To use H.264/HEVC hardware encoding in macOS, just use the encoder -c:v h264_videotoolbox or -c:v hevc_videotoolbox for H.264 or HEVC respectively.

Describe alternatives you've considered

Without hardware acceleration, software transcoding works on the CPU. In most cases though, transcoding takes a lot CPU time, either making it not possible to transcode quickly enough (rare) or affecting other apps running on the machine (common).

Additional context

This may also apply to decode and other times ffmpeg is converting media, such as scan and previews, and not just streaming.

Intel Macs also use this method to access hardware encoding.

Searching the code, it does not look like VideoToolbox appears anywhere yet, and I didn't see a full discussion of this case in other HW transcoding discussions.

Thank you!

@feederbox826
Copy link
Contributor

The referenced full hardware transcoding is for NVIDIA cards only - I don't belive stash has a check for VideoToolbox support at all

@NodudeWasTaken
Copy link
Contributor

Unfortunately scale_vt (videotoolbox) currently doesn't call ff_scale_adjust_dimensions, meaning it cannot scale with respect to the aspect ratio unless i insert some hacks or refactor how that's done.

The referenced full hardware transcoding is for NVIDIA cards only - I don't belive stash has a check for VideoToolbox support at all

The referenced full hardware transcoding is enabled for NVIDIA, Intel and VAAPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants