Proxy rewritten + date change + minor
[goodguy/cin-manual-latex.git] / parts / Advanced.tex
1 \chapter{Advanced Editing}%
2 \label{cha:advanced_editing}
3
4 \section{Proxy}%
5 \label{sec:proxy}
6 \index{proxy}
7
8 Proxies were introduced to allow for a smoother timeline experience. Full HD and everything from 4K size up are usually very large in file size. In addition, some commonly used codecs (for example h264/5) are very compressed and interframe type, so they are more CPU intensive for timeline playback. These files cause performance problems on smaller computers. As a solution, proxies were introduced to reduce the file size. Reduced means to minimize the resolution/dimension, as usually not the full resolution is needed because the compositor generally occupies only a fraction of the computer screen. The proxy provides a scaling factor which indicates how much the original resolution should be reduced. 
9 There is also the \textit{proxy 1:1} \index{proxy!1:1} option that maintains the original resolution but still allows you to modify codec parameters (lowering the bit rate, for example). This is explained in the next section, \ref{sec:transcode}.
10 Always remember when getting ready to render the project, disable Proxy to return to the original settings with the highest quality.  
11
12 To use proxy in a classic way, that is as a scaling, select \texttt{Settings $\rightarrow$ Proxy settings} and change the Scale factor from Original size to your downsized choice.  You can choose ffmpeg as the \textit{File Format} \index{file format} and for the \textit{File Type} a choice of various codecs associated with that.  A good choice for \textit{File Type} is the default of mpeg or mov which can usually be quite fast.  In addition you can modify values for that codec by clicking on the wrench icon.
13
14 There are two main ways to use Proxy, with or without \texttt{Rescaled to project size} option checked. The options of the Scale factor may be different if Rescaled to project size is checked versus unchecked. It is a special case when the Scale factor is set to "1" and it does not  matter if Rescaled to project size is checked or unchecked.
15
16 The usual steps to use Proxy are:
17 \begin{enumerate}
18         \item Check that \textit{File Format} is set to \texttt{FFMPEG}.
19         \item Check or uncheck the \texttt{Rescaled to project size} (FFMPEG only). The difference with this option will be explained here \nameref{sub:rescaled_project_size_works}. But for old computers checking Rescaled to project size is not recommended. You need to know that when Rescaled to project size is unchecked some Effects/Plugins do not work as expected because they use pixel values instead of percentage values as is used in the Project Format. For example \texttt{Title}, \texttt{Blur}, \texttt{Sketcher} plugins do not work right if unchecked, while \texttt{Perspective} and \texttt{Crop\&Position} plugins work correctly for both checked and unchecked.
20         \item Choose the \textit{Scale factor}. The options may be different if Rescaled to project size is checked or unchecked. The smaller the Scale factor is, the smoother playing on the Timeline will be ($\frac{1}{8}$ is smaller than $\frac{1}{4}$), but on the Viewer/Compositor the image will be degraded/pixelated more.
21         \item Set the \textit{File Type} in the \textit{File Format} for FFMPEG, such as mp4, mpeg, or mov. Still images like jpg, tiff, and png will be converted to PNG files with alpha channel if it had an alpha channel.
22         \item Click on the wrench icon to configure video compression; just use the default values if you are unsure and prefer not to experiment.
23         \begin{enumerate}
24                 \item Select the Compressor type (codec).
25                 \item Change Bitrate, or Quality, and Pixels. Because not all codecs use the alpha channel for transparency, check that the letter "a" is in the Pixels name (such as yuva420p or rgba) to retain the alpha channel.
26                 \item Click on the OK button to close the Compressor window.
27         \end{enumerate}
28         \item Now click on the \texttt{OK} button to start the rendering for the proxy.
29         \item Look in the lower right corner of the main window where there is a progress bar and a percentage value showing the progress of the creation of proxies, and in the lower left corner there is the \texttt{Creating proxy files... ETA: hh:mm:ss} text with the "estimated time of completion" in hours, minutes, seconds. Depending on how many files your project uses, the file size, which codec is used, the scale factor, and cpu performance, creating proxies may take some time.
30 \end{enumerate}
31
32 You will know that Proxy mode is enabled because:
33 \begin{itemize}
34         \item A white colored \textbf{P} meaning \textit{Proxy}, or a white colored \textbf{S} meaning \textit{Proxy Scaled} icon is shown in the upper right corner of the main window to the left of the FF icon.  If using the Cakewalk or Neophyte theme it will be a \textbf{Ps} icon.
35         \item  The Proxy folder in the Resources window has been populated with the names and/or icons of the proxy media.
36         \item The track title bar in the timeline will have the name of the proxy file instead of the original name. So if the video filename is \texttt{VID\_20221012.mp4}, the Proxy Scale Factor is $\frac{1}{4}$, and the Proxy container is mov, then the proxy name will be \texttt{VID\_20221012.proxy4-mp4.mov}.
37 \end{itemize}
38
39 The Proxy icon is a toggle button so that you just click on the icon to change modes.  Or it can be toggled using the \texttt{Ctrl+R} shortcut. 
40
41 \begin{table}[ht]
42         \centering
43         \begin{tabular}{|p{2.5cm}|p{3.2cm}|p{3.2cm}| p{3.2cm}|}
44                 \hline
45                 \textbf{Proxy State} & \textbf{Rescaled to project size (FFMPEG only)} & \textbf{Proxy icon for themes:
46                 Cakewalk/Neophyte} & \textbf{Proxy icon for themes: the Others}\\
47                 \hline
48                 Off & checked/ unchecked & no icon
49                  & no icon\\
50                 \hline
51                 Active (Enable) & checked & Ps: P(green)  s(white)
52                  & S (white)\\
53                 \hline
54                 Disable & checked & Ps: P(red)  s(white) & S (gray)\\
55                 \hline
56                 Active (Enable) & unchecked & Ps: P(green) s(red) & P (white)\\
57                 \hline
58                 Disable & unchecked & Ps: P(red) s(red) & P (gray)\\
59                 \hline
60         \end{tabular}
61         \caption{Table: list States of the Proxy icon}
62 \end{table}
63
64 When you disable Proxy using the toggle button for Proxy, or its shortcut (\texttt{Ctrl+R}), in the Proxy Settings window you will see the \texttt{Scale Factor = 1}, but if you look at the Active Scale and the State, you can understand what your setting is.
65 Proxy can have three possible States: Off, Active, Disabled. The difference between Off and Disabled is that Disabled means you have set the Proxy and it is temporarily switched off (and you can see the icon in the upper right corner of the main window); you can enable proxy by just clicking on the icon, so the State will then be changed from Disabled to Active.
66
67 \subsection{How Rescaled to project size (FFMPEG only) works}%
68 \label{sub:rescaled_project_size_works}
69
70 \begin{itemize}
71         \item When \texttt{Rescaled to project size (FFMPEG only)} is checked, the size of the video data to be computed will always be the same as the Project Format. The size of your video is scaled down to the Scale factor BUT then it is rescaled up to the Project Format. For example, your Project Format is 1920x1080 and Proxy's Scale factor is $\frac{1}{4}$, then your videos ($1920x1080$) will be scaled down to 480x270 and then up-scaled to $1920x1080$. All the Effects/Plugins work correctly because the original resolution/geometry/size is not changed. For an old computer, this option is not recommended.
72         \item When \texttt{Rescaled to project size (FFMPEG only)} is UNchecked, the size of the video data to be computed will be reduced to the Scale factor. The size of your video is scaled down to the Scale factor. For example, your Project Format is 1920x1080 and Proxy's Scale factor is $\frac{1}{4}$, then your videos ($1920x1080$) will be scaled down to $480x270$. It works as if the Project Format were $480x270$ (and really it works). If you take a look at \texttt{Settings $\rightarrow$ Format...} when Proxy is enabled (Active), you can see that the Width and Height are changed according to the Scale factor; you absolutely must NOT change these values! The good thing is that your computer will be faster. The bad thing is that some Effects/Plugins do not work as expected because they use pixel units. Examples are \texttt{Title} and \texttt{Blur} plugins. A workaround is needed for that.
73 \end{itemize}
74
75 Note: the dimensions of the frame/image are downscaled to the Scale factor; so if the Scale factor is $\frac{1}{4}$ and the dimension of the image is $4288x2848$ pixels, that image will be downscaled to $1072x712$. It doesn't matter what the Project Format is.
76
77 \subsection{Using proxy}%
78 \label{sub:using_proxy}
79
80 To insert a clip/video from Resources window to the Timeline when Proxy is enabled (Active) you MUST Drag \& Drop that clip/video from the Proxy folder instead of the Media folder, as well as for Nested clips. And also if you want to load the clip in the Viewer or Compositor. You can use clips in the Clips folder in any State of the Proxy - it does not matter if Proxy is enabled or disabled.
81
82 Rendered proxy media is saved in the same directory as the original media. As usual, you can delete proxy files from the project or disk in the Resources window if you no longer want to retain them. You should always save your project with the Proxy disabled.
83
84 If you create proxies for Nested clips they will be saved in \texttt{\$HOME/Videos} unless you modify that in \texttt{Settings $\rightarrow$ Preferences}, \texttt{Interface tab}, \texttt{Nested Proxy Path}. If you change anything in a Nested clip using the Open EDL feature, you must first delete its old proxy file from disk because it is not updated automatically, and then enable Proxy again so that a new one is created. 
85
86 Not all the settings for Proxy are saved in the project: the values of Active Scale and the Rescaled to project size are saved but not the \textit{File Format}, \textit{File Type} and all video compression data. A good idea is to record this information in a README file about your project where you make a note of your Proxy settings for that project.
87 If the \textit{Creation of proxy on media loading} option has been checked, then when you load other media later, proxies will be created for them automatically, or else you can change the Proxy's State from disabled to enabled (Active) using the Proxy icon. Previous proxy renders will be reused unless you change one of the following proxy parameters: \textit{Scale factor}, \textit{File Format}, or \textit{File Type}. If proxies have been created and then you decide to change only the Compression type (Codec, Bitrate, Quality, Pixels), without changing the Scale factor or Container, you must delete proxy files from the disk beforehand. That is because \CGG{} does not read the compression type; it does read the filename and if the filename does
88 not change, \CGG{} thinks the proxy was already created.
89
90 \subsection{Scale factor set to 1, a special case}%
91 \label{sub:scale_factor_special_case}
92
93 This special case is used to temporarily change the codec parameters of your video while maintaining the original resolution - for example maybe your videos use long-GOP or the video codec is too hard to handle due to a strong compression. It does not matter if Rescaled to project size is checked or unchecked. For old computers, or underpowered computers, this option is not recommended.
94
95 \subsection{Setting the proxy}%
96 \label{sub:setting_proxy}
97
98 \begin{figure}[htpb]
99         \centering
100         \includegraphics[width=0.8\linewidth]{proxy-02.png}
101         \caption{Proxy settings dialog}
102         \label{fig:proxy-02}
103 \end{figure}
104
105 Screencast in figure~\ref{fig:proxy-02} shows the \textit{Rescaled to project size} checked so you can still use plugins correctly and the original project size is kept.  The Scale factor pull-down gives you available size options.  Note the new media dimensions shown (partially covered).  If the size is an odd number, 1 is added to make the dimensions both even numbers.
106
107 To go back to the original media permanently, simply set the Scale factor to Off or disable the Proxy by clicking on its toggle button. However, if you decide to reuse the proxies, those which have not been deleted from the Hard Disk (but have been removed from the project) will be used without re-rendering - this saves a lot of time. To completely remove the created proxies you will have to delete them manually from the Hard Disk.
108
109 There is also a convenient \textit{Beep on done volume} slider included so that you can work on other tasks until there is an audible notify of completion.  The default volume is set to 0 for no audible notify.
110
111 A good choice for classic proxy settings with a 1080p source video is:
112
113 \begin{lstlisting}[numbers=none]
114 Scale Factor:   1/4
115 File Format:    FFMPEG - mpeg
116 Video Preset:
117 Compression:    mpeg.mpeg
118 Bitrate:        2000000
119 Quality:        -1
120 Pixels:         yuv420p
121 \end{lstlisting}
122
123 If you get errors for some videos, such as those with strange variable bit rate or some types of files made on a smartphone, a usually reliable alternative is to change the following parameters:
124
125 \begin{lstlisting}[numbers=none]
126 File Format:    FFMPEG - mov
127 Video Preset:
128 Compression:    mov.mov
129 \end{lstlisting}
130
131 Or if you want small files with high image quality, a \textit{File Format} of m2ts is optimal.  For example a 1 GB file can be reduced to 50 MB with scale $\frac{1}{2}$. 
132
133 If you get error messages \index{proxy!error} when creating proxies, check the Video wrench settings.  These usually default to values that are expected to work correctly for the \textit{File Format} and codec you selected but they can be changed and may result in errors.  If you get an error message of \textit{check\_frame\_rate failed} followed by \textit{Error making proxy} in the popup Errors window, do just that and check the Frame rate value by going to the Resources window, Media folder, and use the right mouse button for the \textit{Info} option for the specific media in question.  You can change the frame rate in this window to a more codec acceptable value.  Different codecs may have different legal values.
134
135 A faster method of creating the proxy file outiside of \CGG{} for users who have
136 vaapi hardware acceleration capability on their graphics board is via a script.  Speed
137 up could potentially be 10 to 30 times faster depending on the parameter values you choose
138 and the size of your video file.  This script is included in the doc subdirectory as 
139 \texttt{vaapi\_proxy.sh} for users not using an AppImage version and is shown below.  You will
140 have to tune it to your specific needs for the vaapi\_device name (currently set to
141 \texttt{/dev/dri/renderr128}), file type (currently set to h264 and mp4), and proxy size (now is 6). 
142 Once you have created the proxy file, you then start \CGG{}, load the original un-proxied
143 video, use the Settings pulldown and choose the Proxy settings options as you would normally,
144 but because you already have created the existing proxy file with the correct name, it will
145 be automatically loaded and will not have to create it.  The filename of the proxy file
146 must be in the same location as the original video and have the exact required naming
147 conventions and scale factor.
148
149 \begin{lstlisting}[numbers=none]
150 #!/bin/bash
151 filename="$1"
152 fileout="${filename%.*}"
153 proxy="6"
154 # Hardware encode AMD
155 ffmpeg -threads 2 -hwaccel vaapi  -vaapi_device /dev/dri/renderD128 \
156  -i  "$1" -c:v h264_vaapi -vf "format=nv12,hwupload,scale_vaapi=iw/'$proxy':ih/'$proxy'" \
157  -vcodec h264_vaapi  -preset fast -c:a copy \
158  -bf 0 -profile:v 66 "$fileout".proxy"$proxy"-mp4.mp4
159 \end{lstlisting}
160
161 \subsection{Proxies with Alpha channel}%
162 \label{sub:proxies_alpha_channel}
163
164 Next are some examples of tested and working configurations that maintain the alpha channel:
165
166 \begin{lstlisting}[numbers=none]
167 Proxy #1
168         Scale factor: 1/4
169         Rescaled to project size (FFMPEG only) = unchecked
170         File Format: FFMPEG | qt
171         Video Preset-->
172                 Compression: png.qt
173                 Bitrate: 0
174                 Quality: -1
175                 Pixels: rgba (or rgba64be)
176         
177         
178 Proxy #2
179         Scale factor: 1/4
180         Rescaled to project size (FFMPEG only) = unchecked
181         File Format: FFMPEG | qt
182         Video Preset-->
183                 Compression: magicyuv.qt
184                 Bitrate: 0
185                 Quality: -1
186                 Pixels: yuva444p
187         
188         
189 Proxy #3
190         Scale factor: 1/4
191         Rescaled to project size (FFMPEG only) = unchecked
192         File Format: FFMPEG | qt
193         Video Preset-->
194                 Compression: openjpeg.qt
195                 Bitrate: 0
196                 Quality: -1
197                 Pixels: yuva420p
198         
199         
200 Proxy #4
201         Scale factor: 1/4
202         Rescaled to project size (FFMPEG only) = unchecked
203         File Format: FFMPEG | pro
204         Video Preset-->
205                 Compression: prores_4444.pro
206                 prores_4444xq.pro
207                 Bitrate: 0
208                 Quality: -1
209                 Pixels: yuva444p10le
210         
211         
212 Proxy #5
213         Scale factor: 1/4
214         Rescaled to project size (FFMPEG only) = unchecked
215         File Format: FFMPEG | mkv
216         Video Preset-->
217                 Compression: user_ffvhuff.mkv
218                 Bitrate: 0
219                 Quality: -1
220                 Pixels: yuva4--p
221                                    yuva4--p--le
222 \end{lstlisting}
223
224 \section{Transcode}%
225 \label{sec:transcode}
226 \index{transcode}
227
228 Transcode, an option under the \textit{Settings} pulldown right next to the Proxy settings option, is a type of full resolution \textbf{1:1 Proxy} \index{proxy!1:1}.
229 The process of transcoding works directly from the resource; it is independent of the timeline. 
230 All of the loaded asset media will be converted, that is, rendered in the selected format and loaded onto the timeline. 
231 Menu choices besides the usual File Format \index{file format} and File Type include: \textit{Tag suffix} (to add to media filename), \textit{Remove originals from project}, \textit{Into Nested Proxy directory} (an option to have the file saved here instead of the location of the original media), and \textit{Beep on done} volume.
232
233 The settings of the project have an effect on the outcome, for example the dimensions are taken into account. The resulting files are also larger than if they were created directly with ffmpeg.
234 Transcode works for videos with or without audio and even single frame files, like png's.
235 If you have a video file that also contains audio, and you convert only the video, the original audio will stay on the timeline if do not check \textit{Remove originals from project}. Or vice versa if audio converted and not video.
236 Multiple stream media will only transcode the first stream (this would be like the TV channel recordings in the United States).
237 You will get an error message if you already have a transcoded file in the selected format with the same suffix name and try to transcode it again with a different selection made -- you will have to delete that file first. An example would be
238 an already converted file that has both video and audio and now you request video only. 
239
240 The BIGGEST gain from using this is if you have media that is not \textit{seekable} \index{seek}, that is, you can play it from the beginning but can not move to another spot and have the audio or video play correctly. A video file with no keyframes makes seeking next to impossible, but then a Transcode generally adds these keyframes. This is particularly useful for the \texttt{mkv} container, which often has seek problems. For more details on mkv container see \ref{ssub:note_mkv_container}
241
242 Another important function of Transcode is being able to convert the project's media into a high-quality \textit{mezzanine} codec \index{mezzanine codec} (sometimes also called \textit{intermediate} codec \index{digital intermediate}), which makes timeline work lighter and more efficient. In fact such codecs (ffv1, ProRes, DNxHD, OpenEXR, huffyuv, etc) are generally little or not at all compressed; the type of compression is intraframe --more suitable for editing, and the image quality (4:2:2 up; 10-bit color up; floating point; etc) is suitable for \textit{Color Correction}, \textit{Chroma Key} and \textit{Rotoscoping}. The use of mezzanine codecs leads to very large files, so you need to make sure you have enough storage space.
243
244
245 \section{OpenEDL}%
246 \label{sec:openedl}
247 \index{openEDL}
248
249 To edit EDL \index{EDL} that is included with your project as Clips, Nested
250 Clips, Referenced File, or Xml you can use the option \textit{Open
251         EDL} in the Resources window for the highlighted media.  Then
252 with a simple button click you can return to your main timeline project.
253 For example, if you have a nested clip that originally had several
254 plugins added to it before it was nested, you can edit those plugin
255 parameter values. Previously to make any changes to these types of
256 EDL you had to remake the whole clip from scratch.  The program is 
257 actually "opening" the file as it currently exists for that particular
258 media so that it can be edited separately from the project EDL. In other NLEs the term \textit{sub-timeline} is used.
259
260 Here is how this works. In the Clip \index{clip !older} or Media folder \index{media folder} or on a timeline
261 EDL edit, the option \textit{Open EDL} for the highlighted clip or
262 nested clip is available so that when you choose this option, that
263 EDL will be brought up on the timeline superseding the current EDL
264 that exists on the timeline \index{timeline}.  Now, once the clip is open on the
265 timeline, you can edit it however you want. The previous timeline
266 EDL is \textit{pushed onto a stack} so it can be recalled by
267 \textit{popping the stack} with a click of the left mouse button in
268 the upper right hand corner of the timeline to the left of the
269 \textit{shell cmds} icon.  Initially this button displays a 0 to
270 indicate your initial timeline/project.  Then this button will read
271 1 if you choose \textit{Open EDL} and then back to 0 and your
272 original timeline with the left mouse click.  You can go several
273 levels deep so instead of 1, it could be 2, 3, $\dots$ but this
274 requires some thought to avoid potential confusion.
275
276 An example of a typical set of steps to follow is:
277 \begin{enumerate}
278         \item Load your media using insertion strategy of \textit{Replace
279                 current project}.  There will be number 0 in the upper right hand corner
280         of the main menu with the tooltip of \textit{Close EDL}.
281         \item Highlight a selection on the timeline and press the
282         \textit{To clip} icon and click the green checkmark OK.
283         \item In the Resources window, open the Clip folder and you will
284         see that Clip 1 is present.
285         \item Highlight Clip1 and right mouse the item to bring up
286         available options and select \textit{Open EDL}.
287         \item Now you will see the timeline change from the original
288         media to just the clip content and the number in the upper right hand
289         corner will change from 0 to 1.
290         \item Add a visible effect, like AgingTV to the timeline.
291         \item Click on the number 1 in the main menu bar to see the timeline
292         restored to the original media.
293         \item Drag the clip from the Resources Clip folder to the
294         timeline and you will see the AgingTV effect.
295 \end{enumerate}
296
297 You can follow the same steps as above by first using the option
298 \textit{Nest to media} in the Clip folder which nests the clip and
299 moves it out of the Clip folder to the Media folder.  Then use
300 \textit{Open EDL} on the Nested EDL \index{nested EDL} in the media folder.  When you
301 Open EDL and edit the changes, those changes will take affect on any
302 and all occurrences of that nested clip on the current and/or
303 original timeline. The option to unnest that clip and put that back
304 into the Clip folder is the option \textit{EDL to clip}.  The nested
305 clip is still in the Media folder.  It will now have a name of the
306 next available Clip number but the comment contains the previous name so
307 you can tell where it came from.
308
309 Instead of using the number on the main menu to close the current
310 EDL, both the Media and Clip folders have \textit{Close EDL} options
311 with the left mouse button. Clicking on the number button is quick and
312 easy but for infrequent usage it is not obvious, whereas if you use
313 \textit{Open EDL} you see \textit{Close EDL} right below that and so
314 it is very obvious.  In addition in the case of where you have
315 opened a EDL, and you no longer see that clip in the folder, the
316 right mouse button where no media is highlighted will also display
317 the Close EDL option.
318
319 %\pagebreak
320 \begin{figure}[h]
321         \centering
322         \includegraphics[width=1\linewidth]{editing-img001.png}
323         \caption{Once you have an Open EDL, the easiest way to close it.}
324         \label{fig:open_edl}
325 \end{figure}
326 \relax
327
328 In addition to the \textit{Open EDL} option in the Resources menu,
329 this option is available on the timeline when the cursor is on an
330 EDL-type edit. To get to this option, click on the middle mouse
331 button on that edit.  If it is not EDL, the option will not be
332 shown.  In summary:
333
334 \begin{center}
335         \begin{tabular}{ll}
336                 \toprule
337                 Media folder of Resources window & Open EDL for Nested or Referenced EDLs\\
338                 Clip folder of Resources window & Open EDL for clips\\
339                 Track timeline & Open EDL for Nested or Referenced EDLs\\
340                 \bottomrule
341         \end{tabular}
342 \end{center}
343
344 An aside -- when nesting and unnesting clips to take advantage of
345 this feature, names of the media can lead to some confusion.  For
346 example, if you nest a clip, the new name in the Media folder is the
347 word \textit{Nested} followed by an underscore with the date and
348 timestamp, another underscore, and then the clip name.  Then when
349 you unnest this Media folder clip via the \textit{EDL to clip}
350 option, the name will be changed in the Clip folder to the next
351 available Clip number.  However the comment field will reflect the
352 nested clip name from which it was derived.  To avoid confusion you
353 can easily change the name for these clips in either the Clip or
354 Media folder because they are not real files at this point. To do
355 so, highlight the clip name in Resources, click on Info and type in
356 a new name.
357
358 For additional safety, the \textit{Open EDL} feature includes
359 additional backup capabilities. Automatically \CGG{} saves a backup \index{backup}
360 when certain changes are made or you can always use the shortcut `b'
361 to do one yourself, although keep in mind it will be overwritten
362 whenever \CGG{} wants to do another backup.  Now there is a shortcut
363 for the backup shortcut `b' so you can keep your hand on the mouse
364 instead of the keyboard.  Just click on the number button in the upper right
365 hand corner of the main window.  If number is at 0, it backs up to
366 backup.xml, if at 1, it backs up to \texttt{backup1.xml} and so on
367 \dots up to \texttt{backup9.xml}.
368
369 When \textit{Open EDL} is invoked, the current EDL and current undo
370 stack are both \textit{pushed}, and the active session EDL is
371 replaced with the target clip/nested edl.  A new undo stack is
372 created, and the active \texttt{backup.xml} file name is decorated
373 with the stack level.  So, \texttt{backup.xml} is
374 \texttt{backup1.xml} when your edits are at stack level 1,
375 \texttt{back\-up2\-.xml} at stack level 2, and so on.  This means
376 that if you \textit{load backup} at stack level 1, the session will
377 reload from history at stack level 1, not the main session.
378
379 See a real-world workflow at appendix \nameref{sec:workflow_openedl_nested_clips}
380
381 \section{File by Reference}%
382 \label{sec:file_by_reference}
383 \index{file by reference}
384
385 It is sometimes handy to have EDL \index{EDL} assets not as a copy, but as a
386 reference that is automatically updated into your project.  Suppose
387 you have several short videos that at the end have the same credits
388 which include the current year such as 2021.  But now it is 2022 and
389 all of the videos would have to be individually updated with the new
390 date.  By including a \textit{Referenced File} as the EDL file type
391 when you create each of the videos, you can just change the one
392 credits xml file and the next time you load one of the videos and
393 render it, it will now automatically have the updated information.
394
395 The purpose of this feature is to be able to rework a smaller
396 section of a global master project at any time, which can be done by
397 an "assistant" (i.e. external software like GIMP or Inkscape, $\dots$) and then this work is automatically reflected in the
398 global master project.  It is for \textbf{advanced usage only}.
399
400 Up until the addition of this feature, \CGG{} has always used copies
401 and no direct reference in order to ensure original data is never
402 compromised (No Destructive editing).  In the usual case, subprojects as xmls are copied into
403 a master project where subprojects had been inserted, so that if you
404 change something in a subproject or delete a subproject, it would
405 have no affect on the master project.  But now with \textit{File by
406         Reference}, any project that uses a referenced file will
407 automatically include any changes made to the referenced file when
408 loaded.  At the same time, if you use the EDL file NOT as a
409 referenced file in a project since it is then just a copy, it will
410 not be updated.  Because of this difference, the user needs to be
411 very aware of what using this feature could do.
412
413 \textbf{Use with extreme caution}.  However, there are several
414 built-in safety features and a warning that should never be turned
415 off even though it gives you the option to do so.  These include:
416
417 \begin{enumerate}
418         \item When the \texttt{File, Load files} menu is opened, the EDL
419         strategy will always be set to just EDL as default.  Although, if
420         you use Apply and leave the Load Menu open, it will stay changed to
421         what you selected until it is re-opened.
422         \item When an EDL is opened as \textit{Reference}, the color of
423         that file name in the Resources Media folder is different in order
424         to serve as a reminder that it is special.
425         \item A warning message is displayed in a popup window when you
426         load a \textit{File by Reference} that reads \texttt{Other projects can
427         change this project and this can become a broken link}.  Although
428         you can check the warning box to never see this warning again, you
429         would be well advised to not do so.  It is a great reminder of
430         consequences and you will not want to be cavalier about the warning.
431         Instead just use the X to dismiss the warning.
432 \end{enumerate}
433
434 Here is a step by step example of how you can use \textit{File by
435         Reference}:
436 \begin{enumerate}
437         \item Start up \CGG{} and use the Title plugin to create a new
438         credits file.  Save as credits.xml.
439         \item Start a New project and then load an existing master
440         project to the timeline.
441         \item Load the credits file you created in step 1 with a Load
442         Strategy of Create Resources Only and with EDL Strategy as
443         \textit{Reference}.
444         \item Note the color change in the credits.xml filename and the
445         reference comment in the Resources Media folder.
446         \item Drag the credits file to an empty spot on the timeline.
447         Save this new master project and quit.
448         \item Start \CGG{} up again.  Load credits.xml and make a change
449         to the Title and save again.
450         \item Exit \CGG{}; restart \CGG{}; load your master project and
451         now you will automatically see on the timeline the changes you just
452         made in the previous step.
453 \end{enumerate}
454
455 \section{Trimming}%
456 \label{sec:trimming}
457 \index{trim}
458
459 With some edits on the timeline it is possible to do trimming. By
460 trimming you shrink or grow the edit boundaries (\textit{head} or \textit{tail}) by dragging them. In
461 drag and drop mode or cut and paste mode, move the cursor over an
462 edit boundary until it changes shape. The drag handle \index{drag handles} shows as a
463 left or right facing fat arrow when you cursor near the clip start
464 or end.  If the cursor faces left, the dragging operation affects
465 the beginning of the edit. If the cursor faces right, the dragging
466 operation affects the end of the edit.
467
468 The effect of each drag operation not only depends on the behavior
469 button but whether the beginning or end of the edit is being
470 dragged. When you release the mouse button, the trimming operation
471 is performed.
472
473 For all file formats, other than still images, the extent of the
474 trimming operation is limited to the source file length. Attempting
475 to drag the start of the edit beyond the start of the source, limits
476 it to the source start. In all trimming operations, all edits which
477 start on the same position as the cursor when the drag operation
478 begins are affected. You have to disarm tracks in order to prevent
479 edits from being affected.
480
481 You have 6 different choices of which mouse button to use for
482 specific types of editing while using the drag handle.  You change
483 the drag handle mouse effects by using the \texttt{Settings
484         $\rightarrow$ Preferences  $\rightarrow$ Interface} tab and
485 modifying the Editing section as shown in the next
486 figure~\ref{fig:trim}. The drag handle affects not only the clip you
487 are working on but also frequently the entire duration of all clips
488 on the timeline.
489
490 \begin{figure}[htpb]
491         \centering
492         \includegraphics[width=0.5\linewidth]{trim.png}
493         \caption{Default choices for mouse: Ripple for button 1; Roll
494                 for button 2; Slip for button 3}
495         \label{fig:trim}
496 \end{figure}
497
498 A description of the fundamental/common terminology for choices
499 follows.
500
501 \begin{description}
502         \item[All Edits (ripple)] \index{trim!ripple} shorten or lengthen the start or end
503         of a single piece of media while moving all media to the right of
504         that clip up or down on the timeline correspondingly.  Timeline
505         duration is modified.  In a drag \textit{All Edits} operation, the
506         beginning of the edit either cuts data from the edit if you move it
507         forward or pastes new data from before the edit if you move it
508         backward. The end of the edit pastes data into the edit if you move
509         it forward or cuts data from the end of the edit if you move it
510         backward. All the following edits shift. If you drag the end of the
511         edit past the start of the edit, the edit is deleted.
512         \item[One Edit (roll)] \index{trim!roll} move the in and out point of a single
513         clip without changing the timeline duration. In a drag \textit{One
514                 Edit} operation, nothing is cut or pasted. If you move the beginning
515         or end of the edit forward, the source reference in the edit shifts
516         forward. If you move the beginning or end of the edit backward, the
517         source reference shifts backward. The edit remains in the same spot
518         in the timeline but the source shifts.
519         \item[Src Only (slip)] \index{trim!slip} move the in and out point of a single
520         clip without changing the timeline duration. In a drag \textit{Src
521                 Only} operation, nothing is cut or pasted. If you move the beginning
522         or end of the edit forward, the source reference in the edit shifts
523         forward. If you move the beginning or end of the edit backward, the
524         source reference shifts backward. The edit remains in the same spot
525         in the timeline but the source shifts.
526         \item[Slide] \index{trim!slide} a single clip is moved but retains its current in
527         and out point; however the out point of the clip to the left changes
528         and the in point of the clip to the right also changes.  Timeline
529         duration remains the same.
530         \item[Edge Left/Right] \index{trim!edge} moves the edge of the clips.
531         \item[No effect] no changes are made.  You might want to use
532         this choice to prevent accidental movements.
533 \end{description}
534
535 The next table displays the options and results
536 with the Key Table here first.
537
538 \begin{lstlisting}[style=sh]
539 s = src media start
540 p = proj position
541 l = length
542 c = cut distance
543 rest == p+=c: for rest of clips
544 01 = flags edits_moved, rest_moved
545 \end{lstlisting}
546
547 \renewcommand{\arraystretch}{1.15}
548 \begin{center}
549         %\caption{}
550         %\label{tab:}
551         % Tell table to adjust font to fix on the page using \resize    
552                 \begin{longtable}{lllll}
553                         \toprule
554                         &  & \textbf{Drag Left} & \textbf{Drag Right} &\\
555                         \midrule
556                         \multicolumn{2}{l}{\textit{curr s += c, l -= c; + rest}} & $\leftarrow$ & $\rightarrow$ & \textit{rest}\\
557                         abc12345xyz & \textbf{Ripple} left edge 11 $\rightarrow$ & abc012345xyz & abc2345xyz &\\
558                         \midrule
559                         \multicolumn{2}{l}{\textit{curr l += c; + rest}} & $\leftarrow$ & $\rightarrow$ & \textit{rest}\\
560                         abc12345xyz & \textbf{Ripple} right edge 01 $\rightarrow$ & abc1234xyz & abc123456xyz &\\
561                         \midrule
562                         \multicolumn{2}{l}{\textit{prev l += c; curr ps+= c, l -= c}} & $\leftarrow$ & $\rightarrow$ &\\
563                         abc12345xyz & \textbf{Roll} left edge 00 $\rightarrow$ & ab012345xyz & abcd2345xyz &\\
564                         \midrule
565                         \multicolumn{2}{l}{\textit{curr l += c; next ps+= c, l -= c}} & $\leftarrow$ & $\rightarrow$ &\\
566                         abc12345xyz & \textbf{Roll} right edge 00 $\rightarrow$ & abc1234wxyz & abc123456yz &\\
567                         \midrule
568                         \multicolumn{2}{l}{\textit{s -= c}} & $\leftarrow$ & $\rightarrow$ &\\
569                         abc12345xyz & \textbf{Slip} left edge 10 $\rightarrow$ & abc23456xyz & abc01234xyz &\\
570                         \midrule
571                         \multicolumn{2}{l}{\textit{s -= c}} & $\leftarrow$ & $\rightarrow$ &\\
572                         abc12345xyz & \textbf{Slip} right edge 10 $\rightarrow$ & abc23456xyz & abc01234xyz &\\
573                         \midrule
574                         \multicolumn{2}{l}{\textit{prev l += c; curr p+= c; next ps += c, l -= c}} & $\leftarrow$ & $\rightarrow$ &\\
575                         abc12345xyz & \textbf{Slide} left edge 10 $\rightarrow$ & ab012345wxyz & abcd12345yz &\\
576                         \midrule
577                         \multicolumn{2}{l}{\textit{prev l += c; curr p+= c; next ps += c, l -= c}} & $\leftarrow$ & $\rightarrow$ &\\
578                         abc12345xyz & \textbf{Slide} right edge 10 $\rightarrow$ & ab12345wxyz & abcd12345yz &\\
579                         \midrule
580                         \multicolumn{2}{l}{\textit{curr s -+= c, l += c; + rest}} & $\leftarrow$ & $\rightarrow$ & \textit{rest}\\
581                         abc12345xyz & \textbf{Edge} left edge 11 $\rightarrow$ & abc2345xyz & abc0123456xyz &\\
582                         \midrule
583                         \multicolumn{2}{l}{\textit{curr l -+= c; + rest}} & $\leftarrow$ & $\rightarrow$ & \textit{rest}\\
584                         abc12345xyz & \textbf{Edge} right edge 01 $\rightarrow$ & abc1234xyz & abc123456xyz &\\
585                         \bottomrule
586                 \end{longtable}
587 \end{center}
588 \renewcommand{\arraystretch}{1}
589
590 Next, a more immediate and colorful view shows these trimming
591 options (figure~\ref{fig:trim-color}).
592
593 \begin{figure}[htpb]
594         \centering
595         \includegraphics[width=0.8\linewidth]{trim-color.png}
596         \caption{The 5 types of Trim: note the different lengths of the results.}
597         \label{fig:trim-color}
598 \end{figure}
599
600 \paragraph{How to do a J-cut or L-cut} A J-cut \index{J-cut/L-cut} is a split edit film
601 editing technique in which the audio from a following scene overlaps
602 the picture from the preceding scene, so that the audio portion of
603 the later scene starts playing before its picture as a lead-in to
604 the visual cut.  An L-cut is a different split edit film editing
605 technique in which the audio from preceding scene overlaps the
606 picture from the following scene, so that the audio cuts after the
607 picture, and continues playing over the beginning of the next scene
608 (figure~\ref{fig:j-cut}). To do either a J-cut or an L-cut, you
609 first shorten the first or second video a little.  Then you block
610 the audio tracks from changing by disarming the appropriate tracks.
611 Finally use \textit{One Edit (roll)} the cutting edge off the
612 videos.  Moving to the right creates a J-cut and moving to the left
613 creates an L-cut.
614
615 \begin{figure}[htpb]
616         \centering
617         \includegraphics[width=0.8\linewidth]{j-cut.png}
618         \caption{J-cut to left and L-cut to right}
619         \label{fig:j-cut}
620 \end{figure}
621
622
623 \subsection{Split View in Compositor Using the Drag Handle with Trim}%
624 \label{sub:split_view_compositor_using_drag_trim}
625 \index{trim!split view}
626 The Trim Feature using the drag handle provides some good ways to
627 view your video while editing.  The playback position in the
628 compositor is updated live and the view in the compositor can be
629 split so that in the left half of the compositor you can see the
630 last frame of the left clip and in the right half the first frame of
631 the right clip.  Dragging edits can not be extended past the
632 beginning or the end.
633
634 First familiarize yourself with button operation; check your setup
635 by executing the following step.  In the \texttt{Settings
636         $\rightarrow$ Preferences $\rightarrow$ Interface} tab, Editing
637 section, clicking on the edit boundaries can be set for Button 1, 2,
638 3 as one of the following:
639
640 \textit{Ripple}; \textit{Roll}; \textit{Slip}; \textit{Slide};
641 \textit{Edge} or \textit{No effect}
642
643 Now to use this feature, create a track with edits that have trims
644 on the left and/or the right. The edit boundary can be modified
645 using \textit{drag handles} at the boundary between the edits
646 (figure~\ref{fig:trim-display}).
647
648 \begin{figure}[htpb]
649         \centering
650         \includegraphics[width=1\linewidth]{trim-display.png}
651         \caption{Split compositor screen showing the result of the Trim feature}
652         \label{fig:trim-display}
653 \end{figure}
654
655 \begin{description}
656         \item[Left Mouse Button (LMB) usage:] If you grab the edit
657         handle from the right side, you will see a left arrow and dragging
658         the boundary will modify the right edit playback starting time. If
659         you grab the edit handle from the left side, you will see a right
660         arrow and dragging the boundary will modify the left edit playback
661         ending time. In both cases, the composer will show the edit endpoint
662         of the changed edit.
663         \item[Shift LMB usage:] The effect on the edits is the same as
664         described above, but the composer will show a split screen of the
665         left and right edits as they appear at the drag handle
666         boundary. Dragging will only change one of the two images, since
667         only one edit is being changed.
668         \item[Middle Mouse Button (MMB) usage:] Both the left and the
669         right edit ending/starting times are updated.  The image shown in
670         the compositor will be drawn from the side of the drag grab, that is
671         the left if it is grabbed from the left, and the right if it is
672         grabbed from the right.
673         \item[Shift MMB usage:] The effect on the edits is the same as
674         described above, but the composer will show a split screen of the
675         left and right edits as they appear at the drag handle boundary.
676         Dragging will change both of the two images, since both edits are
677         being changed.
678         \item[Right Mouse Button (RMB) usage:] The start/end point of
679         the current edit is moved, but the edit length is unchanged only one
680         image changes since only one edit endpoint is view is updated.
681         \item[Shift RMB usage:] The effect on the edits is the same as
682         described above, but the composer will show a split screen of the
683         left and right edits as they appear at the drag handle boundary.
684         Dragging will only change one of the two images, since only one edit
685         is being changed.
686 \end{description}
687
688
689
690
691 \section{Nesting clips and assets}%
692 \label{sec:nesting_clips_and_assets}
693 \index{nested EDL}
694
695 \subsection{Nested Assets}%
696 \label{sub:nested_assets}
697 \index{nested assets}
698
699 A nested asset is an EDL session that
700 embeds an existing EDL session, all tracks, all plugins, editing,
701 and effects into a media object that appears as one audio/video
702 media object, no plugins, editing, or effects.  It is as if the
703 existing EDL was rendered, and loaded in its place.  This has
704 several interesting side effects.  First, you don’t have to render
705 the entire media file to see any portion.  Second, it requires no
706 rendering compute time or storage.  Third, it changes the precedence
707 of the composer so that you get more control over the projection and
708 automation, so that the results can be sent into another rendering
709 step, not simply part of the current stack.  It groups the plugin
710 stack in much the same way that an arithmetic expression is grouped
711 by parenthesis.
712
713 The EDL session and the rendered output are visually equivalent.
714 Nested assets allow for complex grouping and stacking of effects,
715 and makes media access much more flexible.  This feature can be used
716 recursively, that is, any number of sessions may be stacked and
717 referenced as an asset, as long as all of the rendering resources
718 are available.  Nested assets are added to the timeline by using the
719 pulldown \texttt{File $\rightarrow$ Load files}\dots on the main
720 menu and selecting the \textit{Insertion strategy} of \textit{Nest
721         asset}. The file will be pasted into the timeline over the current
722 selection or at the insertion point.
723
724 It is somewhat important to note that nested assets and nested clips
725 will have index files automatically created.  These index files can
726 start to clutter up your \texttt{\$HOME/.bcast5} directory with
727 files named \texttt{Nested\_\#\#\#.idx} and you may want to
728 periodically delete any index files which are no longer in use.
729
730 \subsection{Nested Clips}%
731 \label{sub:nested_clips}
732 \index{nested clips}
733
734  It is also possible to create
735 \textit{clips} and convert them to \textit{nested edl}.  This is
736 done by first creating a clip using the standard cut, clipboard,
737 paste, and/or edit panel buttons.  Now, using the resources
738 \textit{clip} folder, select a clip to be nested, and use the right
739 mouse button to select a clip.  This activates the clip popup menu.
740 Select the \textit{Nest to media} menu item, and the clip will be
741 converted to a \textit{Nested: Clip} and put in Media
742 folder. Conversely, you can select a \textit{Nested: Clip}, use the
743 \textit{EDL to clip} menu item, and the clip will be reverted to a
744 \textit{Clip}.  This works similarly to the group / un-group editing
745 features of many graphic design editing programs, but in this case
746 the groups are rendered compositions (figure~\ref{fig:nesting}).
747
748 Nested clips can be proxied and when they are, the resulting files
749 are placed in the user's \texttt{\$HOME/Videos} directory by default.  This
750 can be modified by changing
751
752 \texttt{Settings $\rightarrow$ Preferences $\rightarrow$ Interface}
753 tab, Nested Proxy Path.
754
755 \begin{figure}[htpb]
756         \centering
757         \includegraphics[width=1.0\linewidth]{nesting.png}
758         \caption{Nested clips in Timeline and Resources window}
759         \label{fig:nesting}
760 \end{figure}
761
762 \paragraph{Notes:} creating nested clips is a complicated internal process for \CGG{}, especially for managing audio tracks. Therefore you need to make sure you have your project set up as you expect before you start nesting with the \texttt{Nest to Media} command.  Below are several things to remember.
763
764 \begin{itemize}
765         \item The creation of the nested clip is based on the settings in \texttt{Settings $\rightarrow$ Format}. Be sure that the number of audio tracks and channels is the same as we want to have in the nested clip. In addition, it is better to make each audio track independent from the others (which could be linked in more than one channel) using the option: \texttt{Audio $\rightarrow$ Map 1:1}
766         \item You can do any editing on the nested clip once it is loaded to the timeline. For example we can start an OpenEDL \index{openEDL} session to make the changes. Once out of the OpenEDL session it may be that the changes made are not visible in the original nested clip. You can fix this by doing RMB on the nested clip in the \textit{Resources/Media} window and choosing \texttt{Rebuild index}. This process may take some time depending on the size of
767 the media; because of the additional time required to do this, it is not done automatically in order to allow the user to make the decision as to when they are done editing enough and need to see the exact results
768 in order to save time.
769         \item Because of the way the timeline thumbnails are displayed, after editing using OpenEDL of a
770 nested clip, the thumbnails of the video track may be redrawn and may look different and out of sync with the
771 way they did originally with respect to the audio waveforms. This is simply a result of the redrawing of the
772 video track which is independent from the redrawing of the audio tracks. The playback is still synchronized.
773 \end{itemize}
774
775 \paragraph{Usage Examples of Nested Clips}
776
777 \begin{description}
778         \item[Example 1:] You want to make a flashback/rewind at the end
779         of your video that represents a quick summary of the entire video in
780         black and white. On he timeline, you have 60 seconds of edits with
781         clips, cuts, zoom in, zoom out and any other edits. Now you want to
782         get this 60 seconds \textit{compressed} to 10 seconds, play in
783         reverse, and in black and white at the end of your video.  You would
784         copy the 60 seconds in a clip, nest the clip in the Clip folder of
785         the Resources window and drag it to the timeline. You will see only
786         a clean clip without all of the edits that were used to create it
787         because nesting display a clip without having to actually use the
788         Render menu.  Now you can add a Reverse effect, Color3way plugin for
789         black and white, and use the Speed auto to get the 60 seconds down
790         to only 10 seconds.
791         \item[Example 2:] You are working on a complex project with a
792         team in a separate location. You create some sub projects, i.e.\
793         sequences, that you or the team will use in the Master project to
794         merge the sequences in the right order and to make the final color
795         correction steps.
796 \end{description}
797
798 In each of the examples you can see the benefit of nesting to create
799 clean looking timelines because of the automatic rendering
800 capability of nesting.
801
802 \section{Multi-Camera / Mixer}%
803 \label{sec:multicamera_mixer}
804 \index{multi-camera}
805 \index{mixers}
806
807 Use the Mixer Viewer to see multiple media playing simultaneously in re-sizable mini-viewers.  This can be used in various ways and is useful to edit videos shot by multiple cameras from different viewpoints that were simultaneously recorded in order to create a single good video.  Everything will have to be initially synced so you can decide which one of the camera angles is best suited at any time. Mixer mode does not support audio only tracks but there is a workaround described at \nameref{cha:faq_problems_workarounds}.
808
809 The number of cameras/mixers you can have is generally limited to the available resources on your computer.  Currently, the number of File Descriptors available in the OS limits cameras to about 50.  If you have many \textit{mixer viewers} you will probably want to use proxy mode whenever possible.  Also, in the \texttt{Settings $\rightarrow$ Playback A} tab \textit{Video Out} section, uncheck \textit{play every frame} and choosing a Video Driver of \textit{X11} with \textit{use direct X11 render if possible} checked, will provide better performance.
810
811 Figure~\ref{fig:multicam01} shows 9 media sources in the left corner, the composed video in the right corner, the timeline with the top video track with pieces of the 9 overwrites, and the choice in Resources of Mixed.
812
813 \begin{figure}[htpb]
814         \centering
815         \includegraphics[width=1.0\linewidth]{multicam01.png}
816         \caption{Using Mixer capability in Cin for multiple cameras}
817         \label{fig:multicam01}
818 \end{figure}
819
820 \subsubsection*{Easiest Method to Getting Started}%
821 \label{ssub:easiest_method_started}
822
823 \begin{enumerate}
824         \item This method assumes all of your media or cameras are aligned the way you want them already.
825         \item From the \textit{File} pulldown, create a \textit{New project} with the desired format for Audio and Video output (or you can just use the default).
826         \item \texttt{File $\rightarrow$ Load} the media files you want to work with using \textit{Create new resources only}.
827         \item In the Resources window, with  the Media folder, highlight the list of media you want to \textit{Mix}. This is done using a ctrl or shift mouse button press as you would in a standard listbox selection.
828         \item Right click the mouse on the media selection and choose \textit{open mixers} \index{mixers!open mixers}. This opens multiple mixer viewer \index{mixers!viewer} windows, one for each media item that was highlighted.  You can
829         do them 1 at a time instead.  This also adds the source media tracks to the main window.
830         \item Now use the timeline \index{timeline} to play and you will see all viewers/cameras playing.  Stop when you get to the
831         end of the \textit{good} camera playback.
832         \item Simply double click the \textit{good} mixer viewer and from where you first started playing to the playback insertion pointer is the source section, which will be pasted in the destination video/audio tracks at the top of the new project.
833         \item Repeat steps 6-7.  Start playing again, stop when you want, double click the desired mini-viewer!
834 \end{enumerate}
835
836 \subsubsection*{Some Hints and Caveats}%
837 \label{ssub:hints_caveats}
838
839 \begin{itemize}
840         \item You can easily overwrite a section of the new track by \textit{selecting} a section on the timeline, then double click on one of the mini-viewers to overwrite/replace that section.
841         \item If you edit the output tracks, it only edits output tracks, and the input tracks may no longer be lined up.
842         \item You can add a silent section by selecting past a section and start overwriting that section from then on.
843         \item If you use the cursor hairline to create the selection endpoint, it must be past the end of the destination.
844         \item The compositor shows composed media.  This is the media that will be rendered.
845         \item The program always uses overwrite as the paste operation.
846         \item Use the timeline edit handles to move the start and end points of that section.
847         \item Only middle mouse drag handle operations should be used normally.
848         \item Other drags will displace the media source/destination timeline correspondence.
849         \item To re-tile the mixer windows after you have resized and moved them around, you can use the Window
850         pulldown of \textit{Tile mixers} or the shortcut of Alt-t.
851 \end{itemize}
852
853 \subsubsection*{But, I want to use only the first set of audio tracks\dots}%
854 \label{ssub:but_use_only_first_audio}
855
856 There are many cases where you may want to compose using media from several different tracks while using the the same audio tracks as associated from a specific viewer.  Since mixer source tracks can be updated any time by using a mixer toggle \index{mixers!toggle}, this makes it possible to do this.  
857
858 Procedure to update the mixer audio source track list:
859
860 \begin{enumerate}
861         \item Single click to highlight the mixer window you want to re-associate to the audio track.
862         \item In that audio track’s patchbay click the expand toggle, the arrow on the right side.
863         \item In the expanded pane that appears, there is another arrow on the left side.  This icon has the tooltip \textit{Mixer}.  Click this and because in step \#1 you highlighted the mixer window, it will now be toggled on.  Once you click the mixer icon it will then point up.
864         \item Now, disassociate any audio that is unwanted by expanding its patchbay and toggling off the mixer.
865 \end{enumerate}
866
867 \subsubsection*{Expert Usage}%
868 \label{ssub:expert_usage}
869
870 When you double click a mixer viewer window, it operates an \textit{overwrite} paste operation.  This moves \textit{src} (source) track edits to \textit{dst} (destination) track edits over the same selected timeline region.
871
872 \begin{itemize}[noitemsep]
873         \item \textit{Src tracks} should be not playable and not armed in the main window patchbay gui.
874         \item \textit{Dst tracks} should be playable and armed in the main window patchbay gui.
875 \end{itemize}
876
877 Each mixer viewer maintains a list of the tracks which will be used as src. This list is made visible selecting the window with the left mouse button.  When the mixer viewer is selected, a highlight is drawn around the media image.  All track patchbay \textit{mixer} toggles are updated to reflect the src tracks included in the selected viewer src track list. The \textit{play track} patchbay toggles can be used to manage the list.
878
879 \begin{itemize}[noitemsep]
880         \item \textit{Turning on} a toggle (pointing up) includes the track in the src track list.
881         \item \textit{Turning off} a toggle (pointing right) removes the track from the src track list.
882 \end{itemize}
883
884 New Mixer viewers can be created using the main menu \texttt{Window $\rightarrow$ Mixer Viewer}, or with a shortcut of \texttt{Shift-M}.  When a new viewer is created, the currently enabled patchbay \textit{mixer} toggles are used to create the viewer source track list.  The toggles are cleared after the window is created.  This is to improve the work flow.  Use the following list of steps to create individual mixer viewers.
885
886 To create a list of mixer viewers:
887
888 \begin{enumerate}
889         \item Setup the session \texttt{settings $\rightarrow$ format}, width, height, frame rate, color model, aspect ratio.
890         \item Create dst tracks using the a/v track pulldowns (or use shortcuts "t" / "T"),  armed and playable.
891         \item Append src tracks using \texttt{file $\rightarrow$ open $\rightarrow$ append tracks}, or the resource window using pasting.
892         \item Using the track patchbay, disarm editing and disable playback of the audio/video src tracks.
893         \item Using the track patchbay, mark the new tracks as \textit{mixer} source to be added to the viewer.
894         \item Create a mixer viewer using the main menu pulldown, or the shift "M” shortcut.
895         \item Repeat steps $3-6$ for each mixer viewer needed for the session editing.
896 \end{enumerate}
897
898 When you single click a mixer window, it becomes selected and highlighted and all of the patchbay mixer toggles are updated to reflect the state of the viewer’s src tracks.  Tracks that will be src are shown as enabled.  If you change a toggle, the src tracks for the selected window will be modified.  This means you can associate or dis-associate any media track to any mixer window.
899
900 When you double click a mixer window, an overwrite paste is invoked.  The mixer viewer’s src tracks are overwritten to the dst tracks.  The timeline region for both the source and destination are the same for the overwrite paste function.  The selection region is used if it is active.  If the selection is empty, that is it is a hairline, the selection region is from the end of the destination playable edits to the selection cursor hairline.  The hairline must be past the end of the playable edits on the destination tracks.
901
902 The mixer viewer configuration is saved with the session data.  When a saved session is loaded in \textit{replace project} or \textit{replace project and concatenate tracks}, the mixer viewer will be reopened.
903
904 \subsubsection*{Using Proxy with \textit{Open Mixers}}%
905 \label{ssub:using_proxy_open_mixers}
906
907 The best way to use proxy \index{proxy} with your multiple cameras is to follow the steps below:
908
909 \begin{enumerate}
910         \item Load media with insertion strategy of \textit{create resources only}.
911         \item Highlight the media in the Resources window and right click on this to choose \textit{open mixers}.
912         \item Use the \texttt{Settings $\rightarrow$ Proxy settings}\dots to bring up the proxy menu.
913         \item Choose the size and other options you want and click the checkmark OK. If you choose the option \textit{Beep when done} you will hear a short beep if all media is already proxied or a longer beep when all proxies have been created.
914         \item When your editing is complete, use \textit{Settings} pulldown and proxy to \textit{original size}.
915 \end{enumerate}
916 Instead of Open Mixers, you can Insert Mixers \index{mixers!insert mixers} with new tracks at the timeline insertion point.
917
918 \subsubsection*{Options available in the \textit{Mixer Windows}}%
919 \label{ssub:options_available_with_mixers}
920 \index{mixers!viewer RMB options}
921
922 There are several options you will see in each Mixer viewer \index{mixers!viewer} that help with using them. These
923 are shown in figure~\ref{fig:mixer-playable}. To use these, RMB in the desired mixer window,
924 and choose one of the options as described here.
925
926 \begin{figure}[htpb]
927         \centering
928         \includegraphics[width=1.0\linewidth]{mixer-playable.png}
929         \caption{A Mixer window showing available options with the white X designating no playing}
930         \label{fig:mixer-playable}
931 \end{figure}
932
933 \begin{enumerate}
934         \item Fullscreen / Windowed - will bring up a fullscreen display of that window or revert to the original size.
935         \item Resize Window - allows for resizing the window to a choice of different sizes.
936         \item Tile Mixers \index{mixers!tile mixers} - makes it easy to get all of the mixers nicely tiled to a standard size.
937         This is also available in the \textit{Window} pulldown.
938         \item Playable - enabled by default so that you will see a checkmark next to it in the 
939         popup.  The benefit of making a mixer window not playable is to save cpu time. When a specific
940         mixer window is unchecked, so not Playable, a white cross appears in the upper left hand corner
941         of the mixer.  To switch back to playing again, RMB and choose Playable and this will turn
942         playing back on. The program automatically updates the mixer image when the timeline cursor
943         stops or when it is moved to a different spot even when play is disabled. You can see the
944         white cross designating not playable in figure~\ref{fig:mixer-playable}. Statistics that show
945         the savings are as follows on a 16 cpu laptop:
946         \begin{verbatim}
947         5 Mixers all playing -- cpu usage = 1275
948         1 only playing       -- cpu usage =  405
949         2 only playing       -- cpu usage =  800
950         \end{verbatim}
951 \end{enumerate}
952
953 \subsubsection*{Mixers pulldown}%
954 \label{ssub:mixers_pulldown}
955
956 From Program windows menu we can access the \texttt{windows $\rightarrow$ mixers...} there are several entries available (see figure~\ref{fig:mixers-pulldown}):
957
958 \begin{figure}[htpb]
959         \centering
960         \includegraphics[width=0.5\linewidth]{mixers-pulldown.png}
961         \caption{Mixers...  pulldown}
962         \label{fig:mixers-pulldown}
963 \end{figure}
964
965 \begin{description}
966         \item[Mixer Viewer:] \index{mixers!viewer} (Shift-M) opens a new empty \textit{Mixer 1} window, which will then be associated with a track. We can open as many Mixers as we like.
967         \item[Drag Tile mixers:] \index{mixers!drag tile mixers} (Alt-t) the default size of a mixer window is related to the std size of the \textit{Viewer} window. If we want to modify it at our convenience, we can build a window of the desired size with the \textit{Drag Tile mixers} function and then automatically order our mixers within it with the right click of the mouse.
968         \item[Align mixers:] \index{mixers!align mixers} see \nameref{sub:audio_video_sync_waveform}
969         \item[Mix masters:] \index{mixers!mix masters} this feature makes it very easy to get into the multi-camera mixer mode after tracks have already been set up and edited. Before this addition, you could only \textit{Open Mixers} from original media assets in the \textit{Resources} window.
970         \item[Entries:] If the mixers of several sources have been opened, the entries of each assets will appear, useful for recalling a specific mixer window.
971 \end{description}
972
973 \subsection{Recover Mixer Windows}%
974 \label{sub:recover_mixer_windows}
975 \index{mixers!recover mixer window}
976
977 It is a hazard that you might accidentally \textit{undo} (\texttt{z or Ctrl-z}) too far and lose your mixer windows.  Here are the steps to recover.  It is recommended that you make a backup of your project before performing the recovery steps just in case there are other problems.
978
979 In the patchbay box to the left of the main timeline, there is a right pointing arrow on the right side.  This is called the \textit{Expander} (figure~\ref{fig:mixer-patchbay01}).  When you click on each expander, another line appears below that expander arrow and the timeline track height is slightly increased.  If you Shift-click on a single expander, the patchbay will expand for all of the tracks.
980
981 \begin{figure}[htpb]
982         \centering
983         \includegraphics[width=0.35\linewidth]{mixer-patchbay01.png}
984         \caption{Mixer  patchbay}
985         \label{fig:mixer-patchbay01}
986 \end{figure}
987
988 \begin{enumerate}
989         \item Expand all of the patchbay lines, either one by one, or Shift-click on one to do them all. This is so you can see the \textit{mixer} right pointing arrow on the second expanded line.    
990         \item Use the \textit{Window} pulldown and choose \textit{Mixer Viewer} to bring up a new mixer window.  Now you will be making an association between the mixer viewer and the track’s video.
991         \item Click on the new mixer window to make sure it is highlighted with a white border. This designates it as the \textit{in use} mixer viewer.
992         \item Set your play to the beginning of the video using the \textit{Home} key or \textit{Home} transport button.
993         \item In the patchbay for a video track click on the \textit{mixer} arrow on the expanded $2^{nd}$ line which is a right facing arrow.  Now the arrow will point up.  If there are audio tracks with that video, click on each of its audio tracks \textit{mixer} arrow until they point up also.
994         \item Next move your insertion pointer on the timeline where there is video.  Some of the time this just helps so that the new mixer viewer window gets redrawn and you can see that the images appear; but the image may not appear until the program does a redraw later.  Now the mixer viewer should be
995         correctly associated.  Note if you have large video, give it some time to update.  You may have to click on the mixer viewer window if the image does not show.  You can always start over with that mixer if you encountered any problems.
996         \item Click the arrows that are pointing up in that video and its audio so they go back to pointing right. That mixer viewer is complete so you need to do this to make sure the \textit{mixer} arrows are off.
997 \end{enumerate}
998
999 Repeat steps 2 through 7 for each of the mixer viewers you need going down the patchbay starting on step 2 first with Mixer 1, then 2 to 7 steps for Mixer 2, then again run 2 to 7 for Mixer 3 and so on.
1000
1001 Sometimes the association does not stick initially.  If not, highlight the mixer viewer with the problem, change the mixer arrows to point up, and reassociate.
1002
1003 % For html, make sure using below is different from via in subsection
1004 \section{Audio/Video sync using Waveforms/Timecodes}%
1005 \label{sec:audio_video_sync}
1006 \index{audio/video sync}
1007
1008 \subsection{Audio/Video sync via Waveform}%
1009 \label{sub:audio_video_sync_waveform}
1010 \index{audio/video sync via waveform}
1011
1012 Multi-camera \index{multi-camera} footage of a single event can have various shots starting and ending at different times. So when the footage start times are different, you can use the mixer audio to synchronize the clips on the timeline. The program algorithm attempts to find and align automatically the waveforms of the media.
1013
1014 Synchronizing multiple camera videos based on audio tracks can be done with \CGG{} easily enough with the \texttt{Window $\rightarrow$ Mixers$\dots$ $\rightarrow$  Align mixers} option.  Align mixers brings up a window displaying your mixers, the currently selected Master Track, and a list of all of the Audio Tracks (figure~\ref{fig:mixer-align01}).  There is a limit of 32 audio tracks per each mixer (that should be enough!)
1015
1016 \begin{figure}[htpb]
1017         \centering
1018         \includegraphics[width=0.9\linewidth]{mixer-align01.png}
1019         \caption{Align Mixers window}
1020         \label{fig:mixer-align01}
1021 \end{figure}
1022
1023 Two different methods of aligning the audio for mixers are available. They are most easily referred to by the button that is pressed -- \textit{Match} and \textit{Match All}. There are also 2 methods of activating the alignment -- \textit{Apply} and \textit{Move}.  
1024
1025 \textit{Match} consists usually of the next set of steps to take advantage of this feature:
1026
1027 \begin{enumerate}
1028         \item Load your camera media with insertion strategy of \textit{resources only}
1029         \item Highlight in the Resources window, all of the media you want to mix.
1030         \item Right mouse button on one of the media and click on Open Mixers; all mixer windows come up.
1031         \item To arm the created mixer tracks and related audio tracks. They are automatically placed on the timeline disarmed. This is right for multi-cam but not for audio sync.
1032         \item Provide a small target audio pattern on the Master Track for syncing by marking with the In/Out points ([ and ]). NOTE: When choosing between the audio tracks to align the one that will have to work as Master, we must rigorously use the one with the right-most synchronization peak. This is because the Master track will be started at the beginning of the timeline. If during alignment the other tracks should move further to the left than the Master, they will be truncated at 00:00:00:000, finding no more space available, and will be shortened with loss of footage for the next multi-cam
1033         \item Make a selection on the timeline in which to look for the pattern. Left mouse click, then drag select and highlight a search time domain. 
1034         \item Use the \texttt{Window $\rightarrow$ Mixers$\dots$ $\rightarrow$  Align mixers} to bring up its dialog window.
1035         \item Highlight in the first listbox, the Mixer number you want to align. Click on \textit{Match}. This will take a few seconds so watch the rendering time percentage on the lower right hand side zoom panel. The buttons will be ghosted out until finished. Now note the changed values in the Audio Tracks listbox.
1036         \item If you are satisfied with the calculated Nudge values -- that is they are very close to $1.0$ -- in the Audio Tracks listbox and the audio track selected as the Master Track in the Master Track listbox, hit the \textit{Apply} button.
1037         \item If you plan on performing more alignment tasks, click on Checkpoint so you can go back to a previous step in case you make a mistake.
1038         \item Last, click on the OK green checkmark or to cancel click on the red X.  Or just close the gui.
1039         \item To disarm the mixer tracks and related audio tracks for the next multi-cam operations.
1040 \end{enumerate}
1041
1042 \paragraph{Reset} is used to start over with the current session data, not an undo.  This means you can use the match repeatedly to refine alignments.  All of the Audio Tracks listbox values will be reset.
1043
1044 \paragraph{Checkpoint} provides a method to create checkpoints that save the current state.  This is especially helpful while learning or doing more complicated operations where you might make a mistake or do not like the results and need to get back to a previous state.
1045
1046 \paragraph{Undo} is used to put the media back to a previous state on the timeline.  If you choose \textit{start over} the session will reload with the original, before any changes were applied.  You can also go back to any of your previous checkpoints that you created earlier which are listed there, such as \textit{chkpt 1}.
1047
1048 \paragraph{Match All}is used when you have several mixers, instead of only picking 1 to match, it picks the best match for EACH of the mixer tracks based on a single master track. So when you hit Apply, each track might move differently. You do not set In/Out points but you have to make a selection within which to match.
1049
1050 \paragraph{Apply} button will apply the nudges that were generated during the Match or Match All execution (figure~\ref{fig:mixer-align02}).
1051
1052 \begin{figure}[htpb]
1053         \centering
1054         \includegraphics[width=0.9\linewidth]{mixer-align02.png}
1055         \caption{Aligned mixer window after "Match". Note the Nudge amounts above.}
1056         \label{fig:mixer-align02}
1057 \end{figure}
1058
1059 \paragraph{Move} is very handy when you are using mixers, if you have an edit somewhere that you need to fix specifically without moving any of the other track pieces. In this case you have to select a section (like you do a group, but do not make a group), generate a match, and then you can just \textit{Move} that set only -- everything else stays where it is at its current location (figure~\ref{fig:mixer-align03}).
1060
1061 \begin{figure}[htpb]
1062         \centering
1063         \includegraphics[width=1.0\linewidth]{mixer-align03.png}
1064         \caption{Match setup for aligning by audio.  Note that [ ] are set over a sample waveform highlighted selection that includes that.}
1065         \label{fig:mixer-align03}
1066 \end{figure}
1067
1068 More detailed information follows about how this all works and the information in the dialog window.  It is important to know that the result of the calculation is \textit{best match} but you can still override the selections if you decide there is a better one.  The dialog window is split into 3 sections:
1069
1070 \begin{enumerate}
1071         \item \textit{Mixers} lists the mixers that are active by highlighting them all initially. You can decide that you do
1072         not want 1 or more mixers to be used in the correlation calculation by un-highlighting the one(s) that should not be used. In some cases you have to have at least 2 in order to align audio.
1073         \item \textit{Master Track} lists each of the audio tracks currently loaded for all of the mixers. You can decide to highlight a different audio track to be used as the master for correlation, but only 1 can be used. Remember to use the track with the right-most synchronization peak as the Master.
1074         \item \textit{Audio Tracks} lists each of the mixer audio tracks.  Again, you can highlight a different set of which
1075         mixer audio tracks that you want to use for the waveform correlation.  Any audio tracks that are not
1076         highlighted, that is \textit{turned off}, will not be considered in the correlation calculation.
1077 \end{enumerate}
1078
1079 The corresponding input position is determined by track input correlation.
1080
1081 The letter "R" in the Audio Tracks listbox represents the correlation value.  $R=1.0$ designates that if both the pattern and the matching section were in the highlighted area, they are completely correlated -- this is a good self-test to check.
1082 $Nudge=0.0$ means just that.
1083
1084 The header \textit{pos} stands for the timeline position. When the \textit{Apply} button is pressed, only the Mixers listbox is relevant at that time.
1085
1086 The Mixer with the master track generally does not move, everything else will be lined up (figure~\ref{fig:mixer-align04}).
1087
1088 \begin{figure}[htpb]
1089         \centering
1090         \includegraphics[width=1.0\linewidth]{mixer-align04.png}
1091         \caption{An audio Match is complete. Note the waveform is aligned.}
1092         \label{fig:mixer-align04}
1093 \end{figure}
1094
1095 \textit{Match All} option basically consists of the following steps:
1096
1097 \begin{enumerate}
1098         \item Highlight the Mixer to use in the Mixer listbox.
1099         \item Highlight the Master Track you want to use in the Master Track listbox.
1100         \item On the timeline, mark your selection on the Master Track.
1101         \item Click on the \textit{Match All} button.
1102         \item Note the nudge values to see if they make sense, and if so, press \textit{Apply}.
1103 \end{enumerate}
1104
1105 \textit{Match} option basic steps (just for comparison with Match All):
1106
1107 \begin{enumerate}
1108         \item Set the In/Out points [ ] of the target.
1109         \item On the timeline, mark your selection.
1110         \item Click on the \texttt{Match} button.
1111         \item Note the nudge values to see if they make sense, then press \textit{Apply} (or \textit{Move} when doing a group).
1112 \end{enumerate}
1113
1114 \subsection{Align Timecodes}%
1115 \label{sub:align_timecodes}
1116 \index{audio/video sync via timecodes}
1117 \index{align timecodes}
1118
1119 Align Timecodes is especially useful in the case where you create video with multiple cameras capable of recording a timecode in the metadata of each file.  Let’s say we have recorded three videos at the same time at a concert with each camera set up at unique positions and at different angles.   All of the cameras start recording at various times but were synchronized with the same master clock (\textit{Timecode Sync Generator} or \textit{Jam Sync timecode}) so that the recordings are timestamped with that synchronized time.  For example, the 3 cameras have embedded metadata as follows: \quad \textbf{camera 1} = 00:00:00:01 \quad \textbf{camera 2} = 00:00:10:07 \quad \textbf{camera 3} = 00:00:17:22
1120
1121 \begin{figure}[ht]
1122         \centering
1123         \includegraphics[width=1.0\linewidth]{timecode-01.png}
1124         \caption{Before sync}
1125         \label{fig:timecode-01}
1126 \end{figure}
1127
1128 Timecode synchronization is performed by the program when you choose the option \textit{Align Timecodes} and works in 2 steps. The first automatic step is to locate the earliest timecode \index{timecode} and the second step is to align the edits on the armed tracks using that time on the timeline. 
1129
1130 When you load in the three files to different tracks, they'll be placed on a timeline that starts from $00:00:00:00$ as usual. But, by middle mouse clicking (MMB) on any of the video tracks, you can view the timecode embedded at that point in that file.
1131
1132 To make it easy to align the videos onto the timeline manually, set the \textit{origin point}, that is the leftmost time index, of the timebar to the timecode of the earliest video.  For the 3 aforementioned cameras this would be camera 1 with a timeecode of $00:00:00:01$.  By using the \textit{clapboard} button on the main timeline, you can set $00:00:00:01$ as the start timecode. Then positioning the camera 1 video at the start of the timeline will line its frames up with the times on the timebar.
1133
1134 \begin{figure}[ht]
1135         \centering
1136         \includegraphics[width=1.0\linewidth]{timecode-02.png}
1137         \caption{Clapperboard button}
1138         \label{fig:timecode-02}
1139 \end{figure}
1140
1141 Similarly, using the middle mouse button to view the other 2 camera’s timecodes, you can position them  so their timecodes line up and now all three tracks will be in sync.  You can do this manually or simply do it automatically with the option under: \texttt{Tracks  $\rightarrow$  Align Timecodes}. See figure~\ref{fig:timecode-03}
1142
1143 \begin{figure}[ht]
1144         \centering
1145         \includegraphics[width=1.0\linewidth]{timecode-03.png}
1146         \caption{After sync}
1147         \label{fig:timecode-03}
1148 \end{figure}
1149
1150 Timecode synchronization in \CGG{} is based on the inclusion of an actual \textit{timecode} saved in
1151 the media as can be seen using the \texttt{ffprobe} or \texttt{mediainfo} command line. Examples are shown here:
1152
1153 \begin{lstlisting}[style=sh]
1154 # ffprobe tut1.mov
1155 Metadata:
1156 handler_name:   VideoHandler
1157 timecode:               00:00:20:01
1158
1159 # mediainfo mtb.mp4
1160 Time code of first frame:       11:05:49:41
1161 Time code, striped:             Yes
1162 Title:                          GoPro AVC
1163 \end{lstlisting}
1164
1165 Many newer cameras and media in a MOV container have valid timecodes often with SMPTE
1166 compliant start Timecode in Quicktime format, whereas others do not. Most low end cameras do not.
1167 When no timecode is present, various clock time values may be used to synchronize instead.
1168
1169 There are various types of timecodes and they are written in metadata in various ways. Because it is not clear which timecode in the file is the one to use or there is none, the precedence as described next is followed. The contexts, packets, streams, and data refer to the corresponding ffmpeg data or metadata objects:
1170
1171 \begin{enumerate}
1172         \item if the format context has a timecode use: \texttt{fmt\_ctx $\rightarrow$ timecode - 0}
1173         \item if the layer/channel has a timecode use: \texttt{st $\rightarrow$ timecode - (start\_time -nudge)}
1174         \item find the first program stream with video stream, and if the video stream has a timecode use:
1175         \texttt{st $\rightarrow$ timecode - (start\_time-nudge)}
1176         \item find timecode in any stream use: \texttt{st $\rightarrow$ timecode}
1177         \item read 100 packets, save \texttt{ofs=pkt.pts*st $\rightarrow$ time\_base - st $\rightarrow$ nudge}:
1178         \begin{itemize}
1179                 \item decode frame for video stream of the first program
1180                 \item if \texttt{frame $\rightarrow$ timecode} has a timecode use:\texttt{ frame $\rightarrow$ timecode - ofs}
1181                 \item if side\_data has gop (group of pictures) timecode use: \texttt{gop $\rightarrow$ timecode - ofs}
1182                 \item if side\_data has smpte timecode use: \texttt{smpte $\rightarrow$ timecode - ofs}
1183         \end{itemize}
1184         \item if the \texttt{filename/url} scans \texttt{*date\_time.ext} use: \texttt{date\_time} (yr, month, day, hr, min, sec, nanosecond)
1185         \item if stat (display file status) works on the \texttt{filename/url} use: \texttt{mtime} (modification time)
1186         \item finally, if none of the above are usable, then return \texttt{failure}
1187 \end{enumerate}
1188
1189 Operation of Align Timecodes includes the following options to help in your setup and review (figure~\ref{fig:timecode-04}):
1190
1191 \begin{figure}[ht]
1192         \centering
1193         \includegraphics[width=1.0\linewidth]{timecode-04.png}
1194         \caption{Timecode via MMB on track and via Resources windows/Info}
1195         \label{fig:timecode-04}
1196 \end{figure}
1197
1198 \begin{itemize}
1199         \item \textit{Align Timecodes} under the \textit{Tracks} pulldown
1200         \item \textit{Clapperboard} icon on the main timeline to set a timecode.
1201         \item Timecode option added to timebar choices (in timecode $hh:mm:ss:ff$) with use of the session frame
1202         rate as a time standard.
1203         \item Time Code Start in the Resources window on the bottom of \textit{Info} for the media if the timecode for that
1204         asset has been scanned and is known. You can scan the asset’s Timecode by using the middle mouse
1205         button on its track which then displays the timecode for that on the timebar (\texttt{MMB $\rightarrow$ Timecode}). Or you can use the shortcut \texttt{Ctrl+!}, after selecting the edit/track on the timeline.
1206 \end{itemize}
1207
1208 \paragraph*{Notes}
1209
1210 \begin{itemize}
1211         \item \textit{Align Timecodes} is a good first step to quickly sync media up either perfectly or roughly.
1212         \item Currently this is not known to function for syncing audio recorded on a separate audio device,
1213         because no test material was provided to ensure that this works.
1214         \item Disarmed tracks will not be affected by using \textit{Align Timecodes}.
1215         \item No edits or sections will get cut off on the left or elsewhere, unless the moved edits overlap.
1216         \item You can add a timecode to video using an \texttt{ffmpeg} command if you want to align a particular video
1217         which has no timecode to ones that do. For example:
1218 \end{itemize}
1219
1220 \begin{lstlisting}[style=sh]
1221 ffmpeg -i originalfile.mp4 -metadata timecode="14:36:08:29" -c copy newfile.mp4
1222
1223 # where "-i" is followed by the input filename
1224 # where "-metadata timecode" is followed by the timecode key
1225 # where "-c copy" just copies the video/audio to the following output filename
1226 \end{lstlisting}
1227
1228 \section{Subtitles}%
1229 \label{sec:subtitles}
1230 \index{subtitles}
1231
1232 \CGG{} can create subtitles directly in the timeline with the Subtitle tool. Subtitles are added by using the main window pulldown   \texttt{File $\rightarrow$ Subtitle} (Alt-y)  which brings up a window allowing you to type the filename of a previously generated text file containing the desired words/lines, the script.  After entering the filename, click \texttt{Load} to read in your script.  By creating a script file ahead of time, it lets you easily add dialog that was already written out and carefully edited for spelling and proper grammar.
1233
1234 The file must be plain text; a .srt or .sub can also be used, but only the text lines will be used and not the timecodes or comments. The format of the script/text input file has specific requirements as listed below:
1235
1236 \begin{itemize}
1237         \item Lines can be any length but they will be broken up to fit according to some criteria below.
1238         \begin{itemize}
1239                 \item Running text used as script lines will be broken into multiple lines.
1240                 \item The target line length is 60 characters.
1241                 \item Punctuation may be flagged to create an early break.
1242                 \item Single carriage return ends an individual script line.
1243                 \item Double carriage return indicates the end of a entry and helps to keep track of where you are.
1244         \end{itemize}
1245         \item The "\textit{=}" sign in column 1 indicates a comment seen in the script text to assist you in location.
1246         \item An "\textit{*}" at the beginning of the line is a comment and not a script line.
1247         \item \textit{Whitespace} at either the beginning of a script line or the end will be removed.
1248 \end{itemize}
1249
1250 Figure~\ref{fig:subtitle01} shows the Subtitle window you will see.
1251
1252 \begin{figure}[htpb]
1253         \centering
1254         \includegraphics[width=0.8\linewidth]{subtitle01.png}
1255         \caption{Subtitle window}
1256         \label{fig:subtitle01}
1257 \end{figure}
1258
1259 To put the subtitles onto your media, first add a subtitle track via the pulldown  \texttt{Tracks $\rightarrow$ Add subttl} (Shit-Y). In the Subtitle window, note that there are 2 major textboxes.  There is the \textit{Script Text} textbox showing the current entry of text from your input file and there is the \textit{Line Text} textbox showing the currently active text.  In your subtitle track, select a timeline region (in/out or drag select with hairline cursor/highlight or via labels or the \textit{selection start/length/end time} textboxes in the Zoom Panel) to indicate the region where you want the active Line Text to be pasted.  Then click the \texttt{Paste} button in the Subtitle window to paste the line onto the subtitle track.  Silence will be added to the subtitle track in the places in the media where there are gaps.
1260
1261 Editing in the Line Text box can be used to change the active script line. By double clicking the timeline over the subtitle track, you can reselect the active script line.  The subtitle text will be reloaded into the Line Text box and can be edited and re-pasted as the new active subtitle text.  You can also highlight multiple lines in the Script Text box and paste them (using the usual window paste methodology) into the Line Text box.  After pasting to the timeline, the Line Text box will be updated with the next script line.  In addition, if you triple click a line in the \textit{Script Text} box, it will automatically become the current line in the \textit{Line Text} box.
1262
1263 When you are finished, before clicking on \textit{Save}, you can specify the output format using the \textit{Format} drop-down button. You can choose between the classic \texttt{.udvd} (micro DVD) and the more universally supported \texttt{.srt} (subrip) and \texttt{.sub} (subviewer). The next step is to provide a legitimate filname in the \textit{Path} box; your current directory will be used if only a filename but no directory path is supplied.  The filename used will automatically have a "--" after it followed by the \textit{track label} and then \textit{udvd/srt/sub} extension added; any extension in the filename will be removed..  If you click OK before saving, the subtitle script position is saved with the session.  This is convenient for continuing where you left off.
1264
1265 To reposition the script, use the slider or tumbler buttons:
1266
1267 \textit{Slider} bar to move through the text entries quickly. \\
1268 \textit{Prev} or \textit{Next} buttons to go to the previous or next script line.
1269
1270 Figure~\ref{fig:subtitle02} shows what the pasted subtitle script looks like in a portion of the main window.
1271
1272 \begin{figure}[htpb]
1273         \centering
1274         \includegraphics[width=1.0\linewidth]{subtitle02.png}
1275         \caption{Subtitles on timeline}
1276         \label{fig:subtitle02}
1277 \end{figure}
1278
1279
1280