{"id":13906499,"url":"https://github.com/dechamps/HDRCompare","last_synced_at":"2025-07-18T04:31:42.763Z","repository":{"id":147314081,"uuid":"487931447","full_name":"dechamps/HDRCompare","owner":"dechamps","description":"A suite of ffmpeg filters for comparing SDR and HDR video material","archived":false,"fork":false,"pushed_at":"2022-05-02T17:28:15.000Z","size":2096,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-16T20:50:34.262Z","etag":null,"topics":["bt2020","colorspace","ffmpeg","hdr","high-dynamic-range","libav","libavfilter","mpv","pq","video"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dechamps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-05-02T17:27:02.000Z","updated_at":"2024-10-22T16:57:38.000Z","dependencies_parsed_at":"2023-07-07T22:15:40.702Z","dependency_job_id":null,"html_url":"https://github.com/dechamps/HDRCompare","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dechamps%2FHDRCompare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dechamps%2FHDRCompare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dechamps%2FHDRCompare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dechamps%2FHDRCompare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dechamps","download_url":"https://codeload.github.com/dechamps/HDRCompare/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226344683,"owners_count":17610186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bt2020","colorspace","ffmpeg","hdr","high-dynamic-range","libav","libavfilter","mpv","pq","video"],"created_at":"2024-08-06T23:01:37.043Z","updated_at":"2024-11-25T14:31:43.964Z","avatar_url":"https://github.com/dechamps.png","language":null,"readme":"# HDRCompare: compare SDR and HDR video files\n*Brought to you by [Etienne Dechamps][] - [GitHub][]*\n\n\u003ca href=\"The-Expanse-S06E04-2941-compare.jpg\"\u003e\u003cimg src=\"The-Expanse-S06E04-2941-compare.jpg\" width=\"400\"\u003e\u003c/a\u003e\n\u003ca href=\"The-Expanse-S06E04-3053-compare.jpg\"\u003e\u003cimg src=\"The-Expanse-S06E04-3053-compare.jpg\" width=\"400\"\u003e\u003c/a\u003e\n\u003ca href=\"The-Expanse-S06E04-0036-diff.jpg\"\u003e\u003cimg src=\"The-Expanse-S06E04-0036-diff.jpg\" width=\"400\"\u003e\u003c/a\u003e\n\u003ca href=\"The-Expanse-S06E04-0839-diff.jpg\"\u003e\u003cimg src=\"The-Expanse-S06E04-0839-diff.jpg\" width=\"400\"\u003e\u003c/a\u003e\n\n## Description\n\nHDRCompare is a suite of [ffmpeg/libavfilter filters][lavfi] for comparing\nthe SDR and HDR versions of otherwise identical video material. It is useful to\ndetermine how well HDR is used in various movie releases, for example.\n\nThe basic idea is to take the SDR video and then convert it to HDR, *without*\nexpansion (i.e. preserving the original color and luminance), and then show it\nside by side with the HDR video, allowing for an easy and fair comparison.\n\nThe following filter chains are provided:\n\n- `hdr-compare.lavfi` presents the left half of the HDR video on the right side,\n  and the right half of the SDR video on the right side. Every second, the two\n  sides switch places.\n- `hdr-diff.lavfi` divides the display in 4 quadrants:\n  - Upper left: original HDR video\n  - Lower left: original SDR video\n  - Upper right: extra luminance in the HDR video\n  - Lower right: extra saturation in the HDR video\n\n`hdr-compare` is useful to get an overall feel of the difference between HDR and\nSDR across entire scenes. `hdr-diff` is useful to detect and surface any local\ndifferences.\n\n## Limitations\n\n- This is a quickly-thrown-together toy, not a tool designed for serious use. Do\n  not expect it to be accurate. No effort was spent fine-tuning various\n  parameters. The SDR to HDR colorspace conversion, in particular, is dubious at\n  best.\n  - A more serious attempt would use a proper CMS to do the gamut mapping from\n    SDR to HDR, and would likely leverage a DeltaE formula or similar to\n    highlight the differences in a perceptually accurate manner.\n- The SDR and HDR input videos must be as identical as possible (aside from the\n  colorspace difference, obviously).\n  - This is especially important for `hdr-diff`, which will behave very poorly\n    if the input is not frame-by-frame synchronized or has the slightest\n    difference in cropping.\n  - They can be different sizes though. Typically, HDR files are 2160p while\n    SDR files are 1080p. We want to focus purely on colour differences, so the\n    filters will always scale both streams to 1080p for a fair comparison.\n- The filters assume the HDR input is HDR10 (i.e. BT.2020+PQ). Dolby Vision and\n  HLG are not supported.\n- HDR metadata (i.e. peak luminance/maxCLL information) is not preserved, so the\n  HDR tone mapping is unlikely to be optimal.\n  - This can be work around by manually specifying the metadata after the\n    filter, but note that [mpv won't pass the metadata through][mpv10129] to the\n    display, in any case.\n- The filters are expensive to compute. On a good PC `hdr-compare` can typically\n  run in real time. `hdr-diff` typically won't, though it will come close.\n\n## How to use\n\nYou can apply the filter in real time using any player that is capable of\napplying a libavfilter filter chain. [mpv][] is the most obvious choice and it's\nwhat the filters were developed with.\n\nHere's an example mpv command line using Powershell:\n\n```powershell\nmpv `\n    --lavfi-complex=\"$((Get-Content -Path .\\hdr-compare.lavfi) -notmatch '^\\s*#')\" `\n    --vf=format=colormatrix=bt.2020-ncl:colorlevels=limited:primaries=bt.2020:gamma=pq `\n    \u003cPATH TO HDR FILE\u003e --external-file=\u003cPATH TO SDR FILE\u003e\n```\n\n**Note:** SDR uses relative luminance, but HDR uses absolute luminance. For this\nreason it is fundamentally difficult to ensure that both are presented at the\nsame average brightness level. Currently the filter maps 100% SDR level to 150\nnits in HDR. This is mostly arbitrary and will likely be slightly off for most\ncontent. If you observe that the HDR side is brighter overall than the SDR side\n(or vice-versa), search for the `npl=` parameter in the relevant `.lavfi` file\nto adjust the brightness of the SDR side. Note that you might find that\neven different scenes of a single movie might call for a different value.\n\n[Etienne Dechamps]: mailto:etienne@edechamps.fr\n[GitHub]: https://github.com/dechamps/HDRCompare\n[lavfi]: https://ffmpeg.org/ffmpeg-filters.html\n[mpv]: https://mpv.io/\n[mpv10129]: https://github.com/mpv-player/mpv/issues/10129\n","funding_links":[],"categories":["HarmonyOS","Others"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdechamps%2FHDRCompare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdechamps%2FHDRCompare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdechamps%2FHDRCompare/lists"}