New Motion changes by SGE + other Andrea fixes, MatN review fixes, Andrew notfication...
[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
7 Working with videos that have large image geometry can greatly impede editing.  Instead you can substitute \textit{proxies} which will create smaller video image files from the original file that can then be edited more quickly.   When you are done working on this smaller scale, you will need to bring up the Proxy settings menu again, and change the Scale factor back to the Original size so that all of your edits/work take affect on that original higher quality video on the timeline.  
8
9 To use this feature, select \texttt{Settings $\rightarrow$ Proxy settings} and change the Scale factor from Original size to your downsized choice.  You can choose ffmpeg as the File Format and a choice of various codecs associated with that.  A good choice is the default of mpeg which can usually be quite fast.  In addition, to modify values for that codec, click on the wrench icon.  When you have completed your choices, just click OK, and then the video tracks will be rendered. This may take some time, but previous proxy renders will be reused.  
10 The proxy videos will be added to your assets in a separate Proxy folder, and the video track edits will use the proxies.
11 The assets in both the Media folder and Proxy folder will look proxied when dragged to the Viewer although the scale may be different.
12 Proxy downsizing renders all loaded tracks, but only work on the $1^{st}$ video layer of any multi-layer media.  Rendered proxy media is saved in the same directory as the original media.
13 However, if you proxy your session, the clips do not get proxied to the Proxy folder, but if you Drag and Drop the clip from the Clip folder to the Viewer or the Timeline, you will see that it too is proxied.  
14 As usual, you can delete proxy files from the project or disk in the Resources window if you no longer want to retain them.
15 And you can save your project either as proxied or not.
16
17 Because Proxy works on the original media in all circumstances, when you resize the
18 media in the Resources window, it does not actually resize the media but puts it in
19 a "buffer" in that format. This might lead to some confusion for the user who
20 expects this resizing to be maintained when disabling Proxy for that media. However,
21 that does not happen because the resize is only in a buffer and not in the original
22 media. This result is different than in the case of media "edits", like cuts or
23 adding plugins because this information is not in a buffer but rather part of the
24 copy "Editing Decision List" (EDL).
25
26 You can also nest clips while in a proxied state, but you can not drag the proxied nested clips
27 to the viewer or the timeline.
28 If you create proxies for Nested clips they will be saved in \texttt{\$HOME/Videos} unless you modify that in
29 \texttt{Settings $\rightarrow$ Preferences, Interface} tab, \textit{Nested Proxy Path}. 
30
31 There are two ways that the proxy files can be used, with or without input scaling. When the proxy is done without rescaling, the Mask, Camera and Projector automations are re-scaled accordingly. In this situation, the entire project will be re-sized so that the session is in the resized geometry.  Not all plugins are useful when the project is rescaled, because the keyframe data must be in the original geometry.  In this case, you can use the rescaler, by enabling \textit{Use scaler (FFMPEG only)}. This has the added advantage that the project size does not change and the proxy media is down-scaled as usual and up-scaled on read-in, which means the project editing is done in full scale.   Since decoding is done on smaller video, there is a time savings, but all rendering is done full scale.  The main reason for using \textit{scaler} is that it does not change the image coordinate data, so that automation and plugin parameters will be in the original project geometry.   This is not as fast as the first option, but is a performance gain, and may be needed if you are using plugins that need coordinate data such as the Title plugin.  As noted, the scaler only works on ffmpeg video formats.
32
33 In the upper right hand corner of the main window, there is a toggle button to easily switch back and forth when you have a proxied file on the timeline.  The icon is to the left of the FF icon.  It will have the letter “P” as the icon for Proxy or if \textit{Using Scaler}, the letter “S”. \quad \includegraphics[height=\baselineskip]{proxy-01.png} \quad This quick switch is especially useful when editing and you need to see a better image temporarily.
34
35 \begin{figure}[htpb]
36         \centering
37         \includegraphics[width=0.5\linewidth]{proxy-02.png}
38         \caption{Proxy settings dialog}
39         \label{fig:proxy-02}
40 \end{figure}
41
42 Screencast in figure~\ref{fig:proxy-02} shows the Use scaler checked so you can still use plugins 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.
43
44 In the case of the scaler checkbox, it will retain that setting for ease of use.
45
46 There is also a convenient \textit{Beep on done volume} dial 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.
47
48 A good choice for proxy settings with 1080p source video is:
49
50 \begin{lstlisting}[numbers=none]
51 Scale Factor:   1/4
52 Use Scaler:     unchecked
53 File Format:    FFMPEG - mpeg
54 Video Preset:
55 Compression:    mpeg.mpeg
56 Bitrate:        1800000
57 Quality:        -1
58 Pixels:         yuv420p
59 \end{lstlisting}
60
61 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:
62
63 \begin{lstlisting}[numbers=none]
64 File Format:    FFMPEG - mov
65 Video Preset:
66 Compression:    mov.mov
67 \end{lstlisting}
68
69 Or if you want small files with high image quality, a File Format of m2ts is optimal.  For example a 1 GB file can be reduced to 50 MB with scale $\frac{1}{2}$. 
70
71 Checking the \textit{Auto proxy/scale media loads} results in any additional media loads to be automatically proxy scaled.  However, single frame media such as PNG or JPEG \textit{stills}, can not be scaled to \textit{stream} media.  If this type of media exists, you should \textit{use scaler}.
72
73 If you get error messages 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 Info option for that 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.
74
75 More specific information on which plugins need to use scaler is provided here next.  If the keyframe data uses coordinate data that is absolute, then the scaler should be used.  If the data is normalized (like always $0-100\%$) then the proxy can be done without the scaler.  The session geometry format, shown in \texttt{Settings $\rightarrow$ Format} as $width \times height$, is changed if the scaler is not used to cause all of the data to be in the reduced format.  If this affects the plugin operation, then scaler should be used.  Examples of plugins that need the scaler are: Title, AutoScale, Scale, ScaleRatio, and Translate.  Most others are safe to use without scaling.
76
77 \section{Transcode}%
78 \label{sec:transcode}
79
80 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}.
81 The process of transcoding works directly from the resource; it is independent of the timeline. 
82 All of the loaded asset media will be converted, that is, rendered in the selected format and loaded onto the timeline. 
83 Menu choices besides the usual 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.
84
85 The settings of the project have an effect, for example the dimensions are taken into account. The resulting files are also larger than if they were created directly with ffmpeg.
86 Transcode works for videos with or without audio and even single frame files, like png's.
87 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.
88 Multiple stream media will only transcode the first stream (this would be like the TV channel recordings in the United States).
89 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
90 an already converted file that has both video and audio and now you request video only. 
91
92 The BIGGEST gain from using this is if you have media that is not \textit{seekable}, 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. 
93
94
95 \section{OpenEDL}%
96 \label{sec:openedl}
97
98 To edit EDL that is included with your project as Clips, Nested
99 Clips, Referenced File, or Xml you can use the option \textit{Open
100         EDL} in the Resources window for the highlighted media.  Then
101 with a simple button click you can return to your main timeline project.
102 For example, if you have a nested clip that originally had several
103 plugins added to it before it was nested, you can edit those plugin
104 parameter values. Previously to make any changes to these types of
105 EDL you had to remake the whole clip from scratch.  The program is 
106 actually "opening" the file as it currently exists for that particular
107 media so that it can be edited separately from the project EDL.  
108
109 Here is how this works. In the Clip or Media folder or on a timeline
110 EDL edit, the option \textit{Open EDL} for the highlighted clip or
111 nested clip is available so that when you choose this option, that
112 EDL will be brought up on the timeline superseding the current EDL
113 that exists on the timeline.  Now, once the clip is open on the
114 timeline, you can edit it however you want. The previous timeline
115 EDL is \textit{pushed onto a stack} so it can be recalled by
116 \textit{popping the stack} with a click of the left mouse button in
117 the upper right hand corner of the timeline to the left of the
118 \textit{shell cmds} icon.  Initially this button displays a 0 to
119 indicate your initial timeline/project.  Then this button will read
120 1 if you choose \textit{Open EDL} and then back to 0 and your
121 original timeline with the left mouse click.  You can go several
122 levels deep so instead of 1, it could be 2, 3, $\dots$ but this
123 requires some thought to avoid potential confusion.
124
125 An example of a typical set of steps to follow is:
126 \begin{enumerate}
127         \item Load your media using insertion strategy of \textit{Replace
128                 current project}.  There will be number 0 in the upper right hand corner
129         of the main menu with the tooltip of \textit{Close EDL}.
130         \item Highlight a selection on the timeline and press the
131         \textit{To clip} icon and click the green checkmark OK.
132         \item In the Resources window, open the Clip folder and you will
133         see that Clip 1 is present.
134         \item Highlight Clip1 and right mouse the item to bring up
135         available options and select \textit{Open EDL}.
136         \item Now you will see the timeline change from the original
137         media to just the clip content and the number in the upper right hand
138         corner will change from 0 to 1.
139         \item Add a visible effect, like AgingTV to the timeline.
140         \item Click on the number 1 in the main menu bar to see the timeline
141         restored to the original media.
142         \item Drag the clip from the Resources Clip folder to the
143         timeline and you will see the AgingTV effect.
144 \end{enumerate}
145
146 You can follow the same steps as above by first using the option
147 \textit{Nest to media} in the Clip folder which nests the clip and
148 moves it out of the Clip folder to the Media folder.  Then use
149 \textit{Open EDL} on the Nested EDL in the media folder.  When you
150 Open EDL and edit the changes, those changes will take affect on any
151 and all occurrences of that nested clip on the current and/or
152 original timeline. The option to unnest that clip and put that back
153 into the Clip folder is the option \textit{EDL to clip}.  The nested
154 clip is still in the Media folder.  It will now have a name of the
155 next available Clip number but the comment contains the previous name so
156 you can tell where it came from.
157
158 Instead of using the number on the main menu to close the current
159 EDL, both the Media and Clip folders have \textit{Close EDL} options
160 with the left mouse button. Clicking on the number button is quick and
161 easy but for infrequent usage it is not obvious, whereas if you use
162 \textit{Open EDL} you see \textit{Close EDL} right below that and so
163 it is very obvious.  In addition in the case of where you have
164 opened a EDL, and you no longer see that clip in the folder, the
165 right mouse button where no media is highlighted will also display
166 the Close EDL option.
167
168 %\pagebreak
169 \begin{figure}[h]
170         \centering
171         \includegraphics[width=1\linewidth]{editing-img001.png}
172         \caption{Once you have an Open EDL, the easiest way to close it.}
173         \label{fig:open_edl}
174 \end{figure}
175 \relax
176
177 In addition to the \textit{Open EDL} option in the Resources menu,
178 this option is available on the timeline when the cursor is on an
179 EDL-type edit. To get to this option, click on the middle mouse
180 button on that edit.  If it is not EDL, the option will not be
181 shown.  In summary:
182
183 \begin{center}
184         \begin{tabular}{ll}
185                 \toprule
186                 Media folder of Resources window & Open EDL for Nested or Referenced EDLs\\
187                 Clip folder of Resources window & Open EDL for clips\\
188                 Track timeline & Open EDL for Nested or Referenced EDLs\\
189                 \bottomrule
190         \end{tabular}
191 \end{center}
192
193 An aside -- when nesting and unnesting clips to take advantage of
194 this feature, names of the media can lead to some confusion.  For
195 example, if you nest a clip, the new name in the Media folder is the
196 word \textit{Nested} followed by an underscore with the date and
197 timestamp, another underscore, and then the clip name.  Then when
198 you unnest this Media folder clip via the \textit{EDL to clip}
199 option, the name will be changed in the Clip folder to the next
200 available Clip number.  However the comment field will reflect the
201 nested clip name from which it was derived.  To avoid confusion you
202 can easily change the name for these clips in either the Clip or
203 Media folder because they are not real files at this point. To do
204 so, highlight the clip name in Resources, click on Info and type in
205 a new name.
206
207 For additional safety, the \textit{Open EDL} feature includes
208 additional backup capabilities. Automatically \CGG{} saves a backup
209 when certain changes are made or you can always use the shortcut `b'
210 to do one yourself, although keep in mind it will be overwritten
211 whenever \CGG{} wants to do another backup.  Now there is a shortcut
212 for the backup shortcut `b' so you can keep your hand on the mouse
213 instead of the keyboard.  Just click on the number button in the upper right
214 hand corner of the main window.  If number is at 0, it backs up to
215 backup.xml, if at 1, it backs up to \texttt{backup1.xml} and so on
216 \dots up to \texttt{backup9.xml}.
217
218 When \textit{Open EDL} is invoked, the current EDL and current undo
219 stack are both \textit{pushed}, and the active session EDL is
220 replaced with the target clip/nested edl.  A new undo stack is
221 created, and the active \texttt{backup.xml} file name is decorated
222 with the stack level.  So, \texttt{backup.xml} is
223 \texttt{backup1.xml} when your edits are at stack level 1,
224 \texttt{back\-up2\-.xml} at stack level 2, and so on.  This means
225 that if you \textit{load backup} at stack level 1, the session will
226 reload from history at stack level 1, not the main session.
227
228 See a real-world workflow at appendix \nameref{sec:workflow_openedl_nested_clips}
229
230 \section{File by Reference}%
231 \label{sec:file_by_reference}
232
233 It is sometimes handy to have EDL assets not as a copy, but as a
234 reference that is automatically updated into your project.  Suppose
235 you have several short videos that at the end have the same credits
236 which include the current year such as 2019.  But now it is 2020 and
237 all of the videos would have to be individually updated with the new
238 date.  By including a \textit{Referenced File} as the EDL file type
239 when you create each of the videos, you can just change the one
240 credits xml file and the next time you load one of the videos and
241 render it, it will now automatically have the updated information.
242
243 The purpose of this feature is to be able to rework a smaller
244 section of a global master project at any time, which can be done by
245 an "assistant" (i.e. external software like GIMP or Inkscape, $\dots$) and then this work is automatically reflected in the
246 global master project.  It is for \textbf{advanced usage only}.
247
248 Up until the addition of this feature, \CGG{} has always used copies
249 and no direct reference in order to ensure original data is never
250 compromised.  In the usual case, subprojects as xmls are copied into
251 a master project where subprojects had been inserted, so that if you
252 change something in a subproject or delete a subproject, it would
253 have no affect on the master project.  But now with \textit{File by
254         Reference}, any project that uses a referenced file will
255 automatically include any changes made to the referenced file when
256 loaded.  At the same time, if you use the EDL file NOT as a
257 referenced file in a project since it is then just a copy, it will
258 not be updated.  Because of this difference, the user needs to be
259 very aware of what using this feature could do.
260
261 \textbf{Use with extreme caution}.  However, there are several
262 built-in safety features and a warning that should never be turned
263 off even though it gives you the option to do so.  These include:
264
265 \begin{enumerate}
266         \item When the \texttt{File, Load files} menu is opened, the EDL
267         strategy will always be set to just EDL as default.  Although, if
268         you use Apply and leave the Load Menu open, it will stay changed to
269         what you selected until it is re-opened.
270         \item When an EDL is opened as \textit{Reference}, the color of
271         that file name in the Resources Media folder is different in order
272         to serve as a reminder that it is special.
273         \item A warning message is displayed in a popup window when you
274         load a \textit{File by Reference} that reads \texttt{Other projects can
275         change this project and this can become a broken link}.  Although
276         you can check the warning box to never see this warning again, you
277         would be well advised to not do so.  It is a great reminder of
278         consequences and you will not want to be cavalier about the warning.
279         Instead just use the X to dismiss the warning.
280 \end{enumerate}
281
282 Here is a step by step example of how you can use \textit{File by
283         Reference}:
284 \begin{enumerate}
285         \item Start up \CGG{} and use the Title plugin to create a new
286         credits file.  Save as credits.xml.
287         \item Start a New project and then load an existing master
288         project to the timeline.
289         \item Load the credits file you created in step 1 with a Load
290         Strategy of Create Resources Only and with EDL Strategy as
291         \textit{Reference}.
292         \item Note the color change in the credits.xml filename and the
293         reference comment in the Resources Media folder.
294         \item Drag the credits file to an empty spot on the timeline.
295         Save this new master project and quit.
296         \item Start \CGG{} up again.  Load credits.xml and make a change
297         to the Title and save again.
298         \item Exit \CGG{}; restart \CGG{}; load your master project and
299         now you will automatically see on the timeline the changes you just
300         made in the previous step.
301 \end{enumerate}
302
303 \section{Trimming}%
304 \label{sec:trimming}
305
306 With some edits on the timeline it is possible to do trimming. By
307 trimming you shrink or grow the edit boundaries by dragging them. In
308 drag and drop mode or cut and paste mode, move the cursor over an
309 edit boundary until it changes shape. The drag handle shows as a
310 left or right facing fat arrow when you cursor near the clip start
311 or end.  If the cursor faces left, the dragging operation affects
312 the beginning of the edit. If the cursor faces right, the dragging
313 operation affects the end of the edit.
314
315 The effect of each drag operation not only depends on the behavior
316 button but whether the beginning or end of the edit is being
317 dragged. When you release the mouse button, the trimming operation
318 is performed.
319
320 For all file formats, other than still images, the extent of the
321 trimming operation is limited to the source file length. Attempting
322 to drag the start of the edit beyond the start of the source, limits
323 it to the source start. In all trimming operations, all edits which
324 start on the same position as the cursor when the drag operation
325 begins are affected. You have to disarm tracks in order to prevent
326 edits from being affected.
327
328 You have 6 different choices of which mouse button to use for
329 specific types of editing while using the drag handle.  You change
330 the drag handle mouse effects by using the \texttt{Settings
331         $\rightarrow$ Preferences  $\rightarrow$ Interface} tab and
332 modifying the Editing section as shown in the next
333 figure~\ref{fig:trim}. The drag handle affects not only the clip you
334 are working on but also frequently the entire duration of all clips
335 on the timeline.
336
337 \begin{figure}[htpb]
338         \centering
339         \includegraphics[width=0.5\linewidth]{trim.png}
340         \caption{Default choices for mouse: Ripple for button 1; Roll
341                 for button 2; Slip for button 3}
342         \label{fig:trim}
343 \end{figure}
344
345 A description of the fundamental/common terminology for choices
346 follows.
347
348 \begin{description}
349         \item[All Edits (ripple)] shorten or lengthen the start or end
350         of a single piece of media while moving all media to the right of
351         that clip up or down on the timeline correspondingly.  Timeline
352         duration is modified.  In a drag \textit{All Edits} operation, the
353         beginning of the edit either cuts data from the edit if you move it
354         forward or pastes new data from before the edit if you move it
355         backward. The end of the edit pastes data into the edit if you move
356         it forward or cuts data from the end of the edit if you move it
357         backward. All the following edits shift. If you drag the end of the
358         edit past the start of the edit, the edit is deleted.
359         \item[One Edit (roll)] move the in and out point of a single
360         clip without changing the timeline duration. In a drag \textit{One
361                 Edit} operation, nothing is cut or pasted. If you move the beginning
362         or end of the edit forward, the source reference in the edit shifts
363         forward. If you move the beginning or end of the edit backward, the
364         source reference shifts backward. The edit remains in the same spot
365         in the timeline but the source shifts.
366         \item[Src Only (slip)] move the in and out point of a single
367         clip without changing the timeline duration. In a drag \textit{Src
368                 Only} operation, nothing is cut or pasted. If you move the beginning
369         or end of the edit forward, the source reference in the edit shifts
370         forward. If you move the beginning or end of the edit backward, the
371         source reference shifts backward. The edit remains in the same spot
372         in the timeline but the source shifts.
373         \item[Slide] a single clip is moved but retains its current in
374         and out point; however the out point of the clip to the left changes
375         and the in point of the clip to the right also changes.  Timeline
376         duration remains the same.
377         \item[Edge Left/Right] moves the edge of the clips.
378         \item[No effect] no changes are made.  You might want to use
379         this choice to prevent accidental movements.
380 \end{description}
381
382 The next table displays the options and results
383 with the Key Table here first.
384
385 \begin{lstlisting}[style=sh]
386 s = src media start
387 p = proj position
388 l = length
389 c = cut distance
390 rest == p+=c: for rest of clips
391 01 = flags edits_moved, rest_moved
392 \end{lstlisting}
393
394 \renewcommand{\arraystretch}{1.15}
395 \begin{center}
396         %\caption{}
397         %\label{tab:}
398         % Tell table to adjust font to fix on the page using \resize    
399                 \begin{longtable}{lllll}
400                         \toprule
401                         &  & \textbf{Drag Left} & \textbf{Drag Right} &\\
402                         \midrule
403                         \multicolumn{2}{l}{\textit{curr s += c, l -= c; + rest}} & $\leftarrow$ & $\rightarrow$ & \textit{rest}\\
404                         abc12345xyz & \textbf{Ripple} left edge 11 $\rightarrow$ & abc012345xyz & abc2345xyz &\\
405                         \midrule
406                         \multicolumn{2}{l}{\textit{curr l += c; + rest}} & $\leftarrow$ & $\rightarrow$ & \textit{rest}\\
407                         abc12345xyz & \textbf{Ripple} right edge 01 $\rightarrow$ & abc1234xyz & abc123456xyz &\\
408                         \midrule
409                         \multicolumn{2}{l}{\textit{prev l += c; curr ps+= c, l -= c}} & $\leftarrow$ & $\rightarrow$ &\\
410                         abc12345xyz & \textbf{Roll} left edge 00 $\rightarrow$ & ab012345xyz & abcd2345xyz &\\
411                         \midrule
412                         \multicolumn{2}{l}{\textit{curr l += c; next ps+= c, l -= c}} & $\leftarrow$ & $\rightarrow$ &\\
413                         abc12345xyz & \textbf{Roll} right edge 00 $\rightarrow$ & abc1234wxyz & abc123456yz &\\
414                         \midrule
415                         \multicolumn{2}{l}{\textit{s -= c}} & $\leftarrow$ & $\rightarrow$ &\\
416                         abc12345xyz & \textbf{Slip} left edge 10 $\rightarrow$ & abc23456xyz & abc01234xyz &\\
417                         \midrule
418                         \multicolumn{2}{l}{\textit{s -= c}} & $\leftarrow$ & $\rightarrow$ &\\
419                         abc12345xyz & \textbf{Slip} right edge 10 $\rightarrow$ & abc23456xyz & abc01234xyz &\\
420                         \midrule
421                         \multicolumn{2}{l}{\textit{prev l += c; curr p+= c; next ps += c, l -= c}} & $\leftarrow$ & $\rightarrow$ &\\
422                         abc12345xyz & \textbf{Slide} left edge 10 $\rightarrow$ & ab012345wxyz & abcd12345yz &\\
423                         \midrule
424                         \multicolumn{2}{l}{\textit{prev l += c; curr p+= c; next ps += c, l -= c}} & $\leftarrow$ & $\rightarrow$ &\\
425                         abc12345xyz & \textbf{Slide} right edge 10 $\rightarrow$ & ab12345wxyz & abcd12345yz &\\
426                         \midrule
427                         \multicolumn{2}{l}{\textit{curr s -+= c, l += c; + rest}} & $\leftarrow$ & $\rightarrow$ & \textit{rest}\\
428                         abc12345xyz & \textbf{Edge} left edge 11 $\rightarrow$ & abc2345xyz & abc0123456xyz &\\
429                         \midrule
430                         \multicolumn{2}{l}{\textit{curr l -+= c; + rest}} & $\leftarrow$ & $\rightarrow$ & \textit{rest}\\
431                         abc12345xyz & \textbf{Edge} right edge 01 $\rightarrow$ & abc1234xyz & abc123456xyz &\\
432                         \bottomrule
433                 \end{longtable}
434 \end{center}
435 \renewcommand{\arraystretch}{1}
436
437 Next, a more immediate and colorful view shows these trimming
438 options (figure~\ref{fig:trim-color}).
439
440 \begin{figure}[htpb]
441         \centering
442         \includegraphics[width=0.8\linewidth]{trim-color.png}
443         \caption{The 5 types of Trim: note the different lengths of the results.}
444         \label{fig:trim-color}
445 \end{figure}
446
447 \paragraph{How to do a J-cut or L-cut} A J-cut is a split edit film
448 editing technique in which the audio from a following scene overlaps
449 the picture from the preceding scene, so that the audio portion of
450 the later scene starts playing before its picture as a lead-in to
451 the visual cut.  An L-cut is a different split edit film editing
452 technique in which the audio from preceding scene overlaps the
453 picture from the following scene, so that the audio cuts after the
454 picture, and continues playing over the beginning of the next scene
455 (figure~\ref{fig:j-cut}). To do either a J-cut or an L-cut, you
456 first shorten the first or second video a little.  Then you block
457 the audio tracks from changing by disarming the appropriate tracks.
458 Finally use \textit{One Edit (roll)} the cutting edge off the
459 videos.  Moving to the right creates a J-cut and moving to the left
460 creates an L-cut.
461
462 \begin{figure}[htpb]
463         \centering
464         \includegraphics[width=0.8\linewidth]{j-cut.png}
465         \caption{J-cut to left and L-cut to right}
466         \label{fig:j-cut}
467 \end{figure}
468
469
470 \subsection{Split View in Compositor Using the Drag Handle with Trim}%
471 \label{sub:split_view_compositor_using_drag_trim}
472
473 The Trim Feature using the drag handle provides some good ways to
474 view your video while editing.  The playback position in the
475 compositor is updated live and the view in the compositor can be
476 split so that in the left half of the compositor you can see the
477 last frame of the left clip and in the right half the first frame of
478 the right clip.  Dragging edits can not be extended past the
479 beginning or the end.
480
481 First familiarize yourself with button operation; check your setup
482 by executing the following step.  In the \texttt{Settings
483         $\rightarrow$ Preferences $\rightarrow$ Interface} tab, Editing
484 section, clicking on the edit boundaries can be set for Button 1, 2,
485 3 as one of the following:
486
487 \textit{Ripple}; \textit{Roll}; \textit{Slip}; \textit{Slide};
488 \textit{Edge} or \textit{No effect}
489
490 Now to use this feature, create a track with edits that have trims
491 on the left and/or the right. The edit boundary can be modified
492 using \textit{drag handles} at the boundary between the edits
493 (figure~\ref{fig:trim-display}).
494
495 \begin{figure}[htpb]
496         \centering
497         \includegraphics[width=1\linewidth]{trim-display.png}
498         \caption{Split compositor screen showing the result of the Trim feature}
499         \label{fig:trim-display}
500 \end{figure}
501
502 \begin{description}
503         \item[Left Mouse Button (LMB) usage:] If you grab the edit
504         handle from the right side, you will see a left arrow and dragging
505         the boundary will modify the right edit playback starting time. If
506         you grab the edit handle from the left side, you will see a right
507         arrow and dragging the boundary will modify the left edit playback
508         ending time. In both cases, the composer will show the edit endpoint
509         of the changed edit.
510         \item[Shift LMB usage:] The effect on the edits is the same as
511         described above, but the composer will show a split screen of the
512         left and right edits as they appear at the drag handle
513         boundary. Dragging will only change one of the two images, since
514         only one edit is being changed.
515         \item[Middle Mouse Button (MMB) usage:] Both the left and the
516         right edit ending/starting times are updated.  The image shown in
517         the compositor will be drawn from the side of the drag grab, that is
518         the left if it is grabbed from the left, and the right if it is
519         grabbed from the right.
520         \item[Shift MMB usage:] The effect on the edits is the same as
521         described above, but the composer will show a split screen of the
522         left and right edits as they appear at the drag handle boundary.
523         Dragging will change both of the two images, since both edits are
524         being changed.
525         \item[Right Mouse Button (RMB) usage:] The start/end point of
526         the current edit is moved, but the edit length is unchanged only one
527         image changes since only one edit endpoint is view is updated.
528         \item[Shift RMB usage:] The effect on the edits is the same as
529         described above, but the composer will show a split screen of the
530         left and right edits as they appear at the drag handle boundary.
531         Dragging will only change one of the two images, since only one edit
532         is being changed.
533 \end{description}
534
535
536
537
538 \section{Nesting clips and assets}%
539 \label{sec:nesting_clips_and_assets}
540
541 \subsection{Nested Assets}%
542 \label{sub:nested_assets}
543
544 A nested asset is an EDL session that
545 embeds an existing EDL session, all tracks, all plugins, editing,
546 and effects into a media object that appears as one audio/video
547 media object, no plugins, editing, or effects.  It is as if the
548 existing EDL was rendered, and loaded in its place.  This has
549 several interesting side effects.  First, you don’t have to render
550 the entire media file to see any portion.  Second, it requires no
551 rendering compute time or storage.  Third, it changes the precedence
552 of the composer so that you get more control over the projection and
553 automation, so that the results can be sent into another rendering
554 step, not simply part of the current stack.  It groups the plugin
555 stack in much the same way that an arithmetic expression is grouped
556 by parenthesis.
557
558 The EDL session and the rendered output are visually equivalent.
559 Nested assets allow for complex grouping and stacking of effects,
560 and makes media access much more flexible.  This feature can be used
561 recursively, that is, any number of sessions may be stacked and
562 referenced as an asset, as long as all of the rendering resources
563 are available.  Nested assets are added to the timeline by using the
564 pulldown \texttt{File $\rightarrow$ Load files}\dots on the main
565 menu and selecting the \textit{Insertion strategy} of \textit{Nest
566         asset}. The file will be pasted into the timeline over the current
567 selection or at the insertion point.
568
569 It is somewhat important to note that nested assets and nested clips
570 will have index files automatically created.  These index files can
571 start to clutter up your \texttt{\$HOME/.bcast5} directory with
572 files named \texttt{Nested\_\#\#\#.idx} and you may want to
573 periodically delete any index files which are no longer in use.
574
575 \subsection{Nested Clips}%
576 \label{sub:nested_clips}
577
578  It is also possible to create
579 \textit{clips} and convert them to \textit{nested edl}.  This is
580 done by first creating a clip using the standard cut, clipboard,
581 paste, and/or edit panel buttons.  Now, using the resources
582 \textit{clip} folder, select a clip to be nested, and use the right
583 mouse button to select a clip.  This activates the clip popup menu.
584 Select the \textit{Nest to media} menu item, and the clip will be
585 converted to a \textit{Nested: Clip} and put in Media
586 folder. Conversely, you can select a \textit{Nested: Clip}, use the
587 \textit{EDL to clip} menu item, and the clip will be reverted to a
588 \textit{Clip}.  This works similarly to the group / un-group editing
589 features of many graphic design editing programs, but in this case
590 the groups are rendered compositions (figure~\ref{fig:nesting}).
591
592 Nested clips can be proxied and when they are, the resulting files
593 are placed in the user's \texttt{\$HOME/Videos} directory by default.  This
594 can be modified by changing
595
596 \texttt{Settings $\rightarrow$ Preferences $\rightarrow$ Interface}
597 tab, Nested Proxy Path.
598
599 \begin{figure}[htpb]
600         \centering
601         \includegraphics[width=1.0\linewidth]{nesting.png}
602         \caption{Nested clips in Timeline and Resources window}
603         \label{fig:nesting}
604 \end{figure}
605
606 \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.
607
608 \begin{itemize}
609         \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}
610         \item You can do any editing on the nested clip once it is loaded to the timeline. For example we can start an 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
611 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
612 in order to save time.
613         \item Because of the way the timeline thumbnails are displayed, after editing using OpenEDL of a
614 nested clip, the thumbnails of the video track may be redrawn and may look different and out of sync with the
615 way they did originally with respect to the audio waveforms. This is simply a result of the redrawing of the
616 video track which is independent from the redrawing of the audio tracks. The playback is still synchronized.
617 \end{itemize}
618
619 \paragraph{Usage Examples of Nested Clips}
620
621 \begin{description}
622         \item[Example 1:] You want to make a flashback/rewind at the end
623         of your video that represents a quick summary of the entire video in
624         black and white. On he timeline, you have 60 seconds of edits with
625         clips, cuts, zoom in, zoom out and any other edits. Now you want to
626         get this 60 seconds \textit{compressed} to 10 seconds, play in
627         reverse, and in black and white at the end of your video.  You would
628         copy the 60 seconds in a clip, nest the clip in the Clip folder of
629         the Resources window and drag it to the timeline. You will see only
630         a clean clip without all of the edits that were used to create it
631         because nesting display a clip without having to actually use the
632         Render menu.  Now you can add a Reverse effect, Color3way plugin for
633         black and white, and use the Speed auto to get the 60 seconds down
634         to only 10 seconds.
635         \item[Example 2:] You are working on a complex project with a
636         team in a separate location. You create some sub projects, i.e.\
637         sequences, that you or the team will use in the Master project to
638         merge the sequences in the right order and to make the final color
639         correction steps.
640 \end{description}
641
642 In each of the examples you can see the benefit of nesting to create
643 clean looking timelines because of the automatic rendering
644 capability of nesting.
645
646 \section{Multi-Camera / Mixer}%
647 \label{sec:multicamera_mixer}
648
649 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. 
650
651 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.
652
653 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.
654
655 \begin{figure}[htpb]
656         \centering
657         \includegraphics[width=1.0\linewidth]{multicam01.png}
658         \caption{Using Mixer capability in Cin for multiple cameras}
659         \label{fig:multicam01}
660 \end{figure}
661
662 \subsubsection*{Easiest Method to Getting Started}%
663 \label{ssub:easiest_method_started}
664
665 \begin{enumerate}
666         \item This method assumes all of your media or cameras are aligned the way you want them already.
667         \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).
668         \item \texttt{File $\rightarrow$ Load} the media files you want to work with using \textit{Create new resources only}.
669         \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.
670         \item Right click the mouse on the media selection and choose \textit{open mixers}. This opens multiple mixer viewer windows, one for each media item that was highlighted.  You can
671         do them 1 at a time instead.  This also adds the source media tracks to the main window.
672         \item Now use the timeline to play and you will see all viewers/cameras playing.  Stop when you get to the
673         end of the \textit{good} camera playback.
674         \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.
675         \item Repeat steps 6-7.  Start playing again, stop when you want, double click the desired mini-viewer!
676 \end{enumerate}
677
678 \subsubsection*{Some Hints and Caveats}%
679 \label{ssub:hints_caveats}
680
681 \begin{itemize}
682         \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.
683         \item If you edit the output tracks, it only edits output tracks, and the input tracks may no longer be lined up.
684         \item You can add a silent section by selecting past a section and start overwriting that section from then on.
685         \item If you use the cursor hairline to create the selection endpoint, it must be past the end of the destination.
686         \item The compositor shows composed media.  This is the media that will be rendered.
687         \item The program always uses overwrite as the paste operation.
688         \item Use the timeline edit handles to move the start and end points of that section.
689         \item Only middle mouse drag handle operations should be used normally.
690         \item Other drags will displace the media source/destination timeline correspondence.
691         \item To re-tile the mixer windows after you have resized and moved them around, you can use the Window
692         pulldown of \textit{Tile mixers} or the shortcut of Alt-t.
693 \end{itemize}
694
695 \subsubsection*{But, I want to use only the first set of audio tracks\dots}%
696 \label{ssub:but_use_only_first_audio}
697
698 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, this makes it possible to do this.  
699
700 Procedure to update the mixer audio source track list:
701
702 \begin{enumerate}
703         \item Single click to highlight the mixer window you want to re-associate to the audio track.
704         \item In that audio track’s patchbay click the expand toggle, the arrow on the right side.
705         \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.
706         \item Now, disassociate any audio that is unwanted by expanding its patchbay and toggling off the mixer.
707 \end{enumerate}
708
709 \subsubsection*{Expert Usage}%
710 \label{ssub:expert_usage}
711
712 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.
713
714 \begin{itemize}[noitemsep]
715         \item \textit{Src tracks} should be not playable and not armed in the main window patchbay gui.
716         \item \textit{Dst tracks} should be playable and armed in the main window patchbay gui.
717 \end{itemize}
718
719 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 track patchbay toggles can be used to manage the list.
720
721 \begin{itemize}[noitemsep]
722         \item \textit{Turning on} a toggle (pointing up) includes the track in the src track list.
723         \item \textit{Turning off} a toggle (pointing right) removes the track from the src track list.
724 \end{itemize}
725
726 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.
727
728 To create a list of mixer viewers:
729
730 \begin{enumerate}
731         \item Setup the session \texttt{settings $\rightarrow$ format}, width, height, frame rate, color model, aspect ratio.
732         \item Create dst tracks using the a/v track pulldowns (or use shortcuts "t" / "T"),  armed and playable.
733         \item Append src tracks using \texttt{file $\rightarrow$ open $\rightarrow$ append tracks}, or the resource window using pasting.
734         \item Using the track patchbay, disarm editing and disable playback of the audio/video src tracks.
735         \item Using the track patchbay, mark the new tracks as \textit{mixer} source to be added to the viewer.
736         \item Create a mixer viewer using the main menu pulldown, or the shift "M” shortcut.
737         \item Repeat steps $3-6$ for each mixer viewer needed for the session editing.
738 \end{enumerate}
739
740 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.
741
742 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.
743
744 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.
745
746 \subsubsection*{Using Proxy with \textit{Open Mixers}}%
747 \label{ssub:using_proxy_open_mixers}
748
749 The best way to use proxy with your multiple cameras is to follow the steps below:
750
751 \begin{enumerate}
752         \item Load media with insertion strategy of \textit{create resources only}.
753         \item Highlight the media in the Resources window and right click on this to choose \textit{open mixers}.
754         \item Use the \texttt{Settings $\rightarrow$ Proxy settings}\dots to bring up the proxy menu.
755         \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.
756         \item When your editing is complete, use \textit{Settings} pulldown and proxy to \textit{original size}.
757 \end{enumerate}
758 Instead of Open Mixers, you can Insert Mixers with new tracks at the timeline insertion point.
759
760 \begin{figure}[htpb]
761         \centering
762         \includegraphics[width=1.0\linewidth]{mixer-playable.png}
763         \caption{A Mixer window showing available options with the white X designating no playing}
764         \label{fig:mixer-playable}
765 \end{figure}
766
767 \subsubsection*{Options available in the \textit{Mixer Windows}}%
768 \label{ssub:options_available_with_mixers}
769
770 There are several options you will see in each Mixer window that help with using them. These
771 are shown in figure~\ref{fig:mixer-playable}. To use these, RMB in the desired mixer window,
772 and choose one of the options as described here.
773
774 \begin{enumerate}
775         \item Fullscreen / Windowed - will bring up a fullscreen display of that window or revert to the original size.
776         \item Resize Window - allows for resizing the window to a choice of different sizes.
777         \item Tile Mixers - makes it easy to get all of the mixers nicely tiled to a standard size.
778         This is also available in the \textit{Window} pulldown.
779         \item Playable - enabled by default so that you will see a checkmark next to it in the 
780         popup.  The benefit of making a mixer window not playable is to save cpu time. When a specific
781         mixer window is unchecked, so not Playable, a white cross appears in the upper left hand corner
782         of the mixer.  To switch back to playing again, RMB and choose Playable and this will turn
783         playing back on. The program automatically updates the mixer image when the timeline cursor
784         stops or when it is moved to a different spot even when play is disabled. You can see the
785         white cross designating not playable in figure~\ref{fig:mixer-playable}. Statistics that show
786         the savings are as follows on a 16 cpu laptop:
787         \begin{verbatim}
788         5 Mixers all playing -- cpu usage = 1275
789         1 only playing       -- cpu usage =  405
790         2 only playing       -- cpu usage =  800
791         \end{verbatim}
792 \end{enumerate}
793
794
795 \subsection{Recover Mixer Windows}%
796 \label{sub:recover_mixer_windows}
797
798 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.
799
800 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.
801
802 \begin{figure}[htpb]
803         \centering
804         \includegraphics[width=0.35\linewidth]{mixer-patchbay01.png}
805         \caption{Mixer  patchbay}
806         \label{fig:mixer-patchbay01}
807 \end{figure}
808
809 \begin{enumerate}
810         \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.    
811         \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.
812         \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.
813         \item Set your play to the beginning of the video using the \textit{Home} key or \textit{Home} transport button.
814         \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.
815         \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
816         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.
817         \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.
818 \end{enumerate}
819
820 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.
821
822 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.
823
824 \section{Audio/Video sync via Waveforms/Timecodes}%
825 \label{sec:audio_video_sync}
826
827 \subsection{Audio/Video sync via Waveform}%
828 \label{sub:audio_video_sync_waveform}
829
830 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.
831
832 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!)
833
834 \begin{figure}[htpb]
835         \centering
836         \includegraphics[width=0.9\linewidth]{mixer-align01.png}
837         \caption{Align Mixers window}
838         \label{fig:mixer-align01}
839 \end{figure}
840
841 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}.  
842
843 \textit{Match} consists usually of the next set of steps to take advantage of this feature:
844
845 \begin{enumerate}
846         \item Load your camera media with insertion strategy of \textit{resources only}
847         \item Highlight in the Resources window, all of the media you want to mix.
848         \item Right mouse button on one of the media and click on Open Mixers; all mixer windows come up.
849         \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.
850         \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
851         \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. 
852         \item Use the \texttt{Window $\rightarrow$ Mixers$\dots$ $\rightarrow$  Align mixers} to bring up its dialog window.
853         \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.
854         \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.
855         \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.
856         \item Last, click on the OK green checkmark or to cancel click on the red X.  Or just close the gui.
857         \item To disarm the mixer tracks and related audio tracks for the next multi-cam operations.
858 \end{enumerate}
859
860 \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.
861
862 \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.
863
864 \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}.
865
866 \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.
867
868 \paragraph{Apply} button will apply the nudges that were generated during the Match or Match All execution (figure~\ref{fig:mixer-align02}).
869
870 \begin{figure}[htpb]
871         \centering
872         \includegraphics[width=0.9\linewidth]{mixer-align02.png}
873         \caption{Aligned mixer window after "Match". Note the Nudge amounts above.}
874         \label{fig:mixer-align02}
875 \end{figure}
876
877 \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}).
878
879 \begin{figure}[htpb]
880         \centering
881         \includegraphics[width=1.0\linewidth]{mixer-align03.png}
882         \caption{Match setup for aligning by audio.  Note that [ ] are set over a sample waveform highlighted selection that includes that.}
883         \label{fig:mixer-align03}
884 \end{figure}
885
886 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:
887
888 \begin{enumerate}
889         \item \textit{Mixers} lists the mixers that are active by highlighting them all initially. You can decide that you do
890         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.
891         \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.
892         \item \textit{Audio Tracks} lists each of the mixer audio tracks.  Again, you can highlight a different set of which
893         mixer audio tracks that you want to use for the waveform correlation.  Any audio tracks that are not
894         highlighted, that is \textit{turned off}, will not be considered in the correlation calculation.
895 \end{enumerate}
896
897 The corresponding input position is determined by track input correlation.
898
899 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.
900 $Nudge=0.0$ means just that.
901
902 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.
903
904 The Mixer with the master track generally does not move, everything else will be lined up (figure~\ref{fig:mixer-align04}).
905
906 \begin{figure}[htpb]
907         \centering
908         \includegraphics[width=1.0\linewidth]{mixer-align04.png}
909         \caption{An audio Match is complete. Note the waveform is aligned.}
910         \label{fig:mixer-align04}
911 \end{figure}
912
913 \textit{Match All} option basically consists of the following steps:
914
915 \begin{enumerate}
916         \item Highlight the Mixer to use in the Mixer listbox.
917         \item Highlight the Master Track you want to use in the Master Track listbox.
918         \item On the timeline, mark your selection on the Master Track.
919         \item Click on the \textit{Match All} button.
920         \item Note the nudge values to see if they make sense, and if so, press \textit{Apply}.
921 \end{enumerate}
922
923 \textit{Match} option basic steps (just for comparison with Match All):
924
925 \begin{enumerate}
926         \item Set the In/Out points [ ] of the target.
927         \item On the timeline, mark your selection.
928         \item Click on the \texttt{Match} button.
929         \item Note the nudge values to see if they make sense, then press \textit{Apply} (or \textit{Move} when doing a group).
930 \end{enumerate}
931
932 \subsection{Align Timecodes}%
933 \label{sub:align_timecodes}
934
935 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
936
937 \begin{figure}[ht]
938         \centering
939         \includegraphics[width=1.0\linewidth]{timecode-01.png}
940         \caption{Before sync}
941         \label{fig:timecode-01}
942 \end{figure}
943
944 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 and the second step is to align the edits on the armed tracks using that time on the timeline. 
945
946 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.
947
948 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.
949
950 \begin{figure}[ht]
951         \centering
952         \includegraphics[width=1.0\linewidth]{timecode-02.png}
953         \caption{Clapperboard button}
954         \label{fig:timecode-02}
955 \end{figure}
956
957 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}
958
959 \begin{figure}[ht]
960         \centering
961         \includegraphics[width=1.0\linewidth]{timecode-03.png}
962         \caption{After sync}
963         \label{fig:timecode-03}
964 \end{figure}
965
966 Timecode synchronization in \CGG{} is based on the inclusion of an actual \textit{timecode} saved in
967 the media as can be seen using the \texttt{ffprobe} or \texttt{mediainfo} command line. Examples are shown here:
968
969 \begin{lstlisting}[style=sh]
970 # ffprobe tut1.mov
971 Metadata:
972 handler_name:   VideoHandler
973 timecode:               00:00:20:01
974
975 # mediainfo mtb.mp4
976 Time code of first frame:       11:05:49:41
977 Time code, striped:             Yes
978 Title:                          GoPro AVC
979 \end{lstlisting}
980
981 Many newer cameras and media in a MOV container have valid timecodes often with SMPTE
982 compliant start Timecode in Quicktime format, whereas others do not. Most low end cameras do not.
983 When no timecode is present, various clock time values may be used to synchronize instead.
984
985 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:
986
987 \begin{enumerate}
988         \item if the format context has a timecode use: \texttt{fmt\_ctx $\rightarrow$ timecode - 0}
989         \item if the layer/channel has a timecode use: \texttt{st $\rightarrow$ timecode - (start\_time -nudge)}
990         \item find the first program stream with video stream, and if the video stream has a timecode use:
991         \texttt{st $\rightarrow$ timecode - (start\_time-nudge)}
992         \item find timecode in any stream use: \texttt{st $\rightarrow$ timecode}
993         \item read 100 packets, save \texttt{ofs=pkt.pts*st $\rightarrow$ time\_base - st $\rightarrow$ nudge}:
994         \begin{itemize}
995                 \item decode frame for video stream of the first program
996                 \item if \texttt{frame $\rightarrow$ timecode} has a timecode use:\texttt{ frame $\rightarrow$ timecode - ofs}
997                 \item if side\_data has gop (group of pictures) timecode use: \texttt{gop $\rightarrow$ timecode - ofs}
998                 \item if side\_data has smpte timecode use: \texttt{smpte $\rightarrow$ timecode - ofs}
999         \end{itemize}
1000         \item if the \texttt{filename/url} scans \texttt{*date\_time.ext} use: \texttt{date\_time} (yr, month, day, hr, min, sec, nanosecond)
1001         \item if stat (display file status) works on the \texttt{filename/url} use: \texttt{mtime} (modification time)
1002         \item finally, if none of the above are usable, then return \texttt{failure}
1003 \end{enumerate}
1004
1005 Operation of Align Timecodes includes the following options to help in your setup and review (figure~\ref{fig:timecode-04}):
1006
1007 \begin{figure}[ht]
1008         \centering
1009         \includegraphics[width=1.0\linewidth]{timecode-04.png}
1010         \caption{Timecode via MMB on track and via Resources windows/Info}
1011         \label{fig:timecode-04}
1012 \end{figure}
1013
1014 \begin{itemize}
1015         \item \textit{Align Timecodes} under the \textit{Tracks} pulldown
1016         \item \textit{Clapperboard} icon on the main timeline to set a timecode.
1017         \item Timecode option added to timebar choices (in timecode $hh:mm:ss:ff$) with use of the session frame
1018         rate as a time standard.
1019         \item Time Code Start in the Resources window on the bottom of \textit{Info} for the media if the timecode for that
1020         asset has been scanned and is known. You can scan the asset’s Timecode by using the middle mouse
1021         button on its track which then displays the timecode for that on the timebar.
1022 \end{itemize}
1023
1024 \paragraph*{Notes}
1025
1026 \begin{itemize}
1027         \item \textit{Align Timecodes} is a good first step to quickly sync media up either perfectly or roughly.
1028         \item Currently this is not known to function for syncing audio recorded on a separate audio device,
1029         because no test material was provided to ensure that this works.
1030         \item Disarmed tracks will not be affected by using \textit{Align Timecodes}.
1031         \item No edits or sections will get cut off on the left or elsewhere, unless the moved edits overlap.
1032         \item You can add a timecode to video using an \texttt{ffmpeg} command if you want to align a particular video
1033         which has no timecode to ones that do. For example:
1034 \end{itemize}
1035
1036 \begin{lstlisting}[style=sh]
1037 ffmpeg -i originalfile.mp4 -metadata timecode="14:36:08:29" -c copy newfile.mp4
1038
1039 # where "-i" is followed by the input filename
1040 # where "-metadata timecode" is followed by the timecode key
1041 # where "-c copy" just copies the video/audio to the following output filename
1042 \end{lstlisting}
1043