Skip to content

Commit 25812a7

Browse files
authored
Adding some ffmpeg OCIO docs, along with Conan build instructions. (#116)
* Adding ffmpeg-8.1 build, including OCIO. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Fixing the tests, so that they pass, to make it easier to identify when things change. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Formatting updates Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Minor bug-fixes and cleanup. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * First version of conan build, especially for windows. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Conan WIP. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Conan update, got a build on windows, still not with ocio. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Got the windows and osx build working for conan. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Fixed table. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Conan updated docs. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Adding container using aswf container. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * osx and windows build. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Patch 8.1 to include the fix for ocio, that didnt actually make it in there. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Adding the linux bunlding code, and adding the ocio patch. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Documentation update. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Revising the linux bundling. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Updated conan build for rhel9. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Fixes to build ffmpeg-8.1 docker container. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Here are some commands for a docker image made using conan. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Enabling aom libx265 and zscale, along with making static builds. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Enabling x265 and aom and zimg everywhere. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Make sure that libvmaf can be built statically. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Fix to get it to find the libvmaf static lib. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Need C++ too. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Currently disabling x265, AOM and zimg Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Replacing -vframes with -frames:v since -vframes is being retired. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Updating the build ffmpeg docs. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Bump to ffmpeg-8.1 Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Bump example to 10-bit. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Making FFmpeg and MacOS labeling more consistent. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Lots of minor corrections. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * More fixes. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Use names not number. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * nav_order. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Docs update. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Static build. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Image cleanup. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Refined the conan build instructions. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Adding an extreme example. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> * Adding notes on quantization. Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org> --------- Signed-off-by: Sam.Richards@taurich.org <Sam.Richards@taurich.org>
1 parent c36b8bd commit 25812a7

File tree

163 files changed

+4174
-571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+4174
-571
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ We are attempting to do all the documentation using markdown, in particular usin
1616

1717
## Coding Style
1818

19-
The test suite has been developed using python-3, and has been designed to work on windows, osx and linux.
19+
The test suite has been developed using python-3, and has been designed to work on Windows, MacOS and Linux.
2020

2121
## How to Contribute a Bug Fix or Change or additional Documentation
2222

@@ -26,4 +26,4 @@ ORI Encoding Guidelines is licensed under the [Apache License 2.0](LICENSE.md) l
2626

2727
Project committers will review the contribution in a timely manner, and advise of any changes needed to merge the request.
2828

29-
[governance policies]: GOVERNANCE.md
29+
[governance policies]: GOVERNANCE.md

ColorPreservation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
layout: default
3-
title: RGB to YCrCb Conversion
3+
title: RGB to YCbCr Conversion
44
nav_order: 3
55
parent: Encoding Overview
66

77
---
88

99

1010

11-
# RGB to YCrCb Conversion <a name="yuv"></a>
11+
# RGB to YCbCr Conversion <a name="yuv"></a>
1212

13-
We would like ffmpeg to do as little as possible in terms of color space conversion. i.e. what comes in, goes out. The problem is that most of the codecs prefer to convert from RGB to YUV conversion (technically YCrCb). Do be aware that a number of codecs do support native RGB encoding (including h264, hevc, vp9, av1), but they are not typically supported in web browsers.
13+
We would like ffmpeg to do as little as possible in terms of color space conversion. i.e. what comes in, goes out. The problem is that most of the codecs prefer to convert from RGB to YUV conversion (technically YCbCr). Do be aware that a number of codecs do support native RGB encoding (including h264, hevc, vp9, av1), but they are not typically supported in web browsers.
1414

1515
The main problem is that ffmpeg by default assumes that any unknown still image format has a color space of [rec601](https://en.wikipedia.org/wiki/Rec._601) which is very unlikely to be the color space your source media was generate in. So unless you tell it otherwise it will attempt to convert from that colorspace producing a color shift.
1616

@@ -98,7 +98,7 @@ ffmpeg -y -i ../sourceimages/chip-chart-1080-noicc.png \
9898
-vf "zscale=m=709:min=709:rangein=full:range=limited"
9999
```
100100

101-
[zscale](https://github.com/sekrit-twc/zimg) is an alternative to libswscale, which does produce pretty good results for image resizing, but purely for RGB to YCrCb conversion libswscale appears very slightly better. It is required to be explicitly compiled into ffmpeg.
101+
[zscale](https://github.com/sekrit-twc/zimg) is an alternative to libswscale, which does produce pretty good results for image resizing, but purely for RGB to YCbCr conversion libswscale appears very slightly better. It is required to be explicitly compiled into ffmpeg.
102102

103103
More detailed docs are: [here](http://underpop.online.fr/f/ffmpeg/help/zscale.htm.gz)
104104

@@ -157,4 +157,4 @@ ffmpeg -y -i ../sourceimages/chip-chart-1080-noicc.png \
157157
./chip-chart-yuvconvert/spline444out_color_matrix.mp4
158158
```
159159

160-
Note, there are a lot of other flags often used with the swscale filter (such as -sws_flags spline+full_chroma_int+accurate_rnd ) which really have minimal impact in the RGB to YCrCb conversion, if you are not resizing the image. For more details on this see [SWS Flags](EncodeSwsScale.html) section.
160+
Note, there are a lot of other flags often used with the swscale filter (such as -sws_flags spline+full_chroma_int+accurate_rnd ) which really have minimal impact in the RGB to YCbCr conversion, if you are not resizing the image. For more details on this see [SWS Flags](EncodeSwsScale.html) section.

EditorialWorkflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: default
33
title: Adding Timecode and Editorial Workflow
4-
nav_order: 5
4+
nav_order: 5.1
55
parent: Encoding Overview
66
---
77

@@ -169,7 +169,7 @@ Part of the decision is whether you want a single file to also contain the audio
169169
If an AVID imports a media file with no timecode, it will default to 01:00:00:00.
170170
For this reason it can be desirable to do one of the above approaches, but do work with editorial to confirm what they would like.
171171

172-
[OpAtom](EncodeDNXHD.html#op-atom-mxf) files do not get directly imported into the AVID, instead you copy them directly into the /Users/Shared/AvidMediaComposer/Avid MediaFiles/MXF/{NUMBER} folder (e.g. /Users/Shared/AvidMediaComposer/Avid MediaFiles/MXF/2) on OSX or C:\Avid MediaFiles\MXF\{NUMBER} on windows. You can make a higher number, but Media Composer will also scan existing folders. Media composer will scan for new files and create (or update) a msmMMOB.mdb file, which is a database of the MOB ID's of the files. This can then be dragged into a Avid Bin to import the new files.
172+
[OpAtom](EncodeDNXHD.html#op-atom-mxf) files do not get directly imported into the AVID, instead you copy them directly into the /Users/Shared/AvidMediaComposer/Avid MediaFiles/MXF/{NUMBER} folder (e.g. /Users/Shared/AvidMediaComposer/Avid MediaFiles/MXF/2) on MacOS or C:\Avid MediaFiles\MXF\{NUMBER} on windows. You can make a higher number, but Media Composer will also scan existing folders. Media composer will scan for new files and create (or update) a msmMMOB.mdb file, which is a database of the MOB ID's of the files. This can then be dragged into a Avid Bin to import the new files.
173173

174174
NOTE, there is also an associated folder called UME - /Users/Shared/AvidMediaComposer/Avid MediaFiles/UME/{NUMBER} that can take [Op1a](EncodeDNXHD.html#op1a-mxf) files. However, with recent testing (version 2023.8.2.58057.0), the metadata does not reliably get imported.
175175

EncodeAv1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ ffmpeg -r 24 -start_number 1 -i inputfile.%04d.png -frames:v 200 -c:v libsvtav1
6363
```
6464

6565
| --- | --- |
66-
| **-crf 18** | This is the constant rate factor, controlling the default quality in the range 0-63. By default this is set to 50, which is a little on the low side, using values closer to 18 is recommended, but this does come at the expense of file-size. For more on this see the [CRF comparison](#crf-comparison-for-libsvtav1) below. |
66+
| **-crf 18** | This is the constant rate factor, controlling the default quality in the range 0-63. By default this is set to 50, which is a little on the low quality side, using values closer to 18 is recommended, but this does come at the expense of file-size. For more on this see the [CRF comparison](#crf-comparison-for-libsvtav1) below. |
6767
| **-preset 5** | Help with a trade-off between encoding speed and compression efficiency. Supported preset range in the 0-13. See below for comparisons |
6868

6969
See also:
@@ -124,7 +124,7 @@ Libaom has an aggressive denoiser, which can be pretty good for animated media,
124124

125125
### cpu-speed Comparison for libaom-av1
126126

127-
To help pick appropriate values with the cpu-speed flag, we have run the [Test Framework](enctests/README.html) through one of the test media. You can see that values are
127+
To help pick appropriate values with the cpu-speed flag, we have run the [Test Framework](enctests/README.html) through one of the test media. You can see those values below.
128128

129129
| ![](enctests/reference-results/aomav1-crf-test-encode_time.png) | ![](enctests/reference-results/aomav1-crf-test-encode_time_zoom.png) |
130130
| This is showing cpu-speed values against encoding time. You can see that values of 1 and 2 are more than 15 minutes, where most other encoders are closer to the 30 second range. | Same graph of cpu-speed value against encoding time a 0-500 scale. This is showing cpu-used 5 is now just twice as slow, as Libsvtav1, but at 422 vs. 420 |
@@ -146,4 +146,4 @@ See Also - note these are all guides for AOMENC (the AOM encoder that is part of
146146
Supported pixel formats:
147147
yuv420p yuvj420p yuv420p10le yuv420p12le yuv422p yuvj422p yuv422p10le yuv422p12le yuv444p yuvj444p yuv444p10le yuv444p12le
148148

149-
There is no CRF flag, so you use the -gp flag, the recommended starting point is about 100. However, we have been unable to get an substantial speed improvement over AOM.
149+
There is no CRF flag, so you use the -qp flag, the recommended starting point is about 100. However, we have been unable to get an substantial speed improvement over AOM.

EncodeDNXHD.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: default
3-
nav_order: 4.6
3+
nav_order: 4.4
44
title: DNxHD Encoding
55
parent: Codec Comparisons
66
---
@@ -76,7 +76,7 @@ comparisontest:
7676
less: 0.00195
7777
-->
7878
```console
79-
ffmpeg -y -r 24 -i inputfile.%04d.png -vframes 100 \
79+
ffmpeg -y -r 24 -i inputfile.%04d.png -frames:v 100 \
8080
-c:v dnxhd -profile:v dnxhr_444 \
8181
-color_primaries bt709 -color_range tv -color_trc bt709 -colorspace rgb \
8282
-pix_fmt gbrp10le outputfile.mov
@@ -107,7 +107,7 @@ comparisontest:
107107
less: 0.00195
108108
-->
109109
```console
110-
ffmpeg -y -r 24 -start_number 2500 -i inputfile.%04d.png -vframes 100 \
110+
ffmpeg -y -r 24 -start_number 2500 -i inputfile.%04d.png -frames:v 100 \
111111
-pix_fmt yuv422p \
112112
-vf "scale=in_range=full:in_color_matrix=bt709:out_range=tv:out_color_matrix=bt709" \
113113
-c:v dnxhd -profile:v dnxhr_sq \
@@ -137,7 +137,7 @@ comparisontest:
137137
less: 0.00195
138138
-->
139139
```console
140-
ffmpeg -y -r 24 -i inputfile.%04d.png -vframes 100 -pix_fmt yuv422p \
140+
ffmpeg -y -r 24 -i inputfile.%04d.png -frames:v 100 -pix_fmt yuv422p \
141141
-pix_fmt yuv422p \
142142
-vf "scale=in_range=full:in_color_matrix=bt709:out_range=tv:out_color_matrix=bt709"
143143
-c:v dnxhd -profile:v dnxhr_sq \
@@ -172,10 +172,9 @@ comparisontest:
172172
less: 0.00195
173173
-->
174174
```console
175-
ffmpeg -y -r 24 -i inputfile.%04d.png -vframes 100 \
176-
-vf "in_range=full:in_color_matrix=bt709:out_range=tv:out_color_matrix=bt709" \
175+
ffmpeg -y -r 24 -i inputfile.%04d.png -frames:v 100 \
176+
-vf "scale=in_range=full:in_color_matrix=bt709:out_range=tv:out_color_matrix=bt709" \
177177
-pix_fmt yuv422p10 -c:v dnxhd -b:v 175M \
178-
-vf "scale=in_color_matrix=bt709:out_color_matrix=bt709" \
179178
-color_primaries bt709 -color_range tv -color_trc bt709 -colorspace bt709 \
180179
outputfile.mov
181180
```

EncodeHTJ2K.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: default
3-
nav_order: 4.5
3+
nav_order: 4.7
44
title: JPEG2000 HTJ2K Encoding
55
parent: Codec Comparisons
66
---
@@ -84,8 +84,8 @@ The advantage of using OIIO over ojph_compress are:
8484
Creating HTJ2K files can be done on the command line with oiiotool, e.g.:
8585

8686
```console
87-
oiiotool -t STARTFRAME-ENDFRAME parallel-frames -i INPUTFRAMESEQ.%05d.tif \
88-
compression htj2k --attrib jph:qstep 0.001 -o OUTPUTFRAMESEQ.%05d.j2c
87+
oiiotool -t STARTFRAME-ENDFRAME --parallel-frames -i INPUTFRAMESEQ.%05d.tif \
88+
--compression htj2k --attrib jph:qstep 0.001 -o OUTPUTFRAMESEQ.%05d.j2c
8989
```
9090

9191
Without the jph:qstep flag, lossless mode is used, which is typically quite a bit smaller than many other compression schemes, but not typically small enough for reviews.
@@ -94,7 +94,7 @@ Without the jph:qstep flag, lossless mode is used, which is typically quite a bi
9494
| *–attrib jph:block_size 64,64* | The older JPEG2000 standard used to default to 32,32 but this does seem to result in a smaller file, this is the default for OIIO. |
9595
| *–attrib jph:prog_order RPCL* | (see [below](#progression-order)). |
9696

97-
While JPEG2000 can support YCrCb this openimageio implementation assumes that we are only generating RGB results.
97+
While JPEG2000 can support YCbCr this openimageio implementation assumes that we are only generating RGB results.
9898

9999
### HTJ2K Wrapping J2C files in container
100100

@@ -144,14 +144,14 @@ The progression order (typically a prog_order flag in openjph, or jph:prog_order
144144
| Flag | Meaning | When to use it |
145145
| :---- | :---- | :---- |
146146
| LRCP | Layer -\> Resolution -\> Component -\> Position | Good for progressive quality over full image, particularly useful if you have multiple layers (not currently supported by OIIO). |
147-
| RLCP | Resolution -\> Layer -\> Component -\> Position | Prioritizes lower resolutions first, allows you to load all of the layers at a lower resolution and then |
147+
| RLCP | Resolution -\> Layer -\> Component -\> Position | Prioritizes lower resolutions first, allows you to load all of the layers at a lower resolution and then load in the higher resolutions |
148148
| RPCL | Resolution -\> Position -\> Component -\> Layer | Optimized for random access and tiling. |
149149
| PCRL | Position -\> Component -\> Resolution -\> Layer | Less common, spatial prioritisation, good for large images where you are viewing zoomed in sections of it. |
150150
| CPRL | Component -\> Position -\> Resolution -\> Layer | Used when components are needed separately, e.g. YUV where you might just want Y first, rarely used in VFX. |
151151

152152
Of these settings picking either RPCL or LRCP are the two most common progression orders. OIIO does not currently support layers, so really LRCP and RLCP are very similar.
153153

154-
For many cases position can be ignored, unless you start generating particularly large images where you are only interested in part of that large picture. For example having a 360-video where you are only viewing part of the overall picture. This may be where you would also want to tweak the precincts parameters of the codec. This is definately an area that JPEG2000 comes into its own, since
154+
For many cases position can be ignored, unless you start generating particularly large images where you are only interested in part of that large picture. For example having a 360-video where you are only viewing part of the overall picture. This may be where you would also want to tweak the precincts parameters of the codec. This is definitely an area where JPEG 2000 shines, as its wavelet-based architecture allows for efficient resolution scalability and partial decoding, which is ideal for massive image datasets.
155155

156156
## HTJ2K Decoding and Playback
157157

EncodeHevc.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
---
22
layout: default
3-
nav_order: 4.5
3+
nav_order: 4.2
44
title: HEVC/H.265 Encoding
55
parent: Codec Comparisons
66
---
77

88
# HEVC/H.265 Encoding
99

10+
<details open markdown="block">
11+
<summary>
12+
Table of contents
13+
</summary>
14+
{: .text-delta }
15+
1. TOC
16+
{:toc}
17+
</details>
18+
1019
H.265 (High Efficiency Video Compression - HEVC) is one of the replacements for H.264. It allows for a reduction of file size compared to H.264 of 25-50% and supports frame formats up to 8K (UHDTV). It also has support for HDR, which we go into more [here](enctests/HDR_Encoding.html).
1120

1221
There is Browser support for H265 on Microsoft Edge, Google Chrome and Safari, but not Firefox.
@@ -16,7 +25,7 @@ See [ffmpeg h265 docs](https://trac.ffmpeg.org/wiki/Encode/H.265)
1625
There are four HEVC encoders available to ffmpeg:
1726

1827
* [libx265](#libx265)
19-
* [hevc_videotoolbox](#hevc_videotoolbox) - Available on OSX via the videotoolbox library.
28+
* [hevc_videotoolbox](#hevc_videotoolbox) - Available on MacOS via the videotoolbox library.
2029
* [hevc_nvenc](#hevc_nvenc) - NVIDIA GPU encoder.
2130
* hevc_qsv - Intel Quick Sync Video Acceleration.
2231

@@ -51,13 +60,13 @@ comparisontest:
5160
ffmpeg -r 24 -start_number 1 -i inputfile.%04d.png -frames:v 200 -c:v libx265 \
5261
-pix_fmt yuv420p10le -crf 22 -preset slow -sws_flags spline+accurate_rnd+full_chroma_int \
5362
-vf "scale=in_range=full:in_color_matrix=bt709:out_range=tv:out_color_matrix=bt709" \
54-
-color_range 1 -colorspace 1 -color_primaries 1 -color_trc 2 \
63+
-color_range tv -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 \
5564
-movflags faststart -y outputfile.mp4
5665
```
5766

5867
| -- | -- |
5968
| -preset medium | Can be one of ultrafast, superfast, verfast, faster, fast, medium, slow, slower, and placebo |
60-
| -crf 22 | Similar to h264, default is 28, but should be similar to crf 22 |
69+
| -crf 22 | Similar to h264, default is 28 which is on the low quality side |
6170
| -x265-params lossless=1 | Does lossless encoding, -crf 0 is not required |
6271
| -tag:v hvc1 | To make it "Apple "Industry standard" compliant |
6372
| -profile main | Profile can be one of main or main10 or main12 |
@@ -82,9 +91,9 @@ x265_crf(x264_crf) = 1.09 * x264_crf − 4.19
8291
Below is showing a comparison of different preset values with a crf value of 18.
8392
Its showing that you really can just encode with -preset medium or -preset slow anything higher is really not gaining you anything.
8493

85-
| ![](enctests/reference-results/hevc-test-encode_time.png) This is showing CRF values against encoding time. |
86-
| ![](enctests/reference-results/hevc-test-filesize.png) This is showing CRF values against file size. |
87-
| ![](enctests/reference-results/hevc-test-vmaf_harmonic_mean.png) This is showing CRF values against VMAF harmonic mean |
94+
| ![](enctests/reference-results/hevc-test-encode_time.png) This is showing preset values against encoding time. |
95+
| ![](enctests/reference-results/hevc-test-filesize.png) This is showing preset values against file size. |
96+
| ![](enctests/reference-results/hevc-test-vmaf_harmonic_mean.png) This is showing preset values against VMAF harmonic mean |
8897

8998
## hevc_videotoolbox
9099

EncodeMJPEG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: default
3-
nav_order: 4.5
3+
nav_order: 4.8
44
title: MJPEG Encoding
55
parent: Codec Comparisons
66
---

0 commit comments

Comments
 (0)