disguise-one / hap-encoder-adobe-cc

Community-supported exporter of HAP codec family for Adobe CC applications
Other
169 stars 15 forks source link

exported Hap Alpha movies are tagged as 24-bit causing alpha to be ignored #25

Closed bangnoise closed 4 years ago

bangnoise commented 5 years ago

Export a Hap Alpha movie. Import into AE or otherwise check the stored colour information.

The stored Sample Description (stsd) has a depth of 24 where it should be 32.

Need to check other alpha-bearing variants.

bangnoise commented 5 years ago

some apps ignore the value in the sample description, but some (such as AE) heed it, so it needs to be correct

GregBakker commented 5 years ago

Might be this spot in ffmpeg then https://github.com/FFmpeg/FFmpeg/blob/05a61a02d628a04fa8a672ef062adf4de2ed7df6/libavformat/movenc.c#L1990 and the fix would be

videoStream_->codecpar-> bits_per_coded_sample = 32

in our code https://github.com/disguise-one/hap-encoder-adobe-cc/blob/master/source/premiere_CC2018/movie_writer/movie_writer.cpp#L66

Need to check over movenc.c carefully, make sure we're setting everything in codecpar correctly.

exscriber commented 5 years ago

@GregBakker, your fix works for me. but non-alpha codecs need to stay 24bit, something like this:

+    // for alpha codec variants: Hap5 and HapM - set sample depth to 32bit instead of default 24bit
+    if (videoFormat[3] == '5' || videoFormat[3] == 'M') {
+        videoStream_->codecpar->bits_per_coded_sample = 32;
+    }

https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/hapenc.c#L257-L275

GregBakker commented 4 years ago

Was fixed in c2b269d8d66ec838749520ad024f21b286d891ec around 21-Feb-2019

GregBakker commented 4 years ago

[checks if encoder needs alpha]