-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
ffprobe: add show_vt_info option #462
base: jellyfin
Are you sure you want to change the base?
Conversation
Our lives would be much easier if Linux and Windows could also provide software fallbacks like Apple does, but unfortunately this is not going to happen.
We choose to trust the capabilities reported by the driver. But if it fails (which is likely to happen especially with Intel GPUs that lack firmware), I'd rather handle software fallback in Jellyfin.
I originally wanted to put the code in
You can simply using
I agree to unify common attributes of JSON output, but some HWA/vendor specific attributes are also needed, such as driver version. |
Another problem is what json writer to use. There is no NSJSONSerialization on platforms other than Apple, so we have to use the json utils provided by ffmpeg. But the data format must be the same on all platforms. |
VideoToolbox info is specifically for Apple platforms so that is fine to use that as it is easier to work with than the ffmpeg one. As long as the serialized json has the same schema I think we should be fine.
The change to original file is quite small though? You just push one more option into the ffprobe.c, adding more includes, and all other logics are handled in our own files which makes the conflicts easy to be resolved. 44cd30b
If we can disable all other things we can just not depends on ffmpeg at all and make a lightweight standalone tool ourselves though? Fix enable-shared is not trivial due to ffmpeg's weird build system and clang's special linkers. The portable builds are expected to be fully static though, and windows was the only outlier in the history. Is there anything that ffmpeg provides other than type enums that has to be used here?
This requires a transcoder rewrite though. We catch the exit status and retry with pure software. Some problematic hardware does not even fail the pipeline but just output wrong pictures, and I think that will require admin actions. |
d6887dc
to
44cd30b
Compare
I guess you could mix NSJSON with ffmpeg's json writer. But if you don't use ffmpeg's writer at all, the output might be hard to handle, and you'd need to manually manage the sections to be consistent with other platforms. And the output is limited to json. ffprobe's default format is not supported.
It should be feasible to just add a few new options with
Then it will be a problem to distribute this standalone tool downstream, such as the Archlinux repo which builds from source. And there is no need to create a new package for this. In addition, some headers and compat(dyn linked cuda/nvml) libs require ffmpeg/configure.
In the worst case the |
It is not that easy as the data type inside is completely different
Current sections are not suitable for VT specific cases anyway. The consistency is easier to handle than you think after we decided on how the output json schema would look like.
I think json only output is Okay for our use case, this is not a general cli tool for human read, and json is human friendly enough after prettify. |
It turns out that VT does have some private APIs that can get more info about the decoder and those APIs are used by Safari. Those are not exposed directly in For example: {
"VTIsHDRAllowedOnDevice": true,
"VTSupportedProfiles": [
1,
2,
3,
4
],
"VTDoViIsHardwareAccelerated": true,
"VTDoViSupportedLevels": [
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09"
],
"VTPerProfileSupport": {
"1": {
"VTMaxPlaybackLevel": 186,
"VTIsHardwareAccelerated": true,
"VTMaxDecodeLevel": 186
},
"2": {
"VTMaxPlaybackLevel": 186,
"VTIsHardwareAccelerated": true,
"VTMaxDecodeLevel": 186
},
"3": {
"VTMaxPlaybackLevel": 186,
"VTIsHardwareAccelerated": true,
"VTMaxDecodeLevel": 186
},
"4": {
"VTMaxPlaybackLevel": 186,
"VTIsHardwareAccelerated": true,
"VTMaxDecodeLevel": 186
}
},
"VTDoViSupportedProfiles": [
"05",
"08"
]
} The profile here is the number representation of HEVC general level idc, where There is also a similar method for AV1: I'm not very confident to use private APIs like this, and probably we don't need such info as:
|
Due to the existence of software fallback, Level info seems unnecessary. In addition, DoVi metadata is parsed in ffmpeg, and we only need to decode HEVC bitstream/base layer from VT. |
Changes
This adds a new option
-show_vt_info
to ffprobe when VideoToolbox is configured at build time, which output decoder and encoder info in a minimized json. For example:For decoders, only the codec name where the system declares hardware acceleration is available is printed, with no extra information. This is because:
There isn't a straightforward API to fetch detailed information for decoders. You would need to emulate a real video input, including extra data like NAL units, to check if the decoding session can be created with software fallback disabled.
VideoToolbox gracefully handles software fallback internally, making such detailed checks redundant for our use cases.
For encoders, extra data like the max dimension supported is also printed for us to pick encoders in the future.
I prefer adding this option to ffprobe rather than creating another standalone fftool. Creating an additional portable binary just for hardware info (which would be around 50-80MB) seems excessive to me.
We also need to standardize the JSON output format for hardware info across different platforms. The current draft for other hardware exposes too much unnecessary information and isn't very easy to work with.
Issues