+\textit{FFMpeg}:
+
+\begin{center}
+ \begin{tabular}{p{4cm}p{10cm}}
+ \hline
+ -b:v <arg> & Sets target bitrate (e.g. 500k)\\
+ -minrate <arg> & Sets minimum bitrate.\\
+ -maxrate <arg> & Sets maximum bitrate.\\
+ -crf <arg> & sets maximum quality level. Valid values are 0-63, lower numbers are higher quality.\\
+ \hline
+ \end{tabular}
+\end{center}
+
+\textit{Note 1}: Bitrate is specified in kbps, or kilobits per second. In video compression a kilobit is generally assumed to be 1000 bits (not 1024).
+
+\textit{Note 2:} Other codecs in FFMpeg accept the \textit{-crf} parameter but may interpret the value differently. If you are using \textit{-crf} with other codecs you will likely use different values for VP9.
+
+\texttt{bitrate=1024k}\\
+\texttt{minrate=512k}\\
+\texttt{maxrate=1485k}\\
+\texttt{crf=32}
+
+\textit{Tiling} splits the video into rectangular regions, which allows multi-threading for encoding and decoding. The number of tiles is always a power of two. 0=1 tile; 1=2; 2=4; 3=8; 4=16; 5=32\\
+\texttt{tile-columns=2}
+
+(modified from {\small \url{https://trac.ffmpeg.org/wiki/EncodingForStreamingSites}})
+
+To use a 2 second \textit{GOP} (Group of Pictures), simply multiply your output frame rate $\times$ 2. For example, if your input is \textit{-framerate 30}, then use \textit{-g 60}.\\
+\texttt{g=240}
+
+number of \textit{threads} to use during encoding\\
+\texttt{threads=8}
+
+\textit{Quality} may be set to good, best, or realtime\\
+\texttt{quality=good}
+
+\textit{Speed}: this parameter has different meanings depending upon whether quality is set to good or realtime. Speed settings 0-4 apply for VoD in good and best, with 0 being the highest quality and 4 being the lowest. Realtime valid values are 5-8; lower numbers mean higher quality\\
+\texttt{speed=4}
+
+\subsection{Piping Video to a Command Line}%
+\label{sub:piping_video_command_line}
+\index{rendering!command line}
+
+You can pipe a video to any command line on the computer, such as
+ffmpeg. This can be especially useful with raw video files. Next
+is an example usage.
+
+\begin{enumerate}
+ \item on a terminal window create a named pipe file, for example:
+ \begin{lstlisting}[style=sh]
+ mknod /tmp/piper.yuv p
+ \end{lstlisting} load your video and do your editing
+ \item set up your Render (\texttt{Shift-R}), you can choose a raw
+ format such as \textit{yuv} or \textit{rgb}
+ \item for the filename \textit{Select a file to render to}, use the
+ named pipe as created in step 1 (\texttt{/tmp/piper.yuv})
+ \item for \textit{Insertion Strategy}, you will want to make sure to
+ select \textit{insert nothing}
+ \item click for OK on the green checkmark.(the \CGG{} gui will look
+ like it is hanging while waiting for a command line to use the
+ pipe.)
+ \item on the terminal window, keyin your command, for example:
+ \begin{lstlisting}[style=sh]
+ /mnt0/build5/cinelerra-5.1/thirdparty/ffmpeg-3.4.1/ffmpeg -f \
+ rawvideo -pixel_format yuv420p -video_size 1280x720 \
+ -framerate 30000/1001 -i /tmp/piper.yuv /tmp/pys.mov
+ \end{lstlisting}
+\end{enumerate}
+
+A slightly different option can be used instead that may be more
+familiar to some. In the render menu after choosing the File Format
+of \textit{ffmpeg}, use the pulldown to choose \textit{y4m} as the
+file type. This choice results in putting a header on the rendered
+output with some pertinent information that can be used for ffmpeg
+processing thus alleviating the requirement for
+\textit{pixel\_format}, \textit{video\_size}, and \textit{framerate}
+on the ffmpeg command line. In this case the format is
+\textit{yuv4mpegpipe} instead of \textit{rawvideo}. An example
+command line would look as follows (assuming the created pipe is
+called \texttt{piper.y4m}):
+\begin{lstlisting}[style=sh]
+ ffmpeg -f yuv4mpegpipe -i /tmp/piper.y4m -vcodec libx264 /tmp/test.mp4
+\end{lstlisting}
+
+\subsection{Faststart Option for MOV type files}%
+\label{sub:faststart_option_mov0}
+
+If you have mov video and want to be able to start playing without
+having to first load the entire video, \textit{-movflags=+faststart}
+is needed for ffmpeg to put the meta-data, known as the \textit{moov
+ atom}, at the beginning of the file. Otherwise, ffmpeg puts this
+atom at the end of the video file which means you have to wait to
+play until the whole video is loaded. Or worse yet, if the file
+becomes damaged in the middle and you can not get to the end, you
+won’t be able to play anything.
+
+Now you can have the \textit{moov atom} put on the front of the file
+(automatically via a second pass). To do this, when rendering using
+ffmpeg \& either the mp4 or qt format/container, click on the
+video/audio wrenches and choose \textit{faststart\_h264}. With the
+\textit{qt} format, settings will just be the default whereas the
+\textit{mp4} format uses the highest quality and lowest file size as
+possible, but you can easily modify these options in the associated
+Video Preset textbox.
+
+\section{About Image Sequences}%
+\label{sec:about_image_sequences}
+\index{image sequence}
+
+\CGG{} supports image sequences with both decoding and encoding.
+
+\CGG{} by default uses ffmpeg as encoding/decoding engine but we can disable it to have the specific internal engine available. See \nameref{sec:ffmpeg_early_probe_explanation} on how to switch between engines. With the internal engine we can create and load sequences of OpenEXR; PNG; TIFF; TGA; GIF; PPM and JPEG. There is also support for DPX sequences, but only in read and without rendering presets. With ffmpeg we can create and load DPX sequences or create a custom preset for any kind of image. Using these formats results in great timeline efficiency and high video quality at the cost of taking up a lot of space because they are uncompressed (or with lossless compression).
+By rendering, you will get as many still images as there are frames in the project, plus a \textit{file-list} (or \textit{TOC}) that indexes the images. A good practice is to create a folder to contain the images (for example \texttt{/tmp/img\_seq/}) and then open the rendering window in \CGG{} and set a serial and increasing number as the name (for example: \texttt{/tmp/img\_seq/image \%05d.png}). \textit{image} is a generic name chosen at will; $\%$ creates a progressive sequence of distinct images; $05d$ indicates how many digits the image number will be, in this case 5 digits to go from $00000$ to $99999$.
+Once we have our folder of images, if we want to import it in a project just load the file-list, which includes the link to all the files of the sequence.
+To learn more about using and creating a preset with ffmpeg of an image sequence, see \nameref{sec:ffmpeg_image2_streams} and/or \nameref{sec:image_sequence_creation}.
+
+\section{Data storage formulas}%
+\label{sec:data_storage_formulas}
+\index{data storage}
+
+If we are dealing with large projects and poorly compressed formats, we will get large files that are difficult to manage and take up a lot of space on the HDD. We present some simple formulas to be able to calculate the space that will be occupied and the data rates we have to deal with:
+
+\begin{description}
+ \item[Frame size]
+
+ \[ \dfrac{Width \times Height [pixels] \times BitDepth [bits/pixel] \times Color}{8 [bit/Byte]} \]
+ \[= ... [MB/frame] \]
+ \item[File size]
+
+ \[ Frame size [MB/frame] \times frames [frame] = ... [MB] \]
+ \item[Data Rate]
+
+ \[ Frame size [MB/frame] \times fps [frame/sec] = ... [MB/sec] \]
+ \item[Data in 1 Hour]
+
+ \[ \dfrac{Data Rate [MB/sec] \times 3600 [sec]}{1024MB/GB} = ... [GB] \]
+\end{description}
+
+\section{Batch Rendering}%
+\label{sec:batch_rendering}
+\index{batch rendering}
+
+Batch Rendering as implemented in \CGG{} is considered to be more of
+an advanced feature and careful usage is advised. It automates the
+rendering of audio/video files in that
+you can establish a set of job parameters, save them, and use them
+repeatedly (figure~\ref{fig:batch01}). It also allows for \CGG{} to
+be run by external programs, with no need for the user to manually
+interact with the user interface.
+
+\begin{figure}[htpb] \centering
+ \includegraphics[width=1.0\linewidth]{batch01.png}
+ \caption{Example of the Batch Render menu}
+ \label{fig:batch01}
+\end{figure}
+
+If you want to render many projects \index{project} to media files without having to
+constantly set up the render dialog for each one, batch rendering is
+a more efficient method of rendering. To use this feature you need to
+understand certain concepts.
+
+\begin{enumerate}
+ \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.
+ \item Each batch consists of a source project already created in \CGG{}, e.g. \texttt{aaa.xml}, to which we assign the rendering parameters.
+ \begin{itemize}
+ \item to associate \texttt{aaa.xml} to the batch we use the \textit{EDL Path} input field.
+ \item we decide a name and path for the output file.
+ \item let's set the \textit{File Format} of the output file.
+ \item We configure the file with the Audio/Video \textit{wrench}.
+ \item we decide whether to create different files for each \textit{label} and whether to use a \textit{Render farm}.
+ \end{itemize}
+ \item Created the first batch, we will see it appear in the dialog \textit{Batches to Render}.
+ \item Using the \textit{New} button again we create a second batch for another source project (\texttt{bbb.xml}) and configure it at will.
+ \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.
+ \item Note that each batch has its own name, path and rendering parameters.
+ \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.
+ \item Finally we start batch rendering with the \textit{Start} button.
+\end{enumerate}
+
+Let's see in detail how to set the Batch Rendering.
+
+The first thing to do when preparing to do batch rendering is to
+create one or more \CGG{} projects to be rendered and save them as a
+normal project, such as \texttt{aaa.xml}. The batch renderer
+requires a separate project file for every batch to be rendered.
+You can use the same \CGG{} project file if you are rendering to
+different output files, as in an example where you might be creating
+the same output video in different file formats.
+
+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.
+
+With all the \CGG{} xml project files prepared with active regions,
+go to \texttt{File $\rightarrow$ Batch Render}. This brings up the
+batch render dialog. The interface for batch rendering is more
+complex than for single file rendering. A list of batches must be
+defined before starting a batch rendering operation. The table of
+batches appears on the bottom of the batch render dialog and is
+called \textit{Batches to render}. Above this are the configuration
+parameters for a single batch; a batch is simply a pairing of a
+project file with a choice of output file and render settings.
+
+It may be advisable to start with a \textit{Delete} so you don't have any problems. Set the \textit{Output path}, \textit{File format}, \textit{Audio},
+\textit{Video}, and \textit{Create new file at each label}
+parameters as if you were rendering a single file. These parameters
+apply to only one batch. In addition to the standard rendering
+parameters, you must select the \textit{EDL Path} to be the project
+file (such as \texttt{aaa.xml}) that will be used in the batch
+job. In this case, \textit{EDL Path} is not related in anyway with
+the EDL files as created by \texttt{File/Export EDL}. In batch
+render mode the program will not overwrite an existing output file
+and will simply fail, so make sure that no files with the same name
+as the output files exist before starting.
+
+If the batches to render list is empty or nothing is highlighted,
+click \textit{New} to create a new batch. The new batch will contain
+all the parameters you just set. Repeatedly press the \textit{New}
+button to create more batches with the same parameters. When you
+highlight any batch, you can edit the configuration on the top of
+the batch render window. The highlighted batch is always
+synchronized to the information displayed. You can easily change
+the order in which the batch jobs are rendered, by clicking and
+dragging a batch to a different position. Hit \textit{Delete} to
+permanently remove a highlighted batch. In the list box is a column
+which enables or disables the batch with an \texttt{X} meaning the
+batch job is enabled and will be run. This way batches can be
+skipped without being deleted. Click on the \textit{Enabled} column
+in the list box to enable or disable a batch.
+
+The description of each of the columns in the batch list are as
+follows:
+
+\begin{description}
+\item[Enabled:] an X in this column means the batch job will be run.
+\item[Labeled:] an \texttt{X} in this column goes hand in hand with
+ create new file at each label.
+\item[Farmed:] to use or not the render farm.
+\item[Output:] path and filename for the generated output.
+\item[EDL:] the path and filename of the source EDL for the batch
+ job.
+\item[Elapsed:] the amount of time taken to render the batch if
+ finished. If field is empty, it did not run.
+\end{description}
+
+The \texttt{File $\rightarrow$ Batch Render} pulldown brings up the
+Batch Render window to be used for batch rendering as well as DVD/BD
+creation. There are some additional buttons that can save time and
+mistakes. These are described next.
+
+\begin{description}
+ \item[Save Jobs] when you have set up the batch jobs the way you
+ want and you think you may have to run them more than once, it is
+ beneficial to save the jobs for later use so you easily run them
+ again. It is recommended to use a filename with .rc as the extension
+ so that it is obvious that it is a list of batch jobs to be run.
+ \item[Load Jobs] reload a previous set of saved jobs. This can come
+ in handy if you did not have the time to render them when you
+ originally set them up, if you need to rerun, or if you got
+ interrupted.
+\end{description}
+
+To start rendering from the first enabled batch,
+hit \textit{Start}. Once rendering, the main window shows the
+progress of the batch. After each batch finishes, the elapsed column
+in the batch list is updated and the next batch is rendered until
+all the enabled batches are finished. The currently rendering batch
+is always highlighted red. To stop rendering before the batches are
+finished without closing the batch render dialog, hit \textit{Stop}.
+To stop rendering before the batches are finished and close the
+batch render dialog, hit \textit{Close}. Or you can exit the batch
+render dialog whether or not anything is being rendered, by hitting
+\textit{Close}.
+
+You can automate \CGG{} batch renders from other programs. In the
+batch render dialog, once you have created your list of batch render
+jobs, you can click the button \textit{Save Jobs} and choose a file
+to save your batch render list to. It is recommended that you use
+a filename with the extension of .rc in order to make it obvious that
+this is a list of batch jobs to render. Once you have created this file,
+you can start up a batch render without needing to interact with the
+\CGG{} user interface. From a shell prompt, from a script, or other
+program, execute:
+
+\begin{lstlisting}[style=sh]
+{path_to_cinelerra}/cin -r batchjob.rc
+\end{lstlisting} substituting your actual filename for
+\texttt{batchjob.rc}. \textbf{Warning} this file will be modified
+so if you use any filename that is not a legitimate list of batch jobs to
+render, that file will be overwritten and its previous contents destroyed.
+When invoked with these parameters, \CGG{} will start up and run the
+rendering jobs in the list contained in that file starting at the defined
+\textit{active region}, without creating its usual windows. If you do not
+specify a filename, the default will be \$HOME/.bcast5/batchrender.rc.
+Possible messages you might see where you started up the job are as follows.
+\begin{description}
+\item[The following files exist: - filename - Won't overwrite existing files] that batch job will not run in order to prevent writing over previous run.
+\item["filename" No such file or directory] the specified batch job file does not exist.
+\item["filename": Permission denied] the specified batch job file does not have write permission so can not be updated.
+\item[Render::run: filename] the batch job with the name of filename will be processed.
+\item[** rendered 0 frames in 0.000 secs, 0.000 fps] either you used a file that is not a list of batch jobs or the batch jobs within the file were not enabled.
+\end{description}
+
+\subsection{Advanced features}%
+\label{sub:advanced_features}
+\index{batch rendering!more options}
+
+\textbf{Warning}: \textit{Save to EDL path} overwrites the current EDL thus destroying the original contents.
+
+Although the operation of Batch Rendering in \CGG{} is similar to that of other NLEs, there is one big difference that we need to take into account. The render setup is not done on a project-by-project basis, which are then brought into the Batch window to be rendered automatically. The setup must be done in the Batch rendering window, where various projects are loaded and set up. In the case of similar projects, derived from a single EDL with some variation, this mode offers the possibility of altering the projects without having to open each individual project, make the changes, set up the rendering, save and import into the Batch window. The procedure is to select the batch we want to modify in the Batches to render window; operate on the currently open timeline (even if it does not correspond to the one we want to modify) making the desired changes and then press the \textit{Save to EDL path} button. Thus the chosen batch, while retaining its original name, will now contain the modified project. Since this possibility destroys the original EDL overwriting it with the modified one, you must be very careful. This procedure is convenient in case the batches are similar, i.e. they are variations of the same EDL, where we want to experiment with other effects, other output formats or when trying out various cuts of a DVD/BD before the final production. It might also be useful to use an \textit{active region} of the timeline, so as to speed up rendering times but still have an indicative result for comparison. Instead operating on different projects, we can do a \textit{save as...} of the project on the timeline to have a new EDL with a new name and then replace it with the batch selected in the joblist using the \textit{Use Current EDL} button. The new project (with its name) overwrites the original project.
+
+The \textit{Save to EDL Path} and \textit{Use Current EDL} buttons
+can be valuable tools for advanced usage or for developers doing
+testing. Description of how you can expect them to work will help
+to illustrate how to take advantage of their capabilities (figure~\ref{fig:batch-advanced}):
+
+\begin{figure}[htpb] \centering
+ \includegraphics[width=0.7\linewidth]{batch-advanced.png}
+ \caption{New Buttons with Unsafe GUI in batchrender}
+ \label{fig:batch-advanced}
+\end{figure}
+
+
+\begin{description}
+\item[Save to EDL Path] Warning: this function overwrites the contents of the original EDL with new data, keeping the name of the original. If we don't know exactly what we're doing we may lose the original project. If you have made a change to the EDL, use
+ this button to save the changes so that they will be used in the
+ render operation. Although you can get the same results by using
+ \texttt{File $\rightarrow$ Save\dots}, this capability was initially
+ added to assist developers in testing the batch jobs needed to
+ create dvd/bluray media as it keeps the work focused in a single
+ window and retains the original job name. An example --you have
+ everything all set up with a new job in the Batch Render window
+ using \texttt{generic.xml} for the EDL path and with a job name of
+ \texttt{original\_name.xml}. Then you realize that you forgot to
+ cut out a section in the media that is not wanted in the final
+ product. You can cut that out and then \textit{Save to EDL Path} so
+ your change will be in effect for the rendering. Without this
+ button, you would be using the EDL you started with and the cut
+ would be ignored. Alternatively, if the cut changes are saved via
+ \texttt{File $\rightarrow$ Save as}\dots with a filename of
+ \texttt{new.xml} and then you use \textit{Save to EDL Path}, the
+ current highlighted job displayed in the window as
+ \texttt{original\_name.xml} will be replaced with \texttt{new.xml}.
+ However, it is important to note that the result will be saved with
+ the name \texttt{original\_name} – that is, the new content from
+ \texttt{new.xml} but with the old name of
+ \texttt{original\_name.xml}. To have this functionality we have to enable the checkbox in \texttt{Settings $\rightarrow$ Preferences $\rightarrow$ Appearance} tab; section \textit{Dangerous:} and unchecked (default) \textit{Unsafe GUI in batchrender}.
+\item[Use Current EDL] Warning: this function overwrites the contents of the original EDL with new project. If we don't know exactly what we're doing we may lose the original project. if you are working on media and still testing
+ out the results, you can take advantage of this click-box to quickly
+ get results. Basically, you change the media, save that change with
+ another name (in order to preserve the original name in case you
+ don't like the changes), and press \textit{Use Current EDL}. As an
+ example, a user creates a new job in the Batch Render window using
+ the current media, previously defined in generic.xml, with the EDL
+ path of \texttt{generic.xml}. The user then changes the media on
+ the timeline, saves the changes via \texttt{File $\rightarrow$ Save
+ as\dots} with a new name, such as \texttt{new\_name.xml}, and then
+ clicks on \textit{Use Current EDL}. In this case, the EDL path
+ listbox will be automatically updated to the \texttt{new\_name.xml}
+ and the current existing highlighted job will be replaced with the
+ \texttt{new\_name.xml} in the EDL column.
+\item[Warn if Jobs/Session mismatched] Warning: It is better to keep this function unchecked because it is only needed in case of changes on the original EDL. By default it is hidden and is shown only if we enable the checkbox in \texttt{Settings $\rightarrow$ Preferences $\rightarrow$ Appearance} tab; section \textit{Dangerous:} and checked \textit{Unsafe GUI in batchrender}. After you set up your render
+ and press Start, the program checks to see if the current EDL
+ session matches your Batch Render job. If the EDL has been changed
+ since the batch job was created, it warns you so that you have the
+ opportunity to \textit{Save to EDL} path to record those changes.
+ Otherwise, you can dismiss that warning box, disable the warning
+ message by unchecking the box and use the original values. If you
+ never want to be warned about the mismatches, leave the box
+ unchecked (figure~\ref{fig:batch02}). It is advisable to keep it unchecked because it can cause problems.
+\end{description}