Closed KnifeFed closed 2 years ago
I've changed the way this works now. It uses MediaInfo to scan the files to find the HDR version.
Annoyingly the results it gives are slightly different on each platform. But I think I've sorted this now. It should work in the next release.
That's great! Let me know if you need any help testing.
That's great! Let me know if you need any help testing.
I have a script that you can test if you like.
If you download the :dev tagged docker container, then once it's up and running go to
The script will go through and scan all your HDR films and add them to a database. This should show you the film, what version HDR is being used, the resolution and the audio format. This should help make sure that the dolby vision detection is working.
I don't have any dolby vision files at the moment so it's difficult to test.
Note that the data will be added over and over again for each time you run the script. you can use
I just ran it and it didn't detect Dolby Vision for any of the files, only their HDR/HDR10+ fallbacks. Dolby Atmos/DTS:X detection seems to be working great though.
These are the unique HDR format strings I get when I run mediainfo on all my DV files (a mix of UHD Blu-ray remuxes/encodes and WEB-DL:s in MKV/MP4 containers):
$ mediainfo --version
MediaInfo Command line,
MediaInfoLib - v21.09
$ find . -type f -regextype egrep -iregex '.*\b(do?vi?|dolby.?vision)\b.*\.(mp4|mkv)$' -exec mediainfo --Inform="Video;%HDR_Format/String%" {} \; | sort | uniq
Dolby Vision, Version 1.0, dvhe.05.06, BL+RPU
Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU, Blu-ray compatible / SMPTE ST 2086, HDR10 compatible
Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU, Blu-ray compatible / SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU, Blu-ray compatible / SMPTE ST 2086, HDR10 compatible
Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU, HDR10 compatible / SMPTE ST 2086, HDR10 compatible
(btw, I wasn't allowed to save the server config settings until I entered some dummy data for the Tautulli URL/API key)
Yeah, I figured it out. What is really annoying, is Plex doesn't label Dolby Vision files as HDR.
Changing the script to search all files works and detects dolby vision. But it has the downside is having to scan your entire library to find the files.
Plex does store some information about Dolby Vision, but not in the main library calls, here is my hack to get Plex to tell me rather than MediaInfo
full_info_url = f'{PLEX_URL}{i.key}?includeExternalMedia=1&checkFiles=1&asyncCheckFiles=0&X-Plex-Token={PLEX_TOKEN}'
file_details = requests.get(full_info_url,headers={'Accept': 'application/json'}).json()
for stream in file_details['MediaContainer']['Metadata'][0]['Media'][0]['Part'][0]['Stream']:
if stream['streamType'] == 1:
if 'DOVIPresent' in stream:
poster_dv()
continue
Plex does store some information about Dolby Vision, but not in the main library calls, here is my hack to get Plex to tell me rather than MediaInfo
full_info_url = f'{PLEX_URL}{i.key}?includeExternalMedia=1&checkFiles=1&asyncCheckFiles=0&X-Plex-Token={PLEX_TOKEN}' file_details = requests.get(full_info_url,headers={'Accept': 'application/json'}).json() for stream in file_details['MediaContainer']['Metadata'][0]['Media'][0]['Part'][0]['Stream']: if stream['streamType'] == 1: if 'DOVIPresent' in stream: poster_dv() continue
That's useful thanks, I have to use media info to scan for dolby atmos/dts:x anyway. Using media info also allows you to diferenciate between HDR10, HDR10+ and Dolby Vision.
I just ran the latest script and now it detected Dolby Vision in 4 out of 30 DV movies.
The ones detected are all HMAX WEB-DL:s and have this HDR format string:
Dolby Vision, Version 1.0, dvhe.05.06, BL+RPU
.
These 4 movies do not say that they're HDR in Plex since they don't have an HDR fallback.
All other DV movies are Blu-ray remuxes except one more WEB-DL that's from iTunes. That one also has the above-mentioned HDR format string. When I checked it on /api/data
it says the HDR version is hdr10 / hdr10
but it's also DV without HDR fallback (doesn't say HDR in Plex), yet still got an HDR banner.
So, none of the other strings that I mentioned earlier were detected.
Can you pull the latest plex-utills:dev container, connect to the console and run
python dv_test.py "name of film with dolby vision"
It should look like this:
root@3fc8f45bf6cb:/app# python dv_test.py "finch"
Finch - Dolby Vision - Dolby Digital Plus with Dolby Atmos
If that works then the bugs should be sorted. (restore posters script and HDR banners on 4K SDR content is fixed in the dev container too"
It did not make any difference, the same 4 files were detected and now I realize why. You're checking HDR_Format_Commercial
first and accepting that value if it exists. Here's what I get if I run that on my 30 DV movies:
$ find /films/movies/lib -type f -regextype egrep -iregex '.*\b(do?vi?|dolby.?vision)\b.*\.(mp4|mkv)$' -exec mediainfo --Inform="Video;%HDR_Format_Commercial%" {} \; | sort | uniq
Blu-ray / HDR10
Blu-ray / HDR10+
Dolby Vision
HDR10 / HDR10
If I use HDR_Format
I get:
$ find /films/movies/lib -type f -regextype egrep -iregex '.*\b(do?vi?|dolby.?vision)\b.*\.(mp4|mkv)$' -exec mediainfo --Inform="Video;%HDR_Format%" {} \; | sort | uniq
Dolby Vision
Dolby Vision / SMPTE ST 2086
Dolby Vision / SMPTE ST 2094 App 4
And if I use HDR_Format/String
(like I mentioned earlier) I get:
$ find /films/movies/lib -type f -regextype egrep -iregex '.*\b(do?vi?|dolby.?vision)\b.*\.(mp4|mkv)$' -exec mediainfo --Inform="Video;%HDR_Format/String%" {} \; | sort | uniq
Dolby Vision, Version 1.0, dvhe.05.06, BL+RPU
Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU, Blu-ray compatible / SMPTE ST 2086, HDR10 compatible
Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU, Blu-ray compatible / SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU, Blu-ray compatible / SMPTE ST 2086, HDR10 compatible
Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU, HDR10 compatible / SMPTE ST 2086, HDR10 compatible
So to determine all of…
…it seems you would need to parse the full HDR_Format/String
.
Btw, I noticed you don't have the latest version of Mediainfo in the container. In the 21.03 changelog, they state "+ Matroska: add DV support". I'm not sure what exactly that entails though since for 20.09 (the version in your container) they state "+ MKV: support of Dolby Vision metadata".
Ok that makes sense. The reason it was using HDR_format_Commercial is that if you as for HDR_Format, anything that wasn't dolby vision came back as SMPTE xxxx
I think I've sorted it now. The dv_test script will check for the HDR_Format_String which contains all of the HDR versions including dolby vision. Then if dolby isn't in the string it checks for other HDR versions.
I downloaded some dolby test files from their website which helped, as any profile 5 DV stuff worked as expected but the higher profiles with HDR fallback didn't.
If you could test it again, that would be great. dev docker has been pushed now.
At first, I got:
$ python dv_test.py "Movie Name"
Traceback (most recent call last):
File "/app/dv_test.py", line 17, in <module>
films = plex.library.section("test-files")
File "/usr/local/lib/python3.9/site-packages/plexapi/library.py", line 67, in section
raise NotFound('Invalid library section: %s' % title) from None
plexapi.exceptions.NotFound: Invalid library section: test-files
I changed it to films = plex.library.section("Movies")
and then it ran on the whole library. It seems like everything is working perfectly now, including 4K SDR! 👍
I assume /api/data
wasn't supposed to work in this release? Because that data remained the same.
I assume /api/data wasn't supposed to work in this release? Because that data remained the same. no, I didn't change any of that. I was just trying to get something together quickly.
I'll merge that into the poster script and then it should be good to go so I'll close this.
Thanks for the help.
Thank you, great job!
I just ran this on all my movies and none of the Dolby Vision files got a DV banner. Then I saw this on the "Recreate HDR Posters" page: "You will need to have "Dolby Vision" or "HDR10" included in your filename for this detection to work.".
I use the original filenames for all movie files so none of them have the exact term
Dolby Vision
in them, it's eitherDV
orDoVi
.Would it be possible to add support for this type of naming scheme, e.g. with a regex like
\b(dv|dovi|dolby.?vision)\b
? Alternatively, allow for the user to supply their own regex to match.