obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

Mac-videotoolbox: Add support for VTB ProRes and HEVC encoding

Open Developer-Ecosystem-Engineering opened this issue 3 years ago • 7 comments

Description

Adds support for additional hardware encoders for HEVC and ProRes and prefers to use hardware encoders when they are available

New Encoder List 01_EncoderList_New_ARM 01_EncoderList_New_x86

New Encoder Options 02_EncoderOptions_New_HEVC 02_EncoderOptions_New_ProRes

New Profile Options 03_ProfileOptions_New_HEVC 03_ProfileOptions_New_ProRes

Motivation and Context

Hardware encoders are typically more performant than software encoders. This leaves additional system resources available for the content being captured, which typically cannot be offloaded to specialized IP blocks.

How Has This Been Tested?

macOS 13 Betas MacPro MacBook Pro M2 MacBook Pro M1 Max iMac Pro w/ T2

VTB H264 -- Works as expected VTB HEVC -- Tested with various keyframe intervals, profiles and b-frames VTB ProRes -- Tested with all listed formats, resulting files playback without issue

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Tweak (non-breaking change to improve existing functionality)
  • Performance enhancement (non-breaking change which improves efficiency)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

Since ProRes is a 4:2:2 native format, will OBS be getting 4:2:2 output support?

Also notice that the ProRes hardware/software options seem out of order relative to the rest with software first before hardware.

energizerfellow avatar Aug 19 '22 01:08 energizerfellow

I guess this PR is in a good state now.

@Developer-Ecosystem-Engineering just two outstanding issues:

  1. (Required) Please rebase to take the L10N changes to the locale file into account
  2. (Nice-To-Have) If possible order the appearance of ProRes encoders in the dropdown to match the ordering of the other encoders (Hardware variant comes first, Software variant comes second). This is a non-blocker.

PatTheMav avatar Aug 23 '22 10:08 PatTheMav

Hi, I know this isn't seeking testers but I was just testing this pull and had some feedback:

Remuxed mp4s made with Apple VT HEVC Hardware Encoder aren't openable in QuickTime, Final Cut, or other Mac software because it looks like they're encoded with hev1 instead of hvc1, and the Apple ecosystem seems to prefer (or 'require') hvc1. They can be somewhat trivially re-tagged with ffmpeg and made usable, but if possible they should use hvc1 right out of OBS, no?

jcm93 avatar Sep 07 '22 16:09 jcm93

Hi, I know this isn't seeking testers but I was just testing this pull and had some feedback:

Remuxed mp4s made with Apple VT HEVC Hardware Encoder aren't openable in QuickTime, Final Cut, or other Mac software because it looks like they're encoded with hev1 instead of hvc1, and the Apple ecosystem seems to prefer (or 'require') hvc1. They can be somewhat trivially re-tagged with ffmpeg and made usable, but if possible they should use hvc1 right out of OBS, no?

That is a correct observation, I think we stumbled on this internally as well. Could you please open an issue for this so we can track it?

PatTheMav avatar Sep 07 '22 16:09 PatTheMav

That is a correct observation, I think we stumbled on this internally as well. Could you please open an issue for this so we can track it?

Sure, will do

https://github.com/obsproject/obs-studio/issues/7322

jcm93 avatar Sep 07 '22 16:09 jcm93

A bit more feedback on this: It seems that OBS currently can't remux ProRes mkv recordings. Here's the error that appears in the OBS log when attempting a ProRes remux:

13:03:56.084: media_remux: Error opening output file: Invalid argument

jcm93 avatar Sep 19 '22 19:09 jcm93

A bit more feedback on this: It seems that OBS currently can't remux ProRes mkv recordings. Here's the error that appears in the OBS log when attempting a ProRes remux:

13:03:56.084: media_remux: Error opening output file: Invalid argument

Good point, I dunno if we need to check flags for this to make ffmpeg behave - it's an officially unauthorised implementation of ProRes, so breakage be expected.

Feel free to open an issue about this, though we probably won't be able to look into it before we merged this PR.

PatTheMav avatar Sep 19 '22 19:09 PatTheMav

A bit more feedback on this: It seems that OBS currently can't remux ProRes mkv recordings.

I believe that is correct. MP4 is a subset of QuickTime which only allows certain codecs, of which ProRes is not one. OBS should still be able to remux from MKV, except it should remux to MOV, not MP4.

I get a similar error when I try to write an MP4 file with PCM audio using VirtualDub2.

mufunyo avatar Sep 25 '22 23:09 mufunyo

PR will likely be manually merged via https://github.com/obsproject/obs-studio/compare/master...vt-hevc-prores so I've deleted the old branch and retargeted it to master again.

derrod avatar Oct 23 '22 13:10 derrod

We merged this manually in #7710. Thank you very much for the PR.

gxalpha avatar Nov 02 '22 21:11 gxalpha