Skip to content
New issue

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

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

Already on GitHub? # to your account

Add apple encoder and fix extra_hw_frames bug #4986

Merged
merged 18 commits into from
Jun 24, 2024

Conversation

NodudeWasTaken
Copy link
Contributor

@NodudeWasTaken NodudeWasTaken commented Jun 18, 2024

A discord user complained that the decoder was bugging out, i suspected this was due to extra_hw_frames, jellyfin fixed this by switching from nv12 to yuv420p which disables passthrough.
Jellyfin also adds -threads 1 to cuda to save vram.

Additionally adds the apple encoder for hardware acceleration and brings the requisite fixes.
Like scale_vt lacking dimension adjustments, so we retrofitted the intel hack to calculate the dimensions and used it for apple too.
It also lacks a format switcher, so no 10bit fixes for it.
It also has a higher min resolution than anything we've seen yet, so upped the test resolution.

The only note is that given the apple encoders nature, it really sucks at startup, and given HLS's current tendency to start and stop, it makes the video look like crap.
It technically works, but i dont know that we should keep it.

Last time i fixed a bug that caused using no filter to error out because of the pixel format, so now we can add a format switcher if available.

Closes #4945

@kermieisinthehouse
Copy link
Collaborator

On this branch, I receive this error while playing any avi file under cuda:

[transcode] ffmpeg error when running command </usr/bin/ffmpeg -hide_banner -v error -hwaccel_device 0 -threads 1 -hwaccel cuda -hwaccel_output_format cuda -i video.avi -c:v h264_nvenc -rc vbr -cq 15 -movflags frag_keyframe+empty_moov -ac 2 -f mp4 pipe:>: [mpeg4 @ 0x56289828cf00] No decoder surfaces left
Error while decoding stream #0:0: Cannot allocate memory
[mpeg4 @ 0x56289828cf00] No decoder surfaces left
Error while decoding stream #0:0: Cannot allocate memory
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0

@NodudeWasTaken
Copy link
Contributor Author

On this branch, I receive this error while playing any avi file under cuda:

[transcode] ffmpeg error when running command </usr/bin/ffmpeg -hide_banner -v error -hwaccel_device 0 -threads 1 -hwaccel cuda -hwaccel_output_format cuda -i video.avi -c:v h264_nvenc -rc vbr -cq 15 -movflags frag_keyframe+empty_moov -ac 2 -f mp4 pipe:>: [mpeg4 @ 0x56289828cf00] No decoder surfaces left
Error while decoding stream #0:0: Cannot allocate memory
[mpeg4 @ 0x56289828cf00] No decoder surfaces left
Error while decoding stream #0:0: Cannot allocate memory
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0

Please check if thats fixed now.
As a side note this seems to be a ffmpeg version 4 issue

Copy link
Collaborator

@kermieisinthehouse kermieisinthehouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested working but not code reviewed

@WithoutPants WithoutPants added this to the Version 0.27.0 milestone Jun 21, 2024
@WithoutPants WithoutPants added the bug Something isn't working label Jun 24, 2024
@WithoutPants WithoutPants merged commit a4e25f3 into stashapp:develop Jun 24, 2024
2 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Hardware transcoding on macOS (VideoToolbox)
3 participants