5 Rendering takes a section of the timeline \index{active region}, performs all the editing,
6 effects and compositing, and creates a new media file. You can then
7 delete all the source assets, play the rendered file, or bring it
8 back into \CGG{} for more editing. All rendering operations are
9 based on a region of the timeline to be rendered. You need to
10 define this region on the timeline. The rendering functions define
11 the region based on a set of rules. When a region is highlighted or
12 in/out points are set, the affected region is rendered. When no
13 region is highlighted, everything after the insertion point is
14 rendered. By positioning the insertion point at the beginning of a
15 track and unsetting all in/out points, the entire track is rendered.
16 But you also have the choice to render \textit{one frame}.
18 \section{Single File Rendering}%
19 \label{sec:single_file_rendering}
20 \index{rendering!single file}
22 Use the \textit{File} pulldown and select Render to start the render dialog
23 (figure~\ref{fig:render}). Then choose the desired parameters.
25 \begin{figure}[htpb] \centering
26 \includegraphics[width=0.7\linewidth]{render.png}
27 \caption{Example of the Render menu}
32 \item[Select a file to render to:] enter the path and filename to
33 write the rendered file to in the textbox below.
34 \item[File Format:] \index{file format} use the down arrow to see file format options.
35 For ffmpeg, which has its own set of options, you will then have to
36 select an ffmpeg file type from the down arrow choices. The format
37 of the file determines whether you can render audio or video or
39 \item[Render audio tracks:] check this toggle to generate audio
41 \item[Render video tracks:] check this toggle to generate video
42 tracks. The Render window will sometimes automatically update the
43 Render Audio Tracks or Render Video Tracks checkbox as allowed by
44 the chosen file format, but you should always check
45 (figure~\ref{fig:render01}). For example, if the PNG file format is
46 selected, only the \textit{Render Video Tracks} will be checked. Or
47 if an ffmpeg format is chosen and the file format does not render
48 audio, the \textit{Render Audio Tracks} will be unchecked. The
49 invalid choices will be ghosted out.
52 \begin{figure}[htpb] \centering
53 \includegraphics[width=0.7\linewidth]{render01.png}
54 \caption{Audio and Video tracks automatically checked for Pro file
60 \item[Wrench:] \index{wrench} select the \textit{wrench} next to each toggle to set
61 compression parameters. If the file format can not store audio or
62 video the compression parameters will be blank. If \textit{Render
63 audio tracks} or \textit{Render video tracks} is selected and the
64 file format does not support it, trying to render will result in an
65 error message. More details in the section:
66 \nameref{sub:extra_cin_option_ffmpeg}
67 \item[Create new file at each label] the option causes a new file to
68 be created when every label in the timeline is encountered – a
69 separate file for each. This is useful for dividing long audio
70 recordings into individual tracks. When using the Render Farm
71 (described later), \textit{Create new file at each label} causes one
72 render farm job to be created at every label instead of using the
73 internal load balancing algorithm to space jobs. If the filename
74 given in the render dialog has a 2 digit number in it, the 2 digit
75 number is overwritten with a different incremental number for every
76 output file. If no 2 digit number is given, \CGG{} automatically
77 concatenates a number to the end of the given filename for every
78 output file. For example, in the filename
79 \texttt{/movies/track01.wav} the $01$ would be overwritten for every
80 output file. The filename \texttt{/movies/track.wav}; however,
81 eventually would become \texttt{/movies/track.wav001} and so on.
82 Filename regeneration is only used when either render farm mode is
83 active or creating new files for every label is active.
84 \item[Render range:] \index{active region} choices are \textit{Project} \index{project},
85 \textit{Selection}, \textit{In/Out points}, and \textit{One Frame}
86 for single images like Tiff. For these images, Render range will
87 have \textit{One Frame} automatically checked and all of the others
88 ghosted since nothing else makes sense (figure~\ref{fig:render02}).
89 This makes it easy to set the insertion point where you want the 1
90 frame to be rendered rather than having to precisely zoom in to set
91 the in/out pointers. Note that whichever Render range is checked,
92 remains checked so that if \textit{One Frame} gets automatically
93 checked, the next time you render it will still be checked and you
94 will have to select a different one if desired. That is why you
95 should always check the settings.
98 \begin{figure}[htpb] \centering
99 \includegraphics[width=0.7\linewidth]{render02.png}
100 \caption{Render menu displaying a PNG \textit{one frame} option}
105 \item[Beep on done:] as a convenience when a render is complete,
106 check this box. It gives you the chance to work on something else
107 while waiting and still be immediately notified when the render is
109 \item[Render Profile:] \index{rendering!profile} another convenience feature to take advantage
110 of if you use specific render formats frequently, is to save that
111 profile for future usage without having to set it up again.
112 \item[Save Profile:] after setting up your render preference
113 formats, use the save profile button to save it.
114 \item[Delete Profile:] if you want to delete a saved profile,
115 highlight the one you no longer want and delete.
116 \item[Insertion strategy:] \index{insertion strategy} select an insertion mode from the
117 available choices as seen when you click on the down arrow on the
118 right hand side of the option. The insertion modes are the same as
119 with loading files. In the case if you select “insert nothing” the
120 file will be written out to disk without changing the current
121 project. For other insertion strategies be sure to prepare the
122 timeline to have the output inserted at the right position before
123 the rendering operation is finished.
125 Even if you only have audio or only have video rendered, a paste
126 insertion strategy will behave like a normal paste operation,
127 erasing any selected region of the timeline and pasting just the
128 data that was rendered. If you render only audio and have some
129 video tracks armed, the video tracks will get truncated while the
130 audio output is pasted into the audio tracks.
133 \section{Batch Rendering}%
134 \label{sec:batch_rendering}
135 \index{batch rendering}
137 Batch Rendering automates the rendering of audio/video files in that
138 you can establish a set of job parameters, save them, and use them
139 repeatedly. It also allows for \CGG{} to be run by external
140 programs, with no need for the user to manually interact with the
141 user interface (figure~\ref{fig:batch01}).
143 \begin{figure}[htpb] \centering
144 \includegraphics[width=1.0\linewidth]{batch01.png}
145 \caption{Example of the Batch Render menu}
149 If you want to render many projects \index{project} to media files without having to
150 constantly set up the render dialog for each one, batch rendering is
151 a more efficient method of rendering. To use this feature you need to
152 understand certain concepts.
155 \item You must define a list of Batches (\textit{Job} \index{job}) before starting the rendering. This is created using the \textit{New} button and displayed in \textit{Batches to Render} dialog.
156 \item Each batch consists of a source project already created in \CGG{}, e.g. \texttt{aaa.xml}, to which we assign the rendering parameters.
158 \item to associate \texttt{aaa.xml} to the batch we use the \textit{EDL Path} input field.
159 \item we decide a name and path for the output file.
160 \item let's set the \textit{File Format} of the output file.
161 \item We configure the file with the Audio/Video \textit{wrench}.
162 \item we decide whether to create different files for each \textit{label} and whether to use a \textit{Render farm}.
164 \item Created the first batch, we will see it appear in the dialog \textit{Batches to Render}.
165 \item Using the \textit{New} button again we create a second batch for another source project (\texttt{bbb.xml}) and configure it at will.
166 \item We continue with the source projects \texttt{ccc.xml}, \texttt{ddd.xml}, etc. until we run out of projects that we want to render in batch.
167 \item Note that each batch has its own name, path and rendering parameters.
168 \item Now we have our \textit{Job}, a list of batches. We can still configure it or modify it if we want to change something. In addition we can delete a batch from the list or we can disable it in the \textit{Enabled} field so that it is not taken into account during rendering, but without deleting it.
169 \item Finally we start batch rendering with the \textit{Start} button.
172 Let's see in detail how to set the Batch Rendering.
174 The first thing to do when preparing to do batch rendering is to
175 create one or more \CGG{} projects to be rendered and save them as a
176 normal project, such as \texttt{aaa.xml}. The batch renderer
177 requires a separate project file for every batch to be rendered.
178 You can use the same \CGG{} project file if you are rendering to
179 different output files, as in an example where you might be creating
180 the same output video in different file formats.
182 You do not have to render an entire projects. We can limit ourselves to an \textit{active region} \index{active region} that we can set through a selection in Cut and Paste mode, with labels or In/Out Points. Or the rendering will start from the Insert Point position until the end of the project. Remember: if we want to render the entire project (and not just one active region) it is important to bring the Insertion Point to the beginning of the timeline. This is the only way we are sure to include the whole project.
184 With all the \CGG{} xml project files prepared with active regions,
185 go to \texttt{File $\rightarrow$ Batch Render}. This brings up the
186 batch render dialog. The interface for batch rendering is more
187 complex than for single file rendering. A list of batches must be
188 defined before starting a batch rendering operation. The table of
189 batches appears on the bottom of the batch render dialog and is
190 called \textit{Batches to render}. Above this are the configuration
191 parameters for a single batch; a batch is simply a pairing of a
192 project file with a choice of output file and render settings.
194 Set the \textit{Output path}, \textit{File format}, \textit{Audio},
195 \textit{Video}, and \textit{Create new file at each label}
196 parameters as if you were rendering a single file. These parameters
197 apply to only one batch. In addition to the standard rendering
198 parameters, you must select the \textit{EDL Path} to be the project
199 file (such as \texttt{aaa.xml}) that will be used in the batch
200 job. In this case, \textit{EDL Path} is not related in anyway with
201 the EDL files as created by \texttt{File/Export EDL}. In batch
202 render mode the program will not overwrite an existing output file
203 and will simply fail, so make sure that no files with the same name
204 as the output files exist before starting.
206 If the batches to render list is empty or nothing is highlighted,
207 click \textit{New} to create a new batch. The new batch will contain
208 all the parameters you just set. Repeatedly press the \textit{New}
209 button to create more batches with the same parameters. When you
210 highlight any batch, you can edit the configuration on the top of
211 the batch render window. The highlighted batch is always
212 synchronized to the information displayed. You can easily change
213 the order in which the batch jobs are rendered, by clicking and
214 dragging a batch to a different position. Hit \textit{Delete} to
215 permanently remove a highlighted batch. In the list box is a column
216 which enables or disables the batch with an \texttt{X} meaning the
217 batch job is enabled and will be run. This way batches can be
218 skipped without being deleted. Click on the \textit{Enabled} column
219 in the list box to enable or disable a batch.
221 The description of each of the columns in the batch list are as
225 \item[Enabled:] an X in this column means the batch job will be run.
226 \item[Labeled:] an \texttt{X} in this column goes hand in hand with
227 create new file at each label.
228 \item[Farmed:] to use or not the render farm.
229 \item[Output:] path and filename for the generated output.
230 \item[EDL:] the path and filename of the source EDL for the batch
232 \item[Elapsed:] the amount of time taken to render the batch if
233 finished. If field is empty, it did not run.
234 \end{description} To start rendering from the first enabled batch,
235 hit \textit{Start}. Once rendering, the main window shows the
236 progress of the batch. After each batch finishes, the elapsed column
237 in the batch list is updated and the next batch is rendered until
238 all the enabled batches are finished. The currently rendering batch
239 is always highlighted red. To stop rendering before the batches are
240 finished without closing the batch render dialog, hit \textit{Stop}.
241 To stop rendering before the batches are finished and close the
242 batch render dialog, hit \textit{Close}. Or you can exit the batch
243 render dialog whether or not anything is being rendered, by hitting
246 You can automate \CGG{} batch renders from other programs. In the
247 batch render dialog, once you have created your list of batch render
248 jobs, you can click the button \textit{Save Jobs} and choose a file
249 to save your batch render list to. Once you have created this file,
250 you can start up a batch render without needing to interact with the
251 \CGG{} user interface. From a shell prompt, from a script, or other
254 \begin{lstlisting}[style=sh]
255 {path_to_cinelerra}/cin -r batchjob.xml
256 \end{lstlisting} substituting your actual filename for
257 \texttt{batchjob.xml}. When invoked with these parameters, \CGG{}
258 will start up and perform the rendering jobs in that list, without
259 creating its usual windows.
261 \subsection{Command Line Rendering}%
262 \label{sub:command_line_rendering}
263 \index{rendering!command line}
265 The command line rendering method consists of a way to load the
266 current set of batch rendering jobs and process them without a
267 GUI\@. This is useful if you want to do rendering on the other side
268 of a low bandwidth network and you have access to a high powered
269 computer located elsewhere. Setting up all the parameters for this
270 operation is somewhat difficult. That is why the command line aborts
271 if any output files already exist.
273 To perform rendering from the command line, first run \CGG{} in
274 graphical mode. Go to \texttt{File $\rightarrow$ Batch
275 Render}. Create the batches you intend to render in the batch window
276 and close the window. This saves the batches in a file. Set up the
277 desired render farm attributes in \texttt{Settings $\rightarrow$
278 Preferences} and quit out of \CGG{} if you want to use the Render
279 Farm capability. These settings are used the next time command line
280 rendering is used to process the current set of batch jobs without a
283 On the command line run:
285 \begin{lstlisting}[style=sh]
289 \subsection{More about Save/Use EDL and Save/Load Jobs}%
290 \label{sub:more_save_use_edl_jobs}
291 \index{batch rendering!more options}
293 The \texttt{File $\rightarrow$ Batch Render} pulldown brings up the
294 Batch Render window to be used for batch rendering as well as DVD/BD
295 creation. There are some additional buttons that can save time and
296 mistakes. These are described next.
298 The \textit{Save to EDL Path} and \textit{Use Current EDL} buttons
299 can be valuable tools for advanced usage or for developers doing
300 testing. Description of how you can expect them to work will help
301 to illustrate how to take advantage of their capabilities.
304 \item[Save to EDL Path] if you have made a change to the EDL, use
305 this button to save the changes so that they will be used in the
306 render operation. Although you can get the same results by using
307 \texttt{File $\rightarrow$ Save\dots}, this capability was initially
308 added to assist developers in testing the batch jobs needed to
309 create dvd/bluray media as it keeps the work focused in a single
310 window and retains the original job name. An example --you have
311 everything all set up with a new job in the Batch Render window
312 using \texttt{generic.xml} for the EDL path and with a job name of
313 \texttt{original\_name.xml}. Then you realize that you forgot to
314 cut out a section in the media that is not wanted in the final
315 product. You can cut that out and then \textit{Save to EDL Path} so
316 your change will be in effect for the rendering. Without this
317 button, you would be using the EDL you started with and the cut
318 would be ignored. Alternatively, if the cut changes are saved via
319 \texttt{File $\rightarrow$ Save as}\dots with a filename of
320 \texttt{new.xml} and then you use \textit{Save to EDL Path}, the
321 current highlighted job displayed in the window as
322 \texttt{original\_name.xml} will be replaced with \texttt{new.xml}.
323 However, it is important to note that the result will be saved with
324 the name \texttt{original\_name} – that is, the new content from
325 \texttt{new.xml} but with the old name of
326 \texttt{original\_name.xml}.
327 \item[Use Current EDL] if you are working on media and still testing
328 out the results, you can take advantage of this click-box to quickly
329 get results. Basically, you change the media, save that change with
330 another name (in order to preserve the original name in case you
331 don't like the changes), and press \textit{Use Current EDL}. As an
332 example, a user creates a new job in the Batch Render window using
333 the current media, previously defined in generic.xml, with the EDL
334 path of \texttt{generic.xml}. The user then changes the media on
335 the timeline, saves the changes via \texttt{File $\rightarrow$ Save
336 as\dots} with a new name, such as \texttt{new\_name.xml}, and then
337 clicks on \textit{Use Current EDL}. In this case, the EDL path
338 listbox will be automatically updated to the \texttt{new\_name.xml}
339 and the current existing highlighted job will be replaced with the
340 \texttt{new\_name.xml} in the EDL column.
341 \item[Save Jobs] when you have set up the batch jobs the way you
342 want and you think you may have to run them more than once, it is
343 beneficial to save the jobs for later use so you easily run them
345 \item[Load Jobs] reload a previous set of saved jobs. This can come
346 in handy if you did not have the time to render them when you
347 originally set them up, if you need to rerun, or if you got
349 \item[Warn if Jobs/Session mismatched] After you set up your render
350 and press Start, the program checks to see if the current EDL
351 session matches your Batch Render job. If the EDL has been changed
352 since the batch job was created, it warns you so that you have the
353 opportunity to \textit{Save to EDL} path to record those changes.
354 Otherwise, you can dismiss that warning box, disable the warning
355 message by unchecking the box and use the original values. If you
356 never want to be warned about the mismatches, leave the box
357 unchecked (figure~\ref{fig:batch02}).
360 \begin{figure}[htpb] \centering
361 \includegraphics[width=1.0\linewidth]{batch02.png}
362 \caption{Batch render with the 4 ghosted buttons on the right side
363 + the Warning message below}
367 \section{Background Rendering}%
368 \label{sec:background_rendering}
369 \index{background rendering}
371 Background rendering causes temporary output to be rendered
372 constantly while the timeline is being modified. The temporary
373 output is displayed during playback whenever possible. This is
374 useful for transitions and previewing effects that are too slow to
375 display in real time. If a Render Farm \index{render farm} is enabled, the render farm
376 is used for background rendering. This gives you the potential for
377 real-time effects if enough network bandwidth and CPU nodes exist.
379 Background rendering is enabled in the \texttt{Performance} tab of
380 the \texttt{Preferences} window. It has one interactive function
381 \texttt{Settings $\rightarrow$ Toggle background rendering} \index{background rendering!toggle}. This
382 sets the point where background rendering starts up to the position
383 of the insertion point. If any video exists, a red bar appears in
384 the time ruler showing what has been background rendered
385 (figure~\ref{fig:back-ren02}).
387 \begin{figure}[htpb] \centering
388 \includegraphics[width=1.0\linewidth]{back-ren02.png}
389 \caption{Settings Background Rendering}
390 \label{fig:back-ren02}
393 It is often useful to insert an effect or a transition and then
394 select \texttt{Settings $\rightarrow$ Toggle background rendering}
395 right before the effect to preview it in real time and full frame
396 rates (figure~\ref{fig:back-ren}).
398 \begin{figure}[htpb] \centering
399 \includegraphics[width=1.0\linewidth]{back-ren.png}
400 \caption{Timeline with the top red bar}
405 \item[Frames per background rendering job] This only works if a
406 Render Farm is being used; otherwise, background rendering creates a
407 single job for the entire timeline. The number of frames specified
408 here is scaled to the relative CPU speed of rendering nodes and used
409 in a single render farm job. The optimum number is 10 - 30 since
410 network bandwidth is used to initialize each job.
411 \item[Frames to preroll background] This is the number of frames to
412 render ahead of each background rendering job. Background rendering
413 is degraded when preroll is used since the jobs are small. When
414 using background rendering, this number is ideally 0. Some effects
415 may require 3 frames of preroll.
416 \item[Output for background rendering] Background rendering
417 generates a sequence of image files in a certain directory. This
418 parameter determines the filename prefix of the image files. It
419 should be accessible to every node in the render farm by the same
420 path. Since hundreds of thousands of image files are usually
421 created, ls commands will not work in the background rendering
422 directory. The browse button for this option normally will not work
423 either, but the configuration button for this option works.
424 \item[File format] The file format for background rendering has to
425 be a sequence of images. The format of the image sequences
426 determines the quality and speed of playback. JPEG generally works
430 \section{Render Farm Usage}%
431 \label{sec:render_farm_usage}
434 Render Farm uses background rendering, a feature of \CGG{} where the
435 video is rendered in the background, to speed up rendering
436 significantly. Because rendering is memory and cpu intensive, using
437 multiple computers on a network via a render farm is a significant
438 gain. With \CGG{} installed on all nodes, the master node and the
439 clients communicate via a network port that you specify.
441 \CGG{} can distribute the rendering tasks over the network to the
442 other computers of the Render Farm. The render farm software tries
443 to process all of the rendering in parallel so that several
444 computers can be used to render the results. The \textit{Total jobs
445 to create} in the setup or labels on the timeline are used to divide
446 a render job into that specified number of tasks. Each background
447 job is assigned a timeline segment to process and the jobs are sent
448 to the various computer nodes depending upon the load balance. The
449 jobs are processed by the nodes separately and written to individual
450 files. You will have to put the files back together via a load with
451 concatenation, or typically by using a command line tool from a
454 \subsection{Basic Steps to Start a Render Farm}%
455 \label{sub:basic_steps_start_render_farm}
457 The following steps are just a guideline to start your render farm.
458 It is assumed that you already have the master and client nodes
459 communication, shared filesystem, permissions and usernames synched.
462 \item On the master computer, use \texttt{Settings} $\rightarrow$
463 \texttt{Preferences} $\rightarrow$ \texttt{Performance} \texttt{tab}
464 to set up a Render Farm:
466 \item check the \textit{Use render farm} box;
467 \item in the \textit{Hostname} box, keyin your hostname or ip
468 address such as 192.168.1.12 or \textit{localhost};
469 \item enter in a port number such as 401--405 (only a root user
470 can use privileged ports) or $1025$ and click on \textit{Add Nodes};
471 \item you will see something like the following in the Nodes
472 listbox to the right:\newline
473 \begin{tabular}{lllc} On & Hostname & Port & Framerate
475 X & 192.168.1.12 & 401 & 0.0 \\
476 X & 192.168.1.12 & 402 & 0.0 \\
477 X & 192.168.1.12 & 403 & 0.0 \\
478 X & 192.168.1.12 & 404 & 0.0 \\
479 X & 192.168.1.12 & 405 & 0.0 \\
480 X & localhost & 406 & 0.0 \\
481 X & localhost & 407 & 0.0 \\
483 \item set the Total number of jobs to create;
484 \item click OK on the bottom of the Preferences window.
486 \item Now we must join the nodes created to instances of \CGG{}. On the client computers ($192.168.1.12$), on the terminal, start 5 background \CGG{} tasks via:
487 \begin{lstlisting}[style=sh]
488 cd {path_to_cinelerra}
489 cin -d 401 cin -d 402
493 \item Similarly, on the terminal, we must join the local nodes created to instances of \CGG{}. On the master node (localhost), start the 2 background \CGG{} tasks via:
494 \begin{lstlisting}[style=sh]
495 cd {path_to_cinelerra}
499 \item When your video is ready, setup a render job via \texttt{File
500 $\rightarrow$ Render} or \texttt{File $\rightarrow$ Batch Render}
502 \item The results will be in the shared file \texttt{path/filename}
503 that you selected in the render menu with the additional numbered
504 job section on the end as $001, 002, 003, \dots 099$ (example,
505 \texttt{video.webm001}).
506 \item When finished, load your new files on new tracks via
507 \texttt{File $\rightarrow$ Load} \textit{concatenate to existing
508 tracks} or if you used ffmpeg, run \textit{RenderMux} from the Shell
510 \item If you plan on doing more rendering, you can just leave the
511 master/client jobs running to use again and avoid having to restart
512 them. Or you can kill them when you no longer are using them.
515 \subsection{Render Farm Menu and Parameter Description}%
516 \label{sub:render_farm_parameter_description}
517 \index{render farm!parameters}
519 Below we describe the Performance tab for configuring a render farm
520 (figure~\ref{fig:farm}).
522 \begin{figure}[htpb] \centering
523 \includegraphics[width=1.0\linewidth]{farm.png}
524 \caption{Settings: Preferences: Performance tab, menu
525 to set up your Render Farm}
530 \item[Project SMP cpus] although this field is not Render Farm
531 specific, it is useful for \CGG{} to have the CPU count and for
532 using multiple threads.
533 \item[Use render farm] check this to turn on the render farm option.
534 Once checked ALL rendering will be done via the farm including the
535 usual Render (\texttt{Shift-R}). You may want to turn if off for
537 \item[Nodes listbox] displays all the nodes on the render farm and
538 shows which ones are currently enabled. The Nodes listbox has 4
539 columns -- On, Hostname, Port, Framerate -- which show the current
540 values. An \textit{X} in the \textit{On} designates that that host
541 is currently enabled; \textit{Hostname} shows the name of the host;
542 \textit{Port} shows the port number that host uses; and
543 \textit{Framerate} will either be zero initially or the current
545 \item[Hostname] this field is used to edit the hostname of an
546 existing node or enter a new node.
547 \item[Port] keyin the port number of an existing or new node here.
548 You can also type in a range of port numbers using a hyphen, for
549 example $1501-1505$ when you need to add many.
550 \item[Apply Changes] this will allow you to edit an existing node
551 and to then commit the changes to hostname and port. The changes
552 will not be committed if you do not click the OK button.
553 \item[Add Nodes] Create a new node with the hostname and port
555 \item[Sort nodes] sorts the nodes list based on the hostname.
556 \item[Delete Nodes] deletes whatever node is highlighted in the
557 nodes list. You can highlight several at once to have them all
559 \item[Client Watchdog Timeout] a default value of $15$ seconds is
560 used here and the tumbler increments by $15$ seconds. A value of
561 $0$ (zero) disables the watchdog so that if you have a slow client,
562 it will not kill the render job while waiting for that client to
564 \item[Total jobs to create] determines the number of jobs to
565 dispatch to the render farm. Total jobs is used to divide a render
566 job into that specified number of tasks. Each background job is
567 assigned a timeline segment to process. The render farm software
568 tries to process all of the rendering in parallel so that several
569 computers can be used to render the results.
571 To start, if you have computers of similar speed, a good number
572 for \textit{Total jobs to create} is the number of computers
573 multiplied by $3$. You will want to adjust this according to the
574 capabilities of your computers and after viewing the framerates.
575 Multiply them by $1$ to have one job dispatched for every node. If
576 you have $10$ client nodes and one master node, specify $33$ to have
577 a well balanced render farm.
578 \item[(overridden if new file at each label is checked)] instead of
579 the number of jobs being set to \textit{Total jobs to create}, there
580 will be a job created for each labeled section. If in the render
581 menu, the option \textit{Create new file at each label} is selected
582 when no labels exist, only one job will be created. It may be quite
583 advantageous to set labels at certain points in the video to ensure
584 that a key portion of the video will not be split into two different
586 \item[Reset rates] sets the framerate for all the nodes to $0$.
587 Frame rates are used to scale job sizes based on CPU speed of the
588 node. Frame rates are calculated only when render farm is enabled.
591 Framerates can really affect how the Render Farm works. The first
592 time you use the render farm all of the rates are displayed as $0$
593 in the \texttt{Settings $\rightarrow$ Preferences}, Performance tab
594 in the Nodes box. As rendering occurs, all of the nodes send back
595 framerate values to the master node and the preferences page is
596 updated with these values. A rate accumulates based on speed. Once
597 all nodes have a rate of non-zero, the program gives out less work
598 to lower rated nodes in an effort to make the total time for the
599 render to be almost constant. Initially, when the framerate scaling
600 values are zero, the program just uses package length -- render size
601 divided by the number of packages to portion out the work (if not
602 labels). If something goes wrong or the rates become suspect, then
603 all of the rest of the work will be dumped into the last job. When
604 this happens, you really should \textit{reset rates} for the next
605 render farm session to restart with a good balance.
607 \begin{lstlisting}[style=sh]
608 {path_to_cinelerra}/cin -h # displays some of the options.
611 \subsection{Detailed Setup Description}%
612 \label{sub:detailed_setup_description}
613 \index{render farm!setup}
615 {\color{red} CAUTION }, any exact command lines worked as of
616 $01/2018$ on a Fedora system. These can change over time and on
617 different operating systems/levels. Always check/verify any command
621 \item[Set up \CGG{}] A \CGG{} render farm is organized into a master
622 node and any number of client nodes. The master node is the
623 computer which is running the gui. The client nodes are anywhere
624 else on the network with \CGG{} installed and are run from the
625 command line. Before you start the master node for \CGG{}, you need
626 to set up a shared filesystem on the disk storage node as this is
627 the node that will have the common volume where all the data will be
628 stored. The location of the project and its files should be the
629 same in the client computers as in the master computer and to avoid
630 problems of permissions, it is better to use the same user in master
631 and clients. For example, if you have the project in
632 \texttt{/home/<user>/project-video} you must create the same
633 directory path on the clients, but empty. Sharing the directory of
634 the location of your project on the master computer can be done with
635 NFS as described next. Alternatively, you can look up on the
636 internet how to use Samba to share a directory.
637 \item[Create a shared filesystem and mount using NFS] All nodes in
638 the render farm should use the same filesystem with the same paths
639 to the project files on all of the master and client nodes. This is
640 easiest to do by setting up an NFS shared disk system.
642 \item On each of the computers, install the nfs software if not
643 already installed. For example, on Debian 9 you will need to run:
644 (be sure to check/verify before using any command line):
645 \begin{lstlisting}[style=sh]
646 apt-get install nfs-kernel-server
648 \item On the computer that contains the disk storage to be shared,
649 define the network filesystem. For example to export \texttt{/tmp},
650 edit the \texttt{/etc/exports} file to add the following line:
651 \begin{lstlisting}[style=sh]
652 192.168.1.0/24(rw,fsid=1,no_root_squash,sync,no_subtree_check)
654 \item Next reset the exported nfs directories using:
655 \begin{lstlisting}[style=sh]
657 \end{lstlisting} and you may have to start or restart nfs:
658 \begin{lstlisting}[style=sh]
659 systemctl restart nfs
661 \item Each of the render farm computers must mount the exported
662 nfs target path. To see the exports which are visible from a
663 client, login as root to the client machine and keyin:
664 \begin{lstlisting}[style=sh]
665 showmount -e <ip-addr> #using the ip address of the storage host
667 \item to access the host disk storage from the other computers in
668 the render farm, mount the nfs export on the corresponding target
669 path: (be sure to check/verify before using any command line):
670 \begin{lstlisting}[style=sh]
671 mount -t nfs <ip-addr>:/<path> <path>
672 \end{lstlisting} where \texttt{<path>} is the storage host
673 directory, and \texttt{<ip-addr>} is the network address of the
674 storage host. Because all of the computers must have the same
675 directory path, create that same directory path with the same
676 uid/gid/permissions on each storage client computer ahead of time.
677 \item To make this permanent across reboots on the client nodes,
678 add the following line to \texttt{/etc/fstab}:
679 \begin{lstlisting}[style=sh]
680 {masternode}:/nfsshare /mnt nfs defaults 0 0
681 \end{lstlisting} You can make this permanent on the disk storage
682 host BUT the command lines shown, which were correct in January 2018
683 on Fedora, may be different for your operating system or in the
684 future. In addition if your network is not up, there may be
685 numerous problems. If you make a mistake, your system may not boot.
686 To make permanent, add the following line to \texttt{/etc/fstab}:
687 \begin{lstlisting}[style=sh]
688 192.168.1.12:/tmp /tmp nfs rw,async,hard,intr,noexec,noauto 0 0
689 \end{lstlisting} You will still have to mount the above manually
690 because of the \textit{noauto} parameter but you won’t have to
691 remember all of the other necessary parameters. Depending on your
692 expertise level, you can change that.
694 Later, to remove access to the storage host filesystem:
695 \begin{lstlisting}[style=sh]
699 Be aware that you may have to adjust any security or firewalls
700 you have in place. \textit{Most firewalls will require extra rules
701 to allow nfs access}. Many have built-in configurations for this.
703 \item[Configure Rendering on Master Node] There is 1 master node
704 which is running the \CGG{} gui and where the video will be edited
705 and the command given to start up the rendering. Any number of
706 client computers can be run from the command line only, so they can
707 be headless since no X or any graphical libraries are needed. Of
708 course, the \CGG{} software must be installed on each of the client
711 \item Assuming you already have \CGG{} installed on the master
712 node, start \CGG{} by clicking on the icon or by typing the
713 following command on the terminal screen:
714 \texttt{/{cinelerra\_path}/cin}.
715 \item Use the \textit{File} pulldown \texttt{Settings $\rightarrow$
716 Preferences}, the Performance tab, to set up your Render Farm
717 options in the Render Farm pane.
718 \item Check the \textit{Use render farm} option. By default, once
719 you enable the option of Render Farm, rendering is usually done
720 using the render farm. Batch rendering can be done locally, or
722 \item Add the hostname or the IP address of each of the client
723 nodes in the Hostname textbox and the port number that you want to
724 use in the Port textbox. You can make sure a port number is not
725 already in use by keying in on the command line:
726 \begin{lstlisting}[style=sh]
727 netstat -n -l -4 --protocol inet
728 \end{lstlisting} Next, click on the \textit{Add Nodes} button and
729 then you will see that host appear in the Nodes list box to the
730 right. The \texttt{X} in the first column of the nodes box denotes
731 that the node is active. To review the \textit{standard} port
732 allocations, check the \texttt{/etc/services} file.
733 \item Enter the total jobs that you would like to be used in the
734 \textit{Total job} textbox.
735 \item The default watchdog timer initial state is usually just
736 fine but can be adjusted later if needed.
737 \item Click OK on the Preferences window when done.
739 \item[Create Workflow] While working on the master computer, it is
740 recommended that you keep all the resources being used on the same
741 shared disk. Load your video/audio piece and do your editing and
742 preparation. Add any desired plugins, such as a Title, to fine-tune
743 your work. You want to make sure your video is ready to be rendered
744 into the final product.
745 \item[Start the Client Nodes] To start up the client nodes run
746 \CGG{} from the command line on each of the client computers using
747 the following command:
748 \begin{lstlisting}[style=sh]
749 /{cinelerra_pathname}/cin -d [port number]
751 /mnt1/bin/cinelerra -d 401
752 \end{lstlisting} This starts \CGG{} in command prompt mode so that
753 it listens to the specified port number for commands from the master
754 node for rendering. When you start each of the clients up, you will
755 see some messages scroll by as each client is created on that
757 \begin{lstlisting}[style=sh]
758 RenderFarmClient::main_loop: client started
759 RenderFarmClient::main_loop: Session started from 127.0.0.1
760 \end{lstlisting} As it completes its jobs, you will should see:
761 \begin{lstlisting}[style=sh]
762 RenderFarmClientThread::run: Session finished
763 \end{lstlisting} A quick way to start a sequence of clients is to
765 \begin{lstlisting}[style=sh,mathescape]
766 for n in `seq 1501 1505`; do
770 \item[Render Using Render Farm] After you have followed the
771 preceding steps, you are ready to use the render farm. Click on
772 \texttt{File $\rightarrow$ Render}\dots which opens the render
773 dialog. The most important point here is to use for \textit{the
774 Output path / Select a file to render to} a path/file name that is
775 on the shared volume that is also mounted on the clients. Click on
776 OK to render. The \CGG{} program divides the timeline into the
777 number of jobs specified by the user. These jobs are then
778 dispatched to the various nodes depending upon the load balance. The
779 first segment will always render on the master node and the other
780 segments will be farmed out to the render nodes. Batch Rendering,
781 as well as BD/DVD rendering, may use the render farm. Each line in
782 the batchbay can enable/disable the render farm. Typically, video
783 can be rendered into many file segments and concatenated, but
784 normally audio is rendered as one monolithic file (not farmed).
786 Another performance feature which can use the Render Farm is
787 \textit{Background Rendering}. This is also enabled on the
788 \texttt{Preferences $\rightarrow$ Performances} tab. The background
789 render function generates a set of image files by pre-rendering the
790 timeline data on the fly. As the timeline is update by editing, the
791 image data is re-rendered to a \textit{background render} storage
792 path. The Render Farm will be used for this operation if it is
793 enabled at the same time as the \textit{background render} feature.
794 \item[Assemble the Output Files] Once all of the computer jobs are
795 complete, you can put the output files together by using the shell
796 script, \textit{RenderMux} (from the menubar \textit{scripts} button
797 just above FF), if the files were rendered using ffmpeg, or you can
798 load these by creating a new track and specifying concatenate to
799 existing tracks in the load dialog in the correct numerical order.
800 File types which support direct copy can be concatenated into a
801 single file by rendering to the same file format with render farm
802 disabled as long as the track dimensions, output dimensions, and
803 asset dimensions are equal.
806 \subsection{Quick and Easy Render Farm Setup – The Buddy System
808 \label{sub:buddy_system_way}
810 These steps are for quickly setting up render farm with the least
811 amount of additional system work, but it is non-optimal. It is
812 useful in situations where a few people all show up with their
813 laptops to work together on the same video/audio file and you don’t
814 want to bother setting up NFS for a shared disk.
817 \item Make sure the \CGG{} program is installed on all of the
818 computers and the network between the main computer and the client
819 computers is working. Use the same version if possible.
820 \item Load your video file on the master node and use \texttt{File
821 $\rightarrow$ Save as}\dots to save it to \texttt{/tmp}.
822 \item Move that same file with the same name to \texttt{/tmp} on all
823 of the client computers via rsh or sneaker net -- the ONLY reason
824 you are doing this is to avoid having to set up NFS or Samba on the
825 buddy client laptops that show up!
826 \item Edit your video/audio file to get it the way you want it and
827 add the plugins, such as a Title, etc.
828 \item Check for a set of unused ports in \texttt{/etc/services}
829 file, if username is root usually $401-425$ are available; if
830 non-root, then $1024-1079$.
831 \item On the master computer, in \texttt{Settings $\rightarrow$
832 Preferences, Performance} tab:
834 \item check the box \textit{Use render farm}
835 \item keyin localhost for the hostname or an ip address of the
837 \item keyin the desired port number for each client; and use
838 \textit{Add Node} for each host
839 \item set total jobs to the number of client computers $+1$
840 multiplied by $3$ (or proportion to client speeds)
843 \item On each buddy client, create a job for each port:
844 \begin{lstlisting}[style=sh]
845 /{cinelerra_pathname}/cin -d port#
847 \item On the master, bring up the render menu and name the output
848 files, for example \texttt{/tmp/myoutput.mp4}.
849 \item The client nodes output results will be on their local
850 \texttt{/tmp} filesystems so you will have to again use
851 \textit{rsh/ftp} or \textit{usb sneaker net} to move them over to
852 the main computer. File names will be the render job output file
853 name with port number tacked on
854 (e.g. \texttt{/tmp/hb.mp4001...mp4005}).
855 \item Load the files by concatenate to existing track on the master
856 node or use RenderMux shell script.
859 \subsection{Multi-core Computers Render Farm Setup}%
860 \label{sub:multi_core_render_farm_setup}
861 \index{render farm!multi core CPU}
863 If you are lucky enough to have a computer with a large cpu core
864 count, setting up a render farm can really take advantage of using
865 all of the cpus. This is much faster than the default automatic
866 threading capability. Since you don’t need to communicate with other
867 computers, you will not have to be concerned about TCP communication
868 or shared disks/files; only localhost nodes. On the terminal, we will open many instances of \CGG{} by connecting them to the jobs created. The number of such jobs can be the total number of CPU threads or not. When you are going to be doing other work
869 simultaneously while rendering a large job, you will want to leave
870 some of the cpus available for that. Be sure to set \textit{Project SMP
871 cpus} in the \texttt{Settings $\rightarrow$ Preferences, Performance} tab to your CPU
874 \subsection{Troubleshooting Tips and Warnings}%
875 \label{sub:troubleshhoting_tips_warnings}
876 \index{render farm!troubleshooting}
878 \noindent If you have problems running the Render Farm. Here is a
879 list of items to check.
882 \item \CGG{} must be installed on the master node and all client
884 \item It is best to have the same username available on all nodes to
885 avoid problems with access rights.
886 \item Check file permissions and ownership to ensure that the
887 clients all have access.
888 \item If a node does not have access to an input asset it will not
889 die, but just display error messages.
890 \item If a node can not access an output asset, the rendering will
892 \item A port in use when stopped may take up to $30$ seconds to time
893 out before you can restart the jobs.
894 \item Each of the port combinations have to be unique across
895 clients, and not already in use in the network.
896 \item \CGG{} load balances on a first come, first serve basis. If
897 the last section of the video is sent to the slowest node, the
898 render job will have to wait for the slowest node to finish. It
899 would be better to start on the slowest node with the earlier
900 section of the video so keep that in mind when designating port
902 \item If not running as root, a port number in the higher range of
903 $1024$ and above must be used instead of the $400+$ range.
904 \item The master and client jobs on the ports do not go away so if
905 you want to stop them, you will have to kill them via: \texttt{kill
907 \item Check to see if there are services listening on the ports to
908 use: \texttt{netstat -n -l -4 --protocol inet}
909 \item There is a watchdog timer in \CGG{} and if there is no
910 response from a client in the designated number of seconds, it will
912 \item The \textit{localhost} should exist as $127.0.0.1$ in
913 \texttt{/etc/hosts} and as the \texttt{lo} network device in
915 \item If the job loads become unbalanced, you may want to
916 \textit{reset rates} to start over for new framerates.
917 \item If jobs are split in a key section on the timeline, you may
918 wish to \textit{use labels} to prevent this.
919 \item For testing purposes, you may want to start a client in the
920 foreground using \texttt{-f} instead of \texttt{-d}.
921 \item If one of the client computers is unavailable, check to see if
922 there is an \texttt{X} to the left of the \texttt{nodename} in the
923 Nodes listbox. Check the \texttt{X} to disable it which sets ON to
925 \item A red message in the lower left hand corner of the main
926 timeline that reads \textit{Failed to start render farm} often means
927 that the client \CGG{} programs were not started up.
928 \item A message of \texttt{RenderFarmWatchdog::run 1 killing server
929 thread \\ \#address\#} means that the client did not respond in
930 time. You can adjust the timer in \texttt{Settings $\rightarrow$
931 Preferences, Performance} tab.
932 \item When you get the message \texttt{RenderFarmClient::main\_loop:
933 bind port 400: Address already in use}, use a different port.
934 \item A message of \texttt{RenderFarmServerThread::open\_client:
935 unknown host abcompany} means that the hostname of abcompany is not
936 in \texttt{/etc/hosts} so you will have to add it or use the ip
938 \item There are numerous error messages associated with file
939 \textit{open/close/status} or problems with the file that should be
940 dealt with according to what is printed out.
941 \item Other illustrative messages may be shown such as:
942 \texttt{RenderFarmClientThread:: run: Session finished}.
945 And here are a couple of more tips for making Render Farm specific
948 \item Because \textit{index files} speed up displaying the video you
949 may want to share these files with the clients on a shared
950 filesystem. More information on index files configuration is
951 outlined in~\ref{sub:index_file_section}.
952 \item Or, one of the convenient features of \CGG{} is the
953 redirection of the path via \texttt{CIN\_CONFIG} as in:
954 \begin{lstlisting}[style=sh]
955 CIN_CONFIG="/<shared_file_pathname>/<filename_such_as_.bcast5>" cin
956 \end{lstlisting} This means that you can make project related
957 configurations that do not impact the default \texttt{\$HOME}
958 config. You can either export your default \texttt{\$HOME} config
959 or the \texttt{CIN\_CONFIG} config to use on the render farm.
964 If one of the render farm computers is connected to the internet,
965 you should use a firewall to maintain the safety of all of the
966 computers. The ports have to be reachable for the intranet but you
967 do not want the ports to be open to the outside.
969 \section{Some Specific Rendering}%
970 \label{sec:some_specific_rendering}
972 \noindent The next few pages relate to rendering for specific common
975 \subsection{FFmpeg Common H.264 Rendering}%
976 \label{sub:ffmpeg_h264_rendering}
978 Because H.264 is so widely used, the method in \CGG{} Infinity is
979 outlined below. These setup steps make it easy to just get started.
982 \item File $\rightarrow$ Render
983 \item File Format $\rightarrow$ FFMPEG + mp4
984 \item Video Wrench $\rightarrow$ Preset $\rightarrow$ h264.mp4 +
985 bitrate: 6000000 (or whatever) + OK
986 \item Audio Wrench $\rightarrow$ Preset $\rightarrow$ h265.mp4 +
987 bitrate: 224000 (or whatever) + OK
988 \item Set your target path in: Render $\rightarrow$ Select a file to
990 \item Set your timeline in: Render $\rightarrow$ Render range +
992 \item Set your insertion strategy: Replace project (or whatever)
993 \item Press OK to start rendering.
996 \subsection{Lossless Rendering}%
997 \label{sub:loseeless_rendering}
998 \index{rendering!lossless}
1000 Lossless means that in the compression of a file, all of the
1001 original data, every single bit, can be recovered when the file is
1002 uncompressed. This is different than \textit{lossy compression}
1003 where some data is permanently deleted so that when uncompressed,
1004 all of the original data can not be exactly recovered. Lossy is
1005 generally used for video and sound, where a certain amount of
1006 information loss will not be detected by most users or the playback
1007 hardware does not reproduce it anyway -- it is a trade-off between
1008 file size and image/sound quality. The files created will be more
1009 than 10 times larger than usual. Most players will not be able to
1010 decode lossless as the bitrate will overwhelm the device.
1012 For x264 lossless compression to work, the only color model allowed
1013 here is yuv420p. Any other specification will be converted to
1014 yuv420p and the data will be modified. Also, keep in mind that the
1015 YUV color model has to be converted to RGB, which also modifies the
1018 To use x264 lossless rendering -- choose File format of ffmpeg, m2ts
1019 in the Render window. Click on the Video wrench, which brings up
1020 the Video Preset window and scroll down in the Compression filebox
1021 and choose \texttt{lossless.m2ts}. \textit{Preset=medium} is the
1022 default, but can be varied from \textit{ultrafast} (least amount of
1023 compression, but biggest file size) to \textit{veryslow} (most
1024 amount of compression, but still HUGE) in the parameter box where
1025 you see $qp=0$. This option is also available for bluray creation.
1027 \subsection{Extra “cin\_” Options for Render with FFmpeg}%
1028 \label{sub:extra_cin_option_ffmpeg}
1029 \index{rendering!ffmpeg options}
1031 There are several special parameters that can be used in the ffmpeg
1032 options file to pass values to the codecs that are not normally
1033 available. They're called Global Options. These are explained
1036 \paragraph{cin\_pix\_fmt} The Render menus allows you to choose the
1037 codec input pixel format (figure~\ref{fig:yuv420}). The Pixels
1038 selection provides the available pixel format options for the chosen
1039 codec type; valid choices vary for the different file types. This
1040 list represents the formats that the codec advertises. It is not
1041 always complete, and it may include options that are not legal with
1042 all parameter configurations.
1044 \begin{figure}[htpb] \centering
1045 \includegraphics[width=1.0\linewidth]{yuv420.png}
1046 \caption{Render \& Video Preset menus displaying Pixel choices}
1051 \item The \textit{Bitrate}, \textit{Quality}, and \textit{Pixels}
1052 fields are only updated when the Video Options are reloaded. This
1053 occurs when you either change the ffmpeg file format, or video
1054 presets compression fields.
1055 \item If the video options preset has \textit{cin\_pix\_fmt}
1056 defined, its value will be loaded as the default. If you override
1057 the default, the value you specify will be used.
1058 \item If the video options preset does not have
1059 \textit{cin\_pix\_fmt}, the default pixel format will be computed by
1060 ffmpeg (\textit{avcodec\_find\_best\_pix\_fmt\_of\_list}), using the
1061 session format as the source choice. The \textit{best} is usually
1062 the format which is most similar in color and depth.
1063 \item If no choices are available, yuv420p for video will be used.
1064 \item You can also specify ffmpeg pixel formats which are not in the
1065 list. The list is provided by ffmpeg as input selection, but is
1066 more like suggestions than fact. For example, the raw formats can
1067 take almost any format, but the rawvideo codec actually specifies no
1071 \noindent Some option files provide \textit{cin\_pix\_fmt} to
1072 suggest a choice for good quality output or to prevent parameter
1073 errors when the other provided parameters conflict with the
1074 \textit{best} pixel format. This is the case in
1075 \texttt{faststart\_h264.mp4} where the \textit{profile=high}
1076 parameter dictates pixel format must be \texttt{yuv420p}.
1078 \paragraph{cin\_bitrate} If you specify the bitrate, you can not
1079 specify the quality.\\ Example: \textit{cin\_bitrate=2000000}
1081 \paragraph{cin\_quality} If you specify the quality, you can not
1082 specify the bitrate.\\ Example: \textit{cin\_quality=7}
1084 \paragraph{cin\_stats\_filename} This parameter is useful for 2 pass
1085 operations.\\ Example: \texttt{cin\_stats\_filename
1086 /tmp/cin\_video\_vp9\_webm}
1088 \paragraph{cin\_sample\_fmt} For audio the preset sample format
1089 default is computed in a similar way as stated above for video or
1090 can be set with the \textit{cin\_sample\_fmt} parameter
1091 (figure~\ref{fig:audio}). If no choices are provided, s16 will be
1092 used.\\ Example: \textit{cin\_sample\_fmt=s16}
1094 \begin{figure}[htpb] \centering
1095 \includegraphics[width=0.7\linewidth]{audio.png}
1096 \caption{Render menu showing where Samples is}
1100 \paragraph{Private Options} (muxers). In the window of the
1101 \textit{wrench} in addition to the \textit{View} button, which
1102 allows more global options and changes to the formats, there is an
1103 additional \textit{Format} button that allows you to modify the
1104 Private Options, i.e.\ relating to specific muxing formats. More
1105 information on all these options can be found at
1106 \href{https://ffmpeg.org/ffmpeg-all.html#Format-Options}{ffmpeg.org}
1109 \subsection{Two-pass Encoding with FFmpeg}%
1110 \label{sub:two_pass_encoding_ffmpeg}
1111 \index{rendering!ffmpeg two-pass encoding}
1113 In \CGG{} for two-pass, you need to run ffmpeg twice, with the same
1114 settings, except for designating the options of pass~1 for the first
1115 pass and then pass~2. In pass~1, a logfile that ffmpeg needs for
1116 the second pass is created. In pass~1 the audio codec should be
1117 specified that will be used in pass~2. For more information on
1118 ffmpeg 2-pass, check
1119 \href{https://trac.ffmpeg.org/wiki/Encode/H.264}{ffmpeg.org}.
1120 Different libraries may have different requirements and you will
1121 probably have to determine this by looking online at ffmpeg or
1122 looking directly at that code.
1124 This 2 line ffmpeg 2-pass operation can be functionally duplicated
1125 in \CGG{} in the steps below them:
1127 \begin{lstlisting}[style=sh]
1128 ffmpeg -y -i $INPUT \
1129 -c:v libx264 -b:v 2600k -pass 1 \
1130 -c:a aac -b:a 128k -f mp4 /dev/null && \
1132 -c:v libx264 -b:v 2600k -pass 2 \
1133 -c:a aac -b:a 128k $OUTPUT.mp4
1137 \item After you have completed your editing, do a Save Session with
1138 \texttt{File $\rightarrow$ Save as}\dots Before starting, be sure
1139 your session is ready for batch render. That is, positioned at the
1140 beginning and nothing selected.
1141 \item Bring up \texttt{File $\rightarrow$ Batch Render}\dots where
1142 you will do the setup.
1143 \item Click on the \textit{Delete} box to remove old jobs
1144 highlighted in the bottom listbox.
1146 \item For the \textit{File Format} choose ffmpeg and mp4 for the
1148 \item Set \textit{Output path} to the path and filename for the
1150 \item Click on \textit{Use Current EDL} to use the designated EDL
1152 \item Click on \textit{New} and you will see a new highlighted job
1153 show up in the listbox at the bottom.
1154 \item Use the Audio wrench to set bitrate to $128000$ ($128k$ as
1155 in ffmpeg example above).
1156 \item Click checkmark OK\@. Open the video tools with the video
1158 \item Set the Video Compression to \textit{h264.mp4} (as seen in
1160 \item Set the bitrate to $2600000$ ($2600k$ as in ffmpeg example
1162 \item Add the following 2 lines after the first line:
1163 \begin{lstlisting}[style=sh]
1165 passlogfile /tmp/"{temporary log file name}.log"
1166 \end{lstlisting} Click checkmark OK.
1168 \item Click on \textit{New} to create the second pass job. You will
1169 see this second job in the listbox below. Use the Video wrench and
1170 change pass1 to pass2 as follows.
1171 \begin{lstlisting}[style=sh]
1174 \item Click checkmark OK.
1175 \item Click on the \textit{Start} box and watch it go!
1176 \item You can now check the output file for results. At the time
1177 this was documented, \textit{rc=2pass} will be in the output.
1180 If you need to re-render this, the Batch Render will still be set up
1181 but you have to click on the \textit{Enabled} column in the listbox
1182 to re-enable the jobs to run which puts an X there. Click Start
1183 again. You can reuse batch job using the \textit{save jobs} and
1184 \textit{load jobs} buttons in the batch render dialog.
1186 \paragraph{Render shortcuts for webm, h264, h265} are available by
1187 using the option files that are already set up for this purpose.
1188 Use the render menu as usual, with ffmpeg/mp4, choose h264 or h265
1189 \textit{pass1of2\_h26x} for the video and
1190 \textit{passes1and\-2\_h26x} for the audio; with ffmpeg/webm, choose
1191 \textit{pass1of2\_vp9}. When that is finished, you will have to use
1192 the render menu again and this time for video, choose
1193 \textit{pass2of2\_h26x} or \textit{pass2of2\_vp9}. The logfile is
1194 hard coded in the options file so will write over any currently
1195 existing logfile if you do not change it before you start the
1198 \paragraph{Requirements for some other libraries} (used instead
1199 of \textit{flags +pass1} \& \textit{passlogfile}):
1201 \item[x265:] add this line:
1202 \begin{lstlisting}[style=sh]
1203 x265-params=pass=1:stats=/tmp/{temporary-log-file-name}.log
1204 \end{lstlisting} at the time this document was written, you should
1205 see in the output: \textit{stats-read=2}
1206 \item[libvpx-vp9, xvid, and huffyuv:]~
1207 \begin{lstlisting}[style=sh]
1208 cin_stats_filename /tmp/{temporary-log-file-name}.log
1209 flags +pass1 (or flags +pass2 for the second pass)
1213 \textit{NOTE:} for vp9, the best Pixels is \textit{gbrp}
1215 \subsection{Use case: High Efficiency Video Coding (HEVC)}%
1216 \label{sub:use_case_hevc}
1218 An example of video profile based on CRF, a quality-controlled
1219 variable bitrate, instead of fixed quality scale (ABR). HEVC
1220 (H.265) was developed as a successor to AVC (H.264) to more
1221 efficiently compress the future large amounts of data from 2/4/8k
1222 videos. In comparison to AVC, an average saving of around 30
1223 percent can be assumed for the same quality. Because HEVC is not
1224 bound to any size format, it is suitable for virtually any image
1227 The following example is HD and FullHD oriented and produces a
1228 picture quality similar to the Blu-ray with some limitations. As
1229 container Matroska (\texttt{.mkv}) is used, but also mp4 and others
1232 \begin{lstlisting}[style=sh]
1235 # CRF 16 creates a balanced compromise
1236 # between quality and file size.
1239 # Preset changes encoding speed and generally
1240 # degrades the overall result. Medium (default)
1244 # Additional parameters that are passed on to the codec.
1245 # me=star improves the search for very fast
1246 # movements, but slows down the encoding.
1247 #x265-params=me=star
1249 # Keyint does FFmpeg automatically, otherwise
1250 # the setting must match the frame rate.
1253 # Profile does FFmpeg automatically.
1256 # Source sRBG and retention of color space.
1257 # 720/1080=bt709 if no profile set. Useful
1258 # for formats smaller than 720 if no lossy
1259 # conversion is desired.
1262 color_primaries=bt709
1264 # Output in 10 bit, prevents 8-bit step formation
1265 pixel_format=yuv420p
1268 \noindent \textit{NOTE:}
1270 A CRF of 16 delivers satisfactory results in most cases. However, if
1271 the video material is really \emph{grainy}, a CRF~16 can lead to
1272 unwanted large files. In this case, a trial export of perhaps one
1273 minute should be performed. The resulting bit rate can be used to
1274 correct the CRF to 17,\,18,\,19\ldots -- remember, a CRF of $0$ (zero)
1275 means lossless, the higher the number the stronger the lossy
1276 compression. The approximate calculation of the final file size can
1277 be extrapolated from the sample export.
1279 The color space information must be used explicitly so that it can
1280 be included in the video. \CGG{} or FFmpeg does not write it by
1281 itself. Without this information the players (e.\,g.\
1282 \href{https://mpv.io/}{mpv}) stick to the dimensions of the video
1283 and take the assumed color model from a table. With videos in the
1284 dimensions from 720 to 1080 this is bt709. For smaller dimensions,
1285 e.\,g.\ DVD, bt601 is assumed and for 4k and above it is
1286 bt2020. Normally this is not a problem, but if you want to export a
1287 FullHD without color loss to a smaller size like 576 for example,
1288 you have to inform the encoder as well as the decoder of the
1289 player. This also applies if the videos are to be loaded on video
1290 platforms, where they are then converted into videos of different
1291 sizes. It is a security measure to prevent false colors, such as the
1292 color profiles in digital photos and the copies made from them.
1294 The HEVC tuning has not been considered here, because it is is
1295 rarely used and requires background knowledge.
1299 \item \href{http://x265.readthedocs.org/en/default/}{x265
1301 \item \href{http://x265.readthedocs.org/en/latest/cli.html}{x265
1302 Command Line Options}
1303 \item \href{http://x265.readthedocs.org/en/latest/presets.html}{x265
1307 \subsection{Piping Video to a Command Line}%
1308 \label{sub:piping_video_command_line}
1309 \index{rendering!command line}
1311 You can pipe a video to any command line on the computer, such as
1312 ffmpeg. This can be especially useful with raw video files. Next
1313 is an example usage.
1316 \item on a terminal window create a named pipe file, for example:
1317 \begin{lstlisting}[style=sh]
1318 mknod /tmp/piper.yuv p
1319 \end{lstlisting} load your video and do your editing
1320 \item set up your Render (\texttt{Shift-R}), you can choose a raw
1321 format such as \textit{yuv} or \textit{rgb}
1322 \item for the filename \textit{Select a file to render to}, use the
1323 named pipe as created in step 1 (\texttt{/tmp/piper.yuv})
1324 \item for \textit{Insertion Strategy}, you will want to make sure to
1325 select \textit{insert nothing}
1326 \item click for OK on the green checkmark.(the \CGG{} gui will look
1327 like it is hanging while waiting for a command line to use the
1329 \item on the terminal window, keyin your command, for example:
1330 \begin{lstlisting}[style=sh]
1331 /mnt0/build5/cinelerra-5.1/thirdparty/ffmpeg-3.4.1/ffmpeg -f \
1332 rawvideo -pixel_format yuv420p -video_size 1280x720 \
1333 -framerate 30000/1001 -i /tmp/piper.yuv /tmp/pys.mov
1337 A slightly different option can be used instead that may be more
1338 familiar to some. In the render menu after choosing the File Format
1339 of \textit{ffmpeg}, use the pulldown to choose \textit{y4m} as the
1340 file type. This choice results in putting a header on the rendered
1341 output with some pertinent information that can be used for ffmpeg
1342 processing thus alleviating the requirement for
1343 \textit{pixel\_format}, \textit{video\_size}, and \textit{framerate}
1344 on the ffmpeg command line. In this case the format is
1345 \textit{yuv4mpegpipe} instead of \textit{rawvideo}. An example
1346 command line would look as follows (assuming the created pipe is
1347 called \texttt{piper.y4m}):
1348 \begin{lstlisting}[style=sh]
1349 ffmpeg -f yuv4mpegpipe -i /tmp/piper.y4m -vcodec libx264 /tmp/test.mp4
1352 \subsection{Faststart Option for MOV type files}%
1353 \label{sub:faststart_option_mov0}
1355 If you have mov video and want to be able to start playing without
1356 having to first load the entire video, \textit{-movflags=+faststart}
1357 is needed for ffmpeg to put the meta-data, known as the \textit{moov
1358 atom}, at the beginning of the file. Otherwise, ffmpeg puts this
1359 atom at the end of the video file which means you have to wait to
1360 play until the whole video is loaded. Or worse yet, if the file
1361 becomes damaged in the middle and you can not get to the end, you
1362 won’t be able to play anything.
1364 Now you can have the \textit{moov atom} put on the front of the file
1365 (automatically via a second pass). To do this, when rendering using
1366 ffmpeg \& either the mp4 or qt format/container, click on the
1367 video/audio wrenches and choose \textit{faststart\_h264}. With the
1368 \textit{qt} format, settings will just be the default whereas the
1369 \textit{mp4} format uses the highest quality and lowest file size as
1370 possible, but you can easily modify these options in the associated
1371 Video Preset textbox.
1373 %%% Local Variables:
1375 %%% TeX-master: "../CinelerraGG_Manual"