dtinth / superwhite

display a very bright white color on HDR-enabled displays
1.21k stars 17 forks source link

ffmpeg command #3

Open Emilgardis opened 1 year ago

Emilgardis commented 1 year ago

found a way to do this with ffmpeg and using a input image, making it into a webm, fun stuff! This is nice also since it works in firefox :D

ffmpeg -loop 1 -i image.jpg -t 5 -c:v libvpx-vp9 -pix_fmt yuv420p -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -metadata:s:v:0 master-display="G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(50000000,10)" output.webm

and for just a blank image

ffmpeg -f lavfi -i color=c=white:s=240x240:r=1:d=1 -c:v libvpx-vp9 -pix_fmt yuv420p -color_primaries bt2020 -color_trc smpte2084 -colorspace bt2020nc -metadata:s:v:0 master-display="G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(50000000,10)" blank.webm

got the display values from https://silentaperture.gitlab.io/mdbook-guide/encoding/x265.html?highlight=master-display#source-dependent-settings

edit: changed unneccessary 30 fps framerate to 1 fps, thanks @notpushkin

danbri commented 1 year ago

This should be callable from JS via ffmpeg.wasm

https://github.com/ffmpegwasm/ffmpeg.wasm

notpushkin commented 1 year ago

And setting input to color=c=white:s=240x240:r=1:d=1 brings file size down to 644B 🎉

notpushkin commented 1 year ago

@dtinth Would you be interested in a PR?

dtinth commented 1 year ago

@notpushkin yes, here’s a rough criteria:

feel free to open a PR!

notpushkin commented 1 year ago

@dtinth Here's the 644 B file I've got: https://u.ale.sh/blank.webm

Works on macOS in Firefox, Chromium, and Safari. Unfortunately I don't own iPhone or iPad so can't test there – maybe you could check it though? (I also haven't compared it with the current MP4 version.)

UPD: looks pretty much the same as MP4:

(Left to right: current MP4 version in Safari, WebM version in Safari, WebM version in Waterfox)

notpushkin commented 1 year ago

feel free to open a PR!

@Emilgardis wanna do the honors? :-)

shoyuf commented 1 year ago

can we use AVC or AV1 encode this blank video?