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

16bit encoding broken or am I missing something? #346

Open
Selur opened this issue Sep 15, 2022 · 4 comments
Open

16bit encoding broken or am I missing something? #346

Selur opened this issue Sep 15, 2022 · 4 comments

Comments

@Selur
Copy link

Selur commented Sep 15, 2022

I'm using:
Kvazaar v2.1.0-130-g0a8e8675 2022-09-15
Kvazaar license: 3-clause BSD
(Kvazaar was build using https://github.com/m-ab-s/media-autobuild_suite)
with

ffmpeg -y -loglevel fatal -noautorotate -nostdin -threads 8 -i "G:\TestClips&Co\files\test.avi" -map 0:0 -an -sn -vf zscale=rangein=tv:range=tv -pix_fmt yuv420p16le -strict -1 -vsync 0 -f rawvideo - | kvazaar --preset medium  -i - --input-res 640x352 --input-fps 25/1 --input-format P420 --input-bitdepth 16 --level 6.2 --high-tier --qp 22 --ref 3 --subme 0 --sar 1:1 --range tv --colorprim undef --transfer undef --colormatrix bt470bg -o "E:\Output\16bit_2022-09-15@12_04_22_3410_01.265"

for the encoding and for the muxing to mp4 I use:

MP4Box -add "E:\Output\16bit_2022-09-15@12_04_22_3410_01.265"#video:fps=25:name="":lang="" -brand hvc1 -itags tool="Hybrid 2022.09.14.1" -tmp "E:\Output" -new "E:\Output\16bit.mp4"

aside that the encoder reports 'PSNR Y 999.9900 U 999.9900 V 999.9900' for each frame encoding seems to work fine.

Compiled: INTEL, flags: MMX SSE SSE2 SSSE3 SSE41 SSE42
Detected: INTEL, flags: MMX SSE SSE2 SSE3 SSSE3 SSE41 SSE42 AVX AVX2
Available: avx2(4)
In use: avx2(4)
--owf=auto value set to 6.
--threads=auto value set to 15.
Input: -, output: E:\Output\16bit_2022-09-15@12_04_22_3410_01.265
  Video size: 640x352 (input=640x352)
....
 Processed 429 frames,     198264 bits AVG PSNR Y 999.9900 U 999.9900 V 999.9900
 Total CPU time: 2.100 s.
 Encoding time: 2.076 s.
 Encoding wall time: 2.075 s.
 Encoding CPU usage: 100.00%
 FPS: 206.75
 Bitrate: 0.011 Mbps
 AVG QP: 27.3

Problem is output is reported by MediaInfo and FFmpeg as 10bit.

Am I missing something, or is something not working as it should?
(8bit and 10bit encoding works fine)

@Jovasa
Copy link
Member

Jovasa commented Sep 15, 2022

Kvazaar currently supports only 8 and 10 bit encoding. 12 bit might also work with some combination of tools but is not officially supported.

@Selur
Copy link
Author

Selur commented Sep 15, 2022

Okay, thanks for clearing that up.
The command line help should be updated to reflect this.
Atm. it states '--input-bitdepth : 8-16 [8]'

@fador
Copy link
Member

fador commented Sep 15, 2022

According to https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding#Profiles the only profile where the 16 bits could be used is "Main 4:4:4 16 Intra", so Intra only 🤔
But yes for sure we have not tested anything higher than 10bits.

@NeedsMoar
Copy link

According to https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding#Profiles the only profile where the 16 bits could be used is "Main 4:4:4 16 Intra", so Intra only 🤔 But yes for sure we have not tested anything higher than 10bits.

The full HEVC spec is a better reference, since the wiki table you linked specifically says it's a partial list... there are a couple more variants of the 4:4:4 16 Intra. The one more likely to be desirable as a transcoding target (that nothing supports afaik) is Monochrome 16. Notably the conformance chart requires that it be flagged with general_lower_bit_rate_constraint_flag like all of the non-intra-only / display formats, where this is optional for intra-only and the high throughput versions. There's also Main 4:4:4 16 Still Picture, and Main 4:4:4 High Throughput 16 Intra which has a more easily playable base layer that can seemingly be any bit depth below 16. There are 10 / 12 / 14-bit High Throughput and Screen Extended 10 / 14-bit High Throughput as well. They don't quite explain what the meaning or intended use of high throughput or screen extended high throughput are but given their layered structure it's probably something to do with being able to serve a stream from a higher bit depth master at the user-requested bit depth but I can't really say.

I'm pretty sure movie theaters are still using lossless encrypted jpeg2000 and the high end cameras like Sony Venice generally shoot their own raw formats, more consumer grade stuff seems to top out at 4:2:2 10-bit Intra, so I really don't know who the audience for 16-bit or 14-bit would be.

I'm not sure what the command line option "4:0:0" means, there's not a single occurrence in the ~700 page spec. Monochrome is called that, so is it something different?

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

No branches or pull requests

4 participants