Credit Andrea with Windows.tex changes based on reading updates in CV manual
[goodguy/cin-manual-latex.git] / parts / Attributes.tex
1 \chapter{Project and Media Attributes}%
2 \label{cha:project_and_media_attributes}
3 \index{project attributes}
4 \index{format}
5 \index{settings}
6
7 When you play media files in \CGG{}, the media files have a certain
8 number of tracks, frame size, sample size, and so on.  No matter
9 what attributes the media file has, it is played back according to
10 the project attributes.  So, if an audio file's sample rate is
11 different than the project attributes, it is resampled.  Similarly,
12 if a video file's frame size is different than the project
13 attributes, the video is composited on a black frame, either cropped
14 or bordered with black.
15
16 The project attributes are adjusted in \texttt{Settings $\rightarrow$
17 Format} (figure~\ref{fig:set-format}) or can be created in
18 \texttt{File $\rightarrow$ New}.  When you adjust project settings
19 in \texttt{File $\rightarrow$ New}, a new empty timeline is created.
20 Every timeline created from this point on uses the same settings.
21 When you adjust settings in \texttt{Settings $\rightarrow$ Format},
22 media on the timeline is left unchanged.  But every timeline created
23 from this point uses the same settings.
24
25 \begin{figure}[htpb]\centering
26 \includegraphics[width=0.6\linewidth]{set-format.png}
27   \caption{Set Format window - note the Audio Channel positions}
28   \label{fig:set-format}
29 \end{figure}
30
31 In addition to the standard settings for sample rate, frame rate,
32 and frame size, \CGG{} uses some less traditional settings like
33 channel positions, color model, and aspect ratio.  The aspect ratio
34 refers to the screen aspect ratio (SAR).
35
36 Edit decision lists , the EDL \index{EDL} stored in XML, save the project
37 settings.  Formats which contain media but no edit decisions just
38 add data to the tracks.  Keep in mind details such as if your
39 project sample rate is 48\,kHz and you load a sound file with
40 96\,kHz, you will still be playing it at 48\,kHz.  Or if you load an
41 EDL file at 96\,kHz and the current project sample rate is 48\,kHz,
42 you will change it to 96\,kHz.
43
44 The New Project window has some options that are different than the
45 Set Format window as you can see by comparing
46 figure~\ref{fig:set-format} above with this
47 figure~\ref{fig:new-project}.  Mostly notably is the field for a
48 directory path and a Project Name.
49
50 \begin{figure}[htpb] \centering
51 \includegraphics[width=0.7\linewidth]{new-project.png}
52   \caption{New Project dialog window}
53   \label{fig:new-project}
54 \end{figure}
55
56 Explanation of the various fields is described next.
57
58 \section{Audio attributes}%
59 \label{sec:audio_attributes}
60 \index{audio!attributes}
61
62
63 \begin{description}
64 \item[Presets:] select an option from this menu to have all the
65 project settings set to one of the known standards.  Some of the
66 options are 1080P/24, 1080I, 720P/60, PAL, NTSC, YouTube, and CD
67 audio.
68
69 \item[Tracks:] (in New Project menu only) sets the number of audio
70 tracks for the new project. Tracks can be added or deleted later,
71 but this option is on the New Project menu for convenience.
72
73 \item[Samplerate:] \index{sample rate} sets the samplerate of the audio. The project
74 samplerate does not have to be the same as the media sample rate
75 that you load. Media is resampled to match the project sample rate.
76
77 \item[Channels:] \index{audio!channels} sets the number of audio channels for the new
78 project. The number of audio channels does not have to be the same
79 as the number of tracks.
80
81 \item[Channel positions:] the currently enabled audio channels and
82 their positions in the audio panning boxes in the track patchbay are
83 displayed in the channel position widget in the Set Format window.
84 You can see this display on the left side in
85 figure~\ref{fig:set-format} above.  Channel positions are not in New
86 Project window.
87
88   The channels are numbered.  When rendered, the output from channel
89 1 is rendered to the first output track in the file or the first
90 sound card channel of the sound card.  Later channels are rendered
91 to output tracks numbered consecutively.  The audio channel
92 positions correspond to where in the panning widgets each of the
93 audio outputs is located.  The closer the panning position is to one
94 of the audio outputs, the more signal that speaker gets.  Click on a
95 speaker icon and drag to change the audio channel location.  The
96 speakers can be in any orientation.  A different speaker arrangement
97 is stored for every number of audio channels since normally you do
98 not want the same speaker arrangement for different numbers of
99 channels.
100
101   Channel positions is the only setting that does not affect the
102 output necessarily.  It is merely a convenience, so that when more
103 than two channels are used, the pan controls on the timeline can
104 distinguish between them.  It has nothing to do with the actual
105 arrangement of speakers.  Different channels can be positioned very
106 close together to make them have the same output.
107 \end{description}
108
109
110 \section{Video attributes}%
111 \label{sec:video_attributes}
112 \index{video!attributes}
113
114 \begin{description}
115 \item[Tracks:] (in New Project menu only) sets the number of video
116 tracks the new project is assigned.  Tracks can be added or deleted
117 later, but options are provided here for convenience.
118
119 \item[Framerate:] \index{framerate} sets the framerate of the video.  The project
120 framerate does not have to be the same as an individual media file
121 frame rate that you load.  Media is reframed to match the project
122 framerate.
123
124 \item[Canvas size:] \index{canvas size} sets the size of the video output \index{output size}.  In addition,
125 each track also has its own frame size.  Initially, the New Project
126 dialog creates video tracks whose size match the video output.  The
127 video track sizes can be changed later without changing the video
128 output.
129
130 \item[Aspect ratio:] \index{aspect ratio} sets the aspect ratio; this aspect ratio refers
131 to the screen aspect ratio.  The aspect ratio is applied to the
132 video output.  The aspect ratio can be different than the ratio that
133 results from the formula: $\dfrac{h}{v}$ (the number of horizontal
134 pixels divided into the number of vertical pixels).  If the aspect
135 ratio differs from the results of the formula above, your output
136 will be in non-square pixels.
137
138 \item[Auto aspect ratio:] if this option is checked, the Set Format
139 dialog always recalculates the Aspect ratio setting based upon the
140 given Canvas size. This ensures pixels are always square.
141
142 \item[Color model:] \index{color!model} the internal color space of \CGG{} is X11 sRGB
143 without color profile. \CGG{} always switches to sRGB when applying
144 filters or using the compositing engine. Different case for
145 decoding/playback or encoding/output; the project will be stored in
146 the color model video that is selected in the dropdown.  Color model
147 is important for video playback because video has the disadvantage
148 of being slow compared to audio.  Video is stored on disk in one
149 colormodel, usually a YUV derivative.  When played back, \CGG{}
150 decompresses it from the file format directly into the format of the
151 output device.  If effects are processed, the program decompresses
152 the video into an intermediate colormodel first and then converts it
153 to the format of the output device.  The selection of an
154 intermediate colormodel determines how fast and accurate the effects
155 are.  A list of the current colormodel choices follows.
156
157   \begin{description}
158   \item[RGB-8 bit] Allocates 8\,bits for the R, G, and B channels
159 and no alpha. This is normally used for uncompressed media with low
160 dynamic range.
161   \item[RGBA-8 bit] Allocates an alpha channel to the 8\,bit RGB
162 colormodel. It can be used for overlaying multiple tracks.
163   \item[RGB-Float] Allocates a 32\,bit float for the R, G, and B
164 channels and no alpha. This is used for high dynamic range
165 processing with no transparency.
166   \item[RGBA-Float] This adds a 32\,bit float for alpha to
167 RGB-Float. It is used for high dynamic range processing with
168 transparency. Or when we don't want to lose data during workflow,
169 for example in color correction, key extraction and motion
170 tracking.
171   \item[YUV-8 bit] Allocates 8\,bits for Y, U, and V. This is used
172 for low dynamic range operations in which the media is compressed in
173 the YUV color space. Most compressed media is in YUV and this
174 derivative allows video to be processed fast with the least color
175 degradation.
176   \item[YUVA-8 bit] Allocates an alpha channel to the 8\,bit YUV
177 colormodel for transparency.
178   \end{description}
179
180 In order to do effects which involve alpha
181 channels \index{alpha channel}, a colormodel with an alpha channel must be selected.
182 These are RGBA-8 bit, YUVA-8 bit, and RGBA-Float.  The 4 channel
183 colormodels are slower than 3\,channel colormodels, with the slowest
184 being RGBA-Float.  Some effects, like fade, work around the need for
185 alpha channels while other effects, like chromakey, require an alpha
186 channel in order to be functional.  So in order to get faster
187 results, it is always a good idea to try the effect without alpha
188 channels to see if it works before settling on an alpha channel and
189 slowing it down.
190
191   When using compressed footage, YUV colormodels \index{yuv} are usually faster
192 than RGB colormodels \index{RGB}.  They also destroy fewer colors than RGB
193 colormodels.  If footage stored as JPEG or MPEG is processed many
194 times in RGB, the colors will fade whereas they will not fade if
195 processed in YUV\@.  Years of working with high dynamic range footage
196 has shown floating point RGB to be the best format for high dynamic
197 range.  16 bit integers were used in the past and were too lossy and
198 slow for the amount of improvement.  RGB float does not destroy
199 information when used with YUV source footage and also supports
200 brightness above 100\,\%.  Be aware that some effects, like
201 Histogram, still clip above 100\,\% when in floating point. See also \ref{sec:color_space_range_playback} and \ref{sec:conform_the_project}.
202
203 \item[Interlace mode:] \index{interlacing} this is mostly obsolete in the modern digital
204 age, but may be needed for older media such as that from broadcast
205 TV\@.  Interlacing uses two fields to create a frame. One field
206 contains all odd-numbered lines in the image; the other contains all
207 even-numbered lines.  Interlaced fields are stored in alternating
208 lines of interlaced source footage. The alternating lines missing on
209 each output frame are interpolated.
210 \end{description}
211
212 \section{Best practice in pre-editing}%
213 \label{sec:best_practice_pre_editing}
214
215 \CGG{} supports the simultaneous presence in the Timeline of sources with different frame sizes and frame rates. However, audio/video synchronization problems may occur due to their different timing.\protect\footnote{credit to sge and Andrew Randrianasulu}
216 Plugins that rely on the timing of each frame, for example \textit{Motion} and \textit{Interpolate} plugins, may have problems when used at the same time with engines which increase frame rate. Frame rate per definition cannot be increased without either duplicating some frames or generating them in some intelligent way. But to work reliably, the \textit{Motion} plugin requires access to all actual frames. These kinds of plugins (and also the rare cases of audio/video desync) explicitly require the \textit{Play every frame} option.
217
218 There is no problem as long as the source fps, project fps, and destination fps are identical. In most cases, high frame rates such as 120 or 144 or any fps, will be just fine for \textit{Motion} provided that source footage all has the same frame rate.
219
220 But when \textit{project} and \textit{source} frame rates are different (or \textit{project} and
221 \textit{rendered} fps), then the \CGG{} engine has to either duplicate (interpolate) some frames or throw some away. Because of this, the audio tracks and the timeline get out of sync with such accelerated (or slowed down) video. And to make \textit{Motion} plugins reliably calculate interframe changes, you have to ensure the consistent frame numbers and frame properties.
222
223 Generally, best practice is to perform the following sequence of preparations for video editing.
224
225 \begin{enumerate}
226         \item Motion stabilization, and maybe some other preparations, to improve the quality of the source video is best done under the properties identical to the properties of the original video; it may be different codec, but same frame size and same frame rate.
227         \item If you need to alter the frame rate, for example because different source clips have different frame rates, then recode all the necessary clips to the same future project frame rate. Here frame sizes can still have different sizes, but frame rates should be all the same.
228         \item Whole editing: if you need to change frame rate of some restricted part, particularly when smooth acceleration/deceleration is needed, it can be done here. But if frame rate has to be changed only due to different source fps, it is better to do it during the preparation stage.
229 \end{enumerate}
230
231 \CGG{} does not have color management \index{color management}, but we can still give some general advice on how to set color spaces:
232
233 \begin{enumerate}
234         \item Profiling and setting the monitor: \\
235         source: \textit{sRGB} $\rightarrow$ monitor: \textit{sRGB}  (we get a correct color reproduction) \\
236         source: \textit{sRGB} $\rightarrow$ monitor: \textit{rec709} (we get slightly dark colors) \\
237         source: \textit{sRGB} $\rightarrow$ monitor: \textit{DCI-P3} (we get over-saturated colors) \\
238         
239         source: \textit{rec709} $\rightarrow$ monitor: \textit{rec709} (we get a correct color reproduction) \\
240         source: \textit{rec709} $\rightarrow$ monitor: \textit{sRGB} (we get slightly faded colors) \\
241         source: \textit{rec709} $\rightarrow$ monitor: \textit{DCI-P3} (we get over-saturated colors)
242         \item It would be better to set the project as RGB(A)-FLOAT, allowing system performance, because it collects all available data and does not make rounding errors. If we can't afford it, starting from YUV type media it is better to set the project as YUV(A)8, so as not to have a darker rendering in the timeline. On the contrary, if we start from RGB signals, it is better to use RGB(A)8. If we don't display correctly on the timeline, we'll make adjustments from the wrong base (metamerism) and get false results.
243         \item Among the rendering options always set the values \\      
244         \texttt{color\_trc=...} (gamma correction) \\
245         \texttt{color\_primaries=...} (gamut) \\
246         \texttt{colorspace=...} (color spaces conversion, more depth-color); \\
247         or \\
248         \texttt{colormatrix=...} (color spaces conversion, faster).
249         
250         These are only metadata that do not affect rendering but when the file is read by a player later they are used to reproduce the colors without errors.
251 \end{enumerate}
252
253 For more tips on how \CGG{} processes colors on the timeline see  \nameref{sec:color_space_range_playback} and \nameref{sec:conform_the_project}.
254
255 %%% Local Variables:
256 %%% mode: latex
257 %%% TeX-master: "../CinelerraGG_Manual"
258 %%% End: