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

Ability to set Profile #26

Open
RushingAlien opened this issue Mar 13, 2024 · 12 comments
Open

Ability to set Profile #26

RushingAlien opened this issue Mar 13, 2024 · 12 comments

Comments

@RushingAlien
Copy link

RushingAlien commented Mar 13, 2024

Profiles are not part of encoder option, but part of src pads

vah265enc

  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h265
                profile: { (string)main, (string)main-10 }
                  width: [ 1, 7680 ]
                 height: [ 1, 4352 ]
              alignment: au
          stream-format: byte-stream

vah264enc

  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h264
                profile: { (string)constrained-baseline, (string)main, (string)high }
                  width: [ 1, 4096 ]
                 height: [ 1, 2160 ]
              alignment: au
          stream-format: byte-stream
@fzwoch
Copy link
Owner

fzwoch commented Mar 13, 2024

I would think the encoder select the proper ones depending on what features are being selected and used by the encoder? I haven't checked though..

Having features and profiles independently select-able is a UI nightmare in my opinion as it is unclear who wins, and probably just results in an error in case of mismatch.

@RushingAlien
Copy link
Author

hm... then what encoder option would trigger those?
or does it depend on the video stream it receives through the sink pad?

in any case, asking cause ffmpeg-vaapi, quicksync, etc has those options
gambar

@fzwoch
Copy link
Owner

fzwoch commented Mar 13, 2024

Ok, AVC and HEVC are a bit different here.

In AVC you could for example select to have b-frames, which cannot exist in baseline/constraint-baseline for example.

It is a bit less complex on the HEVC side. The decision on your example should be auto-selected depending on your set output format in OBS. As personally I do not see much sense when you select an 8-bit output format you want to encode with 10-bit. Or vice versa, if you set OBS to composite in 10-bit, why would you want your encode to be done in 8-bit then.

I guess there can be occasions were someone explicitly wants that - but I guess these are the rare edge cases. I blame it on the Pareto principle..

@RushingAlien
Copy link
Author

ah, so if the video stream obs creates is 10 bit, vah265enc would automatically choose a 10-bit output? Then i too see this manual as very low priority.

@fzwoch
Copy link
Owner

fzwoch commented Mar 13, 2024

ah, so if the video stream obs creates is 10 bit, vah265enc would automatically choose a 10-bit output?

I'd hope so. I think I verified that it is/was working at some point.. I hope it still does!

@RushingAlien
Copy link
Author

RushingAlien commented May 25, 2024

gambar

I have confirmed that it does not, and below is the setting i used.
gambar

@fzwoch
Copy link
Owner

fzwoch commented May 25, 2024

yuv420p10 sounds like 10 bit to me.

@RushingAlien
Copy link
Author

Oh sorry I meant the "Main" part which says the profile. For example this is an obs-ffmpeg encoded video with main10 profile set

gambar

@fzwoch
Copy link
Owner

fzwoch commented May 26, 2024

I need to check some time whats happening here. I'm not even sure what Main 10 and yuv420p10 together means. Main 10 shoul dbe 8 bit only, so no idea what to make out of it. Not that i think it makes a difference.. but bt.709 and 10 bit is probably not a good pair.

@fzwoch
Copy link
Owner

fzwoch commented May 26, 2024

A quick test:

$ gst-launch-1.0 videotestsrc  ! vapostproc ! vah265enc ! video/x-h265,profile=main ! h265parse ! filesink location=x.265

$ mediainfo x.265 
General
Complete name                            : x.265
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
File size                                : 14.3 MiB
Frame rate                               : 30.000 FPS

Video
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L2@Main
Width                                    : 320 pixels
Height                                   : 240 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
$ gst-launch-1.0 videotestsrc ! video/x-raw,format=P010_10LE ! vapostproc ! vah265enc ! video/x-h265,profile=main-10 ! h265parse ! filesink location=x.265

$ mediainfo x.265 
General
Complete name                            : x.265
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
File size                                : 10.7 MiB
Frame rate                               : 30.000 FPS

Video
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L2@Main
Width                                    : 320 pixels
Height                                   : 240 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
$ gst-launch-1.0 videotestsrc ! video/x-raw,format=P010_10LE ! vapostproc ! vah265enc ! video/x-h265,profile=main ! h265parse ! filesink location=x.265

Fails to run!
$ gst-launch-1.0 videotestsrc  ! vapostproc ! vah265enc ! video/x-h265,profile=main-10 ! h265parse ! filesink location=x.265

Fails to run!

First is main profile at 8-bit.
Second is main-10 at 10-bit. Other than the notice of 10-bit, there is no indication about main-10.
Third one is a try to use 10-bit with main. Which fails because format and profile contradict each other.
Fourth one is a try to use 8-bit with main-10. Which fails because format and profile contradict each other.

So I guess the correct profile will be selected depending on the input color bit depth.

@RushingAlien
Copy link
Author

Hm... So is it just that gstreamer does not insert main10 as profile metadata or something?

Format profile                           : Main 10@L5@Main

This is the information i got when encoding ffmpeg with main10

@fzwoch
Copy link
Owner

fzwoch commented May 26, 2024

Perhaps.. not even sure what this exact syntax is trying to say, or where these values come from. Using x265enc I can get the Main 10 at the beginning too. Then again, why is there a Main following the level?

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

2 participants