Changes between Version 15 and Version 16 of colorspace
- Timestamp:
- May 2, 2024, 7:26:21 PM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
colorspace
v15 v16 47 47 == How to use FFmpeg to convert the colorspace == 48 48 49 Pixel format conversion is often performed by [https://ffmpeg.org/libswscale.html libswscale], which you will most likely access through the [https://ffmpeg.org/ffmpeg-scaler.html FFmpeg Scaler] or the scale [https://ffmpeg.org/ffmpeg-filters.html#scale-1 video filter]. 49 Pixel format conversion is often performed by [https://ffmpeg.org/libswscale.html libswscale], which you will most likely access through the [https://ffmpeg.org/ffmpeg-scaler.html FFmpeg Scaler] or the scale [https://ffmpeg.org/ffmpeg-filters.html#scale-1 video filter]. 50 50 51 51 Other video filters include: … … 56 56 === Comparing and contrasting `colorspace`, `colormatrix`, libswscale, and `zscale` === 57 57 58 - `colorspace` and `colormatrix` can only convert YUV to YUV 58 - `colorspace` and `colormatrix` can only convert YUV to YUV 59 59 - libswscale can convert between YUV and RGB 60 60 - `colormatrix` only supports 8bpc (8-bit per component) pixel formats 61 61 - `colorspace` supports 8bpc, 10bpc, and 12bpc 62 - `colormatrix` does not apply gamma and primaries correction (i.e. which exact color "red", "green", and "blue" each is) 62 - `colormatrix` does not apply gamma and primaries correction (i.e. which exact color "red", "green", and "blue" each is) 63 63 - `colorspace` applies gamma and primaries correction by default. (Use `fast=1` to disable this for faster conversion or to make output compatible with output produced by `colormatrix`.) 64 64 - `colormatrix` is C only, whereas `colorspace` uses x86 SIMD so it's faster 65 65 - `colormatrix` produces horrible quality for 10bpc and 12bpc 66 - `colorspace` produces something decent for 10bpc 67 - For 8bpc, `colorspace` seems to produce slightly better quality than `colormatrix` 66 - `colorspace` produces something decent for 10bpc 67 - For 8bpc, `colorspace` seems to produce slightly better quality than `colormatrix` 68 68 - `zscale` produces better results at all bit depths 69 69 … … 84 84 See also [https://stackoverflow.com/a/69251961 F.X.'s HDR answer] and [https://stackoverflow.com/a/55411219 Gyan's sRGB output answer]. If `srgb` does not work, try the more academic name `iec61966-2-1`. 85 85 86 === "color_primaries" === 87 88 ͏ Quick reference for somewhat cryptic "color_primaries" names:\\ 89 ͏ 1: "bt709" (BT.709)\\ 90 ͏ 5: "bt470bg" / "gamma28" (BT.470 BG)\\ 91 ͏ 6: "smpte170m" (SMPTE 170 M)\\ 92 ͏ (alike for "colorspace" "color_trc")\\ 93 ͏ .\\ 94 ͏ See also:\\ 95 (!`ffmpeg -h full` derived)\\ 96 [[ 97 {{{ 98 -color_range <int> color range (from 0 to INT_MAX) (default unknown) 99 0 unknown Unspecified 100 unspecified 101 1 tv MPEG (( 219 * 2^( n - 8 ) )) 102 mpeg 103 limited 104 2 pc JPEG (( 2^( n - 1 ) )) 105 jpeg 106 full 107 108 -colorspace <int> color space (from 0 to INT_MAX) (default unknown) 109 0 rgb RGB 110 1 bt709 BT.709 111 2 unknown Unspecified 112 unspecified 113 4 fcc FCC 114 5 bt470bg BT.470 BG 115 6 smpte170m SMPTE 170 M 116 7 smpte240m SMPTE 240 M 117 8 ycgco YCGCO 118 ycocg 119 9 bt2020nc BT.2020 NCL 120 bt2020_ncl 121 10 bt2020c BT.2020 CL 122 bt2020_cl 123 11 smpte2085 SMPTE 2085 124 12 chroma-derived-nc Chroma-derived NCL 125 13 chroma-derived-c Chroma-derived CL 126 14 ictcp ICtCp 127 15 ipt-c2 IPT-C2 128 16 ycgco-re YCGCO-R (even add) 129 17 ycgco-ro YCGCO-R (odd add) 130 131 -color_primaries <int> color primaries (from 1 to INT_MAX) (default unknown) 132 1 bt709 BT.709 133 2 unknown Unspecified 134 unspecified 135 4 bt470m BT.470 M 136 5 bt470bg BT.470 BG 137 6 smpte170m SMPTE 170 M 138 7 smpte240m SMPTE 240 M 139 8 film Film 140 9 bt2020 BT.2020 141 10 smpte428 SMPTE 428-1 142 smpte428_1 143 11 smpte431 SMPTE 431-2 144 12 smpte432 SMPTE 422-1 145 22 jedec-p22 JEDEC P22 146 ebu3213 EBU 3213-E 147 148 -color_trc <int> color transfer characteristics (from 1 to INT_MAX) (default unknown) 149 1 bt709 BT.709 150 2 unknown Unspecified 151 unspecified 152 4 gamma22 BT.470 M 153 5 gamma28 BT.470 BG 154 6 smpte170m SMPTE 170 M 155 7 smpte240m SMPTE 240 M 156 8 linear Linear 157 9 log100 Log 158 log 159 10 log316 Log square root 160 log_sqrt 161 11 iec61966-2-4 IEC 61966-2-4 162 iec61966_2_4 163 12 bt1361e BT.1361 164 bt1361 165 13 iec61966-2-1 IEC 61966-2-1 166 iec61966_2_1 167 14 bt2020-10 BT.2020 10-bit 168 bt2020_10bit 169 15 bt2020-12 BT.2020 12-bit 170 bt2020_12bit 171 16 smpte2084 SMPTE 2084 172 17 smpte428 SMPTE 428-1 173 smpte428_1 174 18 arib-std-b67 ARIB STD-B67 175 }}} 176 ]]\\ 177 ͏ [ Still cryptic whatsoever... ] 178 86 179 == Examples (Made using [https://zeranoe.com/builds/win64/static/ffmpeg-20190416-e2f766e-win64-static.zip zeranoe 20190416]) == 87 180 … … 105 198 [[BR]] 106 199 ==== `colorspace` (yuv444p10le): ==== 107 Note: SSIM > 99.98% with [#Theinputsourcergb24: The input source (rgb24)]. Should be 100% if the conversion algorithms are improved, though. 200 Note: SSIM > 99.98% with [#Theinputsourcergb24: The input source (rgb24)]. Should be 100% if the conversion algorithms are improved, though. 108 201 {{{ 109 202 ffmpeg -i "origin(rgb24).png" -c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" -pix_fmt yuv444p10le -sws_flags spline+accurate_rnd+full_chroma_int -vf "colorspace=bt709:iall=bt601-6-625:fast=1" -color_range 1 -colorspace 1 -color_primaries 1 -color_trc 1 "colorspace_yuv444p10le.avi"
