add 19
[goodguy/cin-manual-latex.git] / parts / Rendering.tex
index ed92c48efca5884509b1f49c14c957eaab6e4cf8..1287f88d95491982c1c0bce0de25447d3ce63ef1 100644 (file)
@@ -7,7 +7,7 @@ positioning the insertion point at the beginning of a track and unsetting all in
 \section{Single File Rendering}%
 \label{sec:single_file_rendering}
 
-\noindent Use the File pulldown and select Render to start the render dialog (figure~\ref{fig:render}).  Then choose the desired parameters.
+Use the File pulldown and select Render to start the render dialog (figure~\ref{fig:render}).  Then choose the desired parameters.
 
 \begin{figure}[htpb]
     \centering
@@ -33,7 +33,9 @@ positioning the insertion point at the beginning of a track and unsetting all in
 \begin{description}
     \item[Wrench:] select the \textit{wrench} next to each toggle to set compression parameters.  If the file format can not store audio or video the compression parameters will be blank.  If \textit{Render audio tracks} or \textit{Render video tracks} is selected and the file format does not support it, trying to render will result in an error message.
     \item[Create new file at each label] the option causes a new file to be created when every label in the timeline is encountered – a separate file for each.  This is useful for dividing long audio recordings into individual tracks.  When using the Render Farm (described later), \textit{Create new file at each label} causes one render farm job to be created at every label instead of using the internal load balancing algorithm to space jobs.   If the filename given in the render dialog has a 2 digit number in it, the 2 digit number is overwritten with a different incremental number for every output file. If no 2 digit number is given, Cinelerra automatically concatenates a number to the end of the given filename for every output file.
-    For example, in the filename \texttt{/movies/track01.wav} the $01$ would be overwritten for every output file. The filename \texttt{/movies/track.wav}; however, would become \texttt{/movies/track.wav001} and so on.  Filename regeneration is only used when either render farm mode is active or creating new files for every label is active.
+    For example, in the filename \texttt{/movies/track01.wav} the $01$ would be overwritten for every output file. 
+    The filename \texttt{/movies/track.wav}; however, eventually would become \texttt{/movies/track.wav001} and so on.  
+    Filename regeneration is only used when either render farm mode is active or creating new files for every label is active.
     \item[Render range:] choices are \textit{Project}, \textit{Selection}, \textit{In/Out points}, and \textit{One Frame} for single images like Tiff.  For these images, Render range will have \textit{One Frame} automatically checked and all of the others ghosted since nothing else makes sense (figure~\ref{fig:render02}).  This makes it easy to set the insertion point where you want the 1 frame to be rendered rather than having to precisely zoom in to set the in/out pointers.  Note that whichever Render range is checked, remains checked so that if \textit{One Frame} gets automatically checked, the next time you render it will still be checked and you will have to select a different one if desired.  That is why you should always check the settings.
 \end{description}
 
@@ -71,7 +73,7 @@ If you want to render many projects to media files without having to constantly
 
 The first thing to do when preparing to do batch rendering is to create one or more Cinelerra projects to be rendered and save them as a normal project, such as \texttt{ProjectA.xml}.  The batch renderer requires a separate project file for every batch to be rendered.  You can use the same Cinelerra 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.
 
-To create a project file which can be used in batch render, set up your project and define the region to be rendered either by highlighting it, setting in/out points around it, or positioning the insertion point before it. Then save the project as usual to your project.xml file. Define as many projects as needed this way.  The batch renderer takes the active region from the EDL file for rendering.
+To create a project file which can be used in batch render, set up your project and define the region to be rendered either by highlighting it, setting in/out points around it, or positioning the insertion point before it. Then save the project as usual to your project.xml file. Define as many projects as needed this way.  The batch renderer takes the active region from the EDL file for rendering. If we have not set active regions, it is better to bring the insertion point to the beginning of the timeline to avoid possible problems with the rendering.
 
 With all the Cinelerra 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.
 
@@ -88,8 +90,7 @@ The description of each of the columns in the batch list are as follows:
     \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}
-
-\noindent To start rendering from the first enabled batch, hit \texttt{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 \texttt{Stop}.  To stop rendering before the batches are finished and close the batch render dialog, hit \texttt{Close}.  Or you can exit the batch render dialog whether or not anything is being rendered, by hitting \texttt{Close}.
+To start rendering from the first enabled batch, hit \texttt{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 \texttt{Stop}.  To stop rendering before the batches are finished and close the batch render dialog, hit \texttt{Close}.  Or you can exit the batch render dialog whether or not anything is being rendered, by hitting \texttt{Close}.
 
 You can automate Cinelerra 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 \texttt{Save Jobs} and choose a file to save your batch render list to.  Once you have created this file, you can start up a batch render without needing to interact with the Cinelerra user interface.  From a shell prompt, from a script, or other program, execute:
 
@@ -143,12 +144,8 @@ The \texttt{Save to EDL Path} and \texttt{Use Current EDL} buttons can be valuab
     run them more than once, it is beneficial to save the jobs for later use so you easily run them again.
     \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.
-    \item[warn if jobs/session mismatched] 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}).
+    \item[Warn if Jobs/Session mismatched] 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}).
 \end{description}
 
 \begin{figure}[htpb]
@@ -201,38 +198,39 @@ Cinelerra can distribute the rendering tasks over the network to the other compu
 The following steps are just a guideline to start your render farm.  It is assumed that you already have the master and client nodes communication, shared filesystem, permissions and usernames synched.
 
 \begin{enumerate}
-    \item On the master computer, use \texttt{Settings $\rightarrow$ Preferences $\rightarrow$ Performance tab} to set up a Render Farm:
+    \item On the master computer, use \texttt{Settings} $\rightarrow$ \texttt{Preferences} $\rightarrow$ \texttt{Performance} \texttt{tab} to set up a Render Farm:
     \begin{itemize}
         \item check the \texttt{Use render farm} box;
-        \item in the Hostname box, keyin your hostname or ip address such as $192.168.1.12$ or \texttt{localhost};
-        \item enter in a port number such as $401-405$ or $1025$ and click on \texttt{Add Nodes};
+        \item in the \texttt{Hostname} box, keyin your hostname or ip address such as \\
+            192.168.1.12 or \texttt{localhost};
+        \item enter in a port number such as 401--405 (only a root user can use privileged ports) or $1025$  and click on \texttt{Add Nodes};
         \item you will see something like the following in the Nodes listbox to the right:
-        \begin{lstlisting}[language=bash]
-            On         Hostname                Port    Framerate
-            X          192.168.1.12    401         0.0
-            X          192.168.1.12    402         0.0
-            X          192.168.1.12    403         0.0 
-            X          192.168.1.12    404         0.0
-            X          192.168.1.12    405         0.0
-            X          localhost               406         0.0
-            X          localhost               407         0.0
-        \end{lstlisting}
+            \begin{tabular}{lllc}
+                On & Hostname     & Port & Framerate \\\midrule
+                X  & 192.168.1.12 & 401  & 0.0       \\
+                X  & 192.168.1.12 & 402  & 0.0       \\
+                X  & 192.168.1.12 & 403  & 0.0       \\
+                X  & 192.168.1.12 & 404  & 0.0       \\
+                X  & 192.168.1.12 & 405  & 0.0       \\
+                X  & localhost    & 406  & 0.0       \\
+                X  & localhost    & 407  & 0.0       \\
+            \end{tabular}
         \item set the Total number of jobs to create;
         \item click OK on the bottom of the Preferences window.
     \end{itemize}
     \item On the client computers ($192.168.1.12$), start 5 background cinelerra tasks via:
     \begin{lstlisting}[language=bash]
-        cd /{path_to_cinelerra}
-        cin -d 401
-        cin -d 402
-        …
-        cin -d 405
+$ cd /{path_to_cinelerra}
+$ cin -d 401
+$ cin -d 402 
+...
+$ cin -d 405
     \end{lstlisting}
     \item On the master node (localhost), start the 2 background cinelerra tasks via:
     \begin{lstlisting}[language=bash]
-    cd /{path_to_cinelerra}
-    cin -d 406
-    cin -d 407
+$ cd /{path_to_cinelerra}
+$ cin -d 406
+$ cin -d 407
     \end{lstlisting}
     \item When your video is ready, setup a render job via \texttt{File $\rightarrow$  Render} or \texttt{File $\rightarrow$  Batch Render} and check \texttt{OK}.
     \item The results will be in the shared file path / filename that you selected in the render menu with the
@@ -272,7 +270,7 @@ Below we describe the Performance tab for configuring a render farm (figure~\ref
     \item[Reset rates] sets the framerate for all the nodes to $0$.  Frame rates are used to scale job sizes based on CPU speed of the node.  Frame rates are calculated only when render farm is enabled.
 \end{description}
 
-Framerates can really affect how the Render Farm works.  The first time you use the render farm all of the rates are displayed as $0$ in the \texttt{Settings $\rightarrow$ Preferences}, Performance tab in the Nodes box.  As rendering occurs, all of the nodes send back framerate values to the master node and the preferences page is updated with these values.  A rate accumulates based on speed.  Once all nodes have a rate of non-zero, the program gives out less work to lower rated nodes in an effort to make the total time for the render to be almost constant.
+Framerates can really affect how the Render Farm works.  The first time you use the render farm all of the rates are displayed as $0$ in the \texttt{Settings $\rightarrow$ Prefe\-rences}, Performance tab in the Nodes box.  As rendering occurs, all of the nodes send back framerate values to the master node and the preferences page is updated with these values.  A rate accumulates based on speed.  Once all nodes have a rate of non-zero, the program gives out less work to lower rated nodes in an effort to make the total time for the render to be almost constant.
 Initially, when the framerate scaling values are zero, the program just uses package length --- render size 
 divided by the number of packages to portion out the work (if not labels).  If something goes wrong or the rates become suspect, then all of the rest of the work will be dumped into the last job.  When this happens, you really should \texttt{reset rates} for the next render farm session to restart with a good balance.
 
@@ -294,43 +292,43 @@ divided by the number of packages to portion out the work (if not labels).  If s
         \item On each of the computers, install the nfs software if not already installed.  For example, on Debian 9
         you will need to run: (be sure to check/verify before using any command line):
         \begin{lstlisting}[language=bash]
-            apt-get install nfs-kernel-server
+$ apt-get install nfs-kernel-server
         \end{lstlisting}
         \item On the computer that contains the disk storage to be shared, define the network filesystem.  For
         example to export \texttt{/tmp}, edit the \texttt{/etc/exports} file to add the following line:
         \begin{lstlisting}[language=bash]
-        /tmp 192.168.1.0/24(rw,fsid=1,no_root_squash,sync,no_subtree_check)
+192.168.1.0/24(rw,fsid=1,no_root_squash,sync,no_subtree_check)
         \end{lstlisting}
         \item Next reset the exported nfs directories using: 
         \begin{lstlisting}[language=bash]
-        exportfs -ra
+$ exportfs -ra
         \end{lstlisting} 
         and you may have to start or restart nfs: 
         \begin{lstlisting}[language=bash]
-        systemctl restart nfs
+$ systemctl restart nfs
         \end{lstlisting}
         \item Each of the render farm computers must mount the exported nfs target path.  To see the exports
         which are visible from a client, login as root to the client machine and keyin:
         \begin{lstlisting}[language=bash]
-        showmount -e <ip-addr>  #using the ip address of the storage host
+$ showmount -e <ip-addr>  #using the ip address of the storage host
         \end{lstlisting}
         \item to access the host disk storage from the other computers in the render farm, mount the nfs export on
         the corresponding target path: (be sure to check/verify before using any command line):
         \begin{lstlisting}[language=bash]
-        mount -t nfs <ip-addr>:/<path>  <path>
+$ mount -t nfs <ip-addr>:/<path>  <path>
         \end{lstlisting}
         where \texttt{<path>} is the storage host directory, and \texttt{<ip-addr>} is the network address of the storage host.        
         Because all of the computers must have the same directory path, create that same directory path with the same uid/gid/permissions on each storage client computer ahead of time.
         \item To make this permanent across reboots on the client nodes, add the following line to \texttt{/etc/fstab}: 
         \begin{lstlisting}[language=bash]
-        {masternode}:/nfsshare /mnt nfs defaults 0 0
+{masternode}:/nfsshare /mnt nfs defaults 0 0
         \end{lstlisting}
         You can make this permanent on the disk storage host BUT the command lines shown, which were
         correct in January 2018 on Fedora, may be different for your operating system or in the future.  In
         addition if your network is not up, there may be numerous problems.  If you make a mistake, your
         system may not boot.  To make permanent, add the following line to \texttt{/etc/fstab}:
         \begin{lstlisting}[language=bash]
-        192.168.1.12:/tmp /tmp nfs rw,async,hard,intr,noexec,noauto 0 0
+192.168.1.12:/tmp /tmp nfs rw,async,hard,intr,noexec,noauto 0 0
         \end{lstlisting}
         You will still have to mount the above manually because of the \textit{noauto} parameter but you won’t
         have to remember all of the other necessary parameters.  Depending on your expertise level, you can
@@ -338,7 +336,7 @@ divided by the number of packages to portion out the work (if not labels).  If s
         
         Later, to remove access to the storage host filesystem:        
         \begin{lstlisting}[language=bash]
-        umount <path>
+$ umount <path>
         \end{lstlisting}
         
         Be aware that you may have to adjust any security or firewalls you have in place.  \textit{Most firewalls will require extra rules to allow nfs access}.  Many have built-in configurations for this. 
@@ -354,7 +352,7 @@ divided by the number of packages to portion out the work (if not labels).  If s
         number that you want to use in the Port textbox.  You can make sure a port number is not already in
         use by keying in on the command line:
         \begin{lstlisting}[language=bash]
-        netstat -n -l -4 --protocol inet
+$ netstat -n -l -4 --protocol inet
         \end{lstlisting}
         Next, click on the \texttt{Add Nodes}
         button and then you will see that host appear in the Nodes list box to the right.  The \texttt{X} in the first
@@ -367,20 +365,20 @@ divided by the number of packages to portion out the work (if not labels).  If s
     \item[Create Workflow] While working on the master computer, it is recommended that you keep all the resources being used on the same shared disk.  Load your video/audio piece and do your editing and preparation.  Add any desired plugins, such as a Title, to fine-tune your work.  You want to make sure your video is ready to be rendered into the final product.
     \item[Start the Client Nodes] To start up the client nodes run Cinelerra from the command line on each of the client computers using the following command:
     \begin{lstlisting}[language=bash]
-    /{cinelerra_pathname}/cin -d [port #]   ;   \#for example /mnt1/bin/cinelerra -d 401
+/{cinelerra_pathname}/cin -d [port #]   ;   \#for example /mnt1/bin/cinelerra -d 401
     \end{lstlisting}
     This starts cinelerra in command prompt mode so that it listens to the specified port number for commands from the master node for rendering.  When you start each of the clients up, you will see some messages scroll by as each client is created on that computer, such as:
     \begin{lstlisting}[language=bash]
-    RenderFarmClient::main_loop: client started
-    RenderFarmClient::main_loop: Session started from 127.0.0.1
+RenderFarmClient::main_loop: client started
+RenderFarmClient::main_loop: Session started from 127.0.0.1
     \end{lstlisting}
     As it completes its jobs, you will should see:
     \begin{lstlisting}[language=bash]
-    RenderFarmClientThread::run: Session finished
+RenderFarmClientThread::run: Session finished
     \end{lstlisting}
     A quick way to start a sequence of clients is to use:
     \begin{lstlisting}[language=bash]
-    or n in `seq 1501 1505`; do cin -d $n; done
+or n in `seq 1501 1505`; do cin -d $n; done
     \end{lstlisting}
     \item[Render Using Render Farm] After you have followed the preceding steps, you are ready to use the render farm.  Click on File $\rightarrow$ Render\dots which opens the render dialog.  The most important point here is to use for \texttt{the Output path / Select a file to render to} a path/file name that is on the shared volume that is also mounted on the clients.  Click on \texttt{OK} to render. The cinelerra program divides the timeline into the number of jobs specified by the user.  These jobs are then dispatched to the various nodes depending upon the load balance. The first segment will always render on the master node and the other segments will be farmed out to the render nodes.  Batch Rendering, as well as BD/DVD rendering, may use the render farm.  Each line in the batchbay can enable/disable the render farm.  Typically, video can be rendered into many file segments and concatenated, but normally audio is rendered as one monolithic file (not farmed).
     
@@ -412,7 +410,7 @@ These steps are for quickly setting up render farm with the least amount of addi
     \end{itemize}
     \item On each buddy client, create a job for each port:    
     \begin{lstlisting}[language=bash]
-    /{cinelerra_pathname}/cin -d port#
+/{cinelerra_pathname}/cin -d port#
     \end{lstlisting}
     \item On the master, bring up the render menu and name the output files, for example \texttt{/tmp/myoutput.mp4}.
     \item The client nodes output results will be on their local \texttt{/tmp} filesystems so you will have to again use
@@ -426,15 +424,13 @@ These steps are for quickly setting up render farm with the least amount of addi
 
 Because index files speed up displaying the video you may want to share these files with the clients on a shared filesystem.  There is a configuration option available in \texttt{Settings $\rightarrow$ Preferences}, the Interface tab, that sets up in your preferences the location of the index files which you can put on a shared disk.
 Screencast below shows part of the Preferences menu where you can change the index files setup (figure~\ref{fig:index}).
-
 \begin{figure}[htpb]
     \centering
     \includegraphics[width=0.8\linewidth]{images/index.png}
     \caption{Index file setup for your preferred configuration for Render Farm sharing or anything}
     \label{fig:index}
 \end{figure}
-
-\noindent Or, one of the convenient features of cin5 is the redirection of the path via \texttt{CIN\_CONFIG} as in:
+ Or, one of the convenient features of cin5 is the redirection of the path via \texttt{CIN\_CONFIG} as in:
 \begin{lstlisting}[language=bash]
 CIN_CONFIG=/<shared_file_pathname>/<filename_such_as_.bcast5> /<cinelerra_pathname>/cin
 \end{lstlisting}
@@ -472,14 +468,14 @@ This means that you can make project related configurations that do not impact t
     in the Nodes listbox.  Check the \texttt{X} to disable it which sets \texttt{On} to \texttt{Off}.
     \item A red message in the lower left hand corner of the main timeline that reads \textit{Failed to start render
     farm} often means that the client cinelerra programs were not started up.
-    \item A message of \texttt{RenderFarmWatchdog::run 1 killing server thread \#address\#} means that the client did
+    \item A message of \texttt{RenderFarmWatchdog::run 1 killing server thread \\ \#address\#} means that the client did
     not respond in time.  You can adjust the timer in Settings $\rightarrow$ Preferences, Performance tab.
     \item When you get the message \texttt{RenderFarmClient::main\_loop: bind port 400: Address already in use}, use a different port.
     \item A message of \texttt{RenderFarmServerThread::open\_client: unknown host abcompany} means that the
     hostname of abcompany is not in \texttt{/etc/hosts} so you will have to add it or use the ip address instead.
     \item There are numerous error messages associated with file \texttt{open/close/status} or problems with the file
     that should be dealt with according to what is printed out.
-    \item Other illustrative messages may be shown such as: \texttt{RenderFarmClientThread::run: Session finished}.
+    \item Other illustrative messages may be shown such as: \texttt{RenderFarmClientThread:: run: Session finished}.
 \end{itemize}
 
 \paragraph{Warnings}
@@ -590,15 +586,15 @@ ffmpeg -i input -c:v libx264 -b:v 2600k -pass 2 -c:a aac -b:a 128k output.mp4
         \item Set the bitrate to $2600000$ ($2600k$ as in ffmpeg example above).
         \item Add the following 2 lines after the first line:
         \begin{lstlisting}[language=bash]
-        flags +pass1
-        passlogfile /tmp/{temporary log file name}.log
+flags +pass1
+passlogfile /tmp/{temporary log file name}.log
         \end{lstlisting}
         Click checkmark \texttt{OK}.
     \end{itemize}    
     \item Click on \texttt{New} to create the second pass job.  You will see this second job in the listbox below.
      Use the Video wrench and change pass1 to pass2 as follows.
         \begin{lstlisting}[language=bash]
-        flags +pass2
+flags +pass2
         \end{lstlisting}
     \item Click checkmark \texttt{OK}.
     \item Click on the \texttt{Start} box and watch it go!
@@ -608,25 +604,104 @@ ffmpeg -i input -c:v libx264 -b:v 2600k -pass 2 -c:a aac -b:a 128k output.mp4
 
 If you need to re-render this, the Batch Render will still be set up but you have to click on the \texttt{Enabled} column in the listbox to re-enable the jobs to run which puts an X there.  Click Start again. You can reuse batch job using the \texttt{save jobs} and \texttt{load jobs} buttons in the batch render dialog.
 
-\paragraph{Render shortcuts for webm, h264, h265} are available by using the option files that are already set up for this purpose.  Use the render menu as usual, with ffmpeg/mp4, choose h264 or h265 \texttt{pass1of2\_h26x} for the video and \texttt{passes1and2\_h26x} for the audio; with ffmpeg/webm, choose \texttt{pass1of2\_vp9}.  When that is finished, you will have to use the render menu again and this time for video, choose \texttt{pass2of2\_h26x} or \texttt{pass2of2\_vp9}.  The logfile is hard coded in the options file so will write over any currently existing logfile if you do not change it before you start the render.
+\paragraph{Render shortcuts for webm, h264, h265} are available by using the option files that are already set up for this purpose.  Use the render menu as usual, with ffmpeg/mp4, choose h264 or h265 \texttt{pass1of2\_h26x} for the video and \texttt{passes1and\-2\_h26x} for the audio; 
+with ffmpeg/webm, choose \texttt{pass1of2\_vp9}.  When that is finished, you will have to use the render menu again and this time for video, choose \texttt{pass2of2\_h26x} or \texttt{pass2of2\_vp9}.  The logfile is hard coded in the options file so will write over any currently existing logfile if you do not change it before you start the render.
 
-\paragraph{Requirements for some other libraries} (used instead of \texttt{flags +pass1} \& \texttt{passlogfile}):
+\paragraph{Requirements for some other libraries} ~\\ (used instead of \texttt{flags +pass1} \& \texttt{passlogfile}):
 
 \begin{description}
     \item[x265:] add this line:
     \begin{lstlisting}[language=bash]
-     x265-params=pass=1:stats=/tmp/{temporary log file name}.log
+x265-params=pass=1:stats=/tmp/{temporary log file name}.log
     \end{lstlisting}      
-    at the time this document was written, you should see in the output:  \texttt{stats-read=2}
+    at the time this document was written, you should see in the output: \\  \texttt{stats-read=2}
     
-    \item[libvpx-vp9, xvid, and huffyuv:]
+    \item[libvpx-vp9, xvid, and huffyuv:]~
+
     \begin{lstlisting}[language=bash]
     cin_stats_filename /tmp/{temporary log file name}.log
     flags +pass1 (or flags +pass2 for the second pass)
-    \end{lstlisting} 
-    \noindent \textit{NOTE:} for vp9, the best Pixels is \texttt{gbrp}   
+    \end{lstlisting}    
 \end{description}
 
+\noindent \textit{NOTE:} for vp9, the best Pixels is \texttt{gbrp}
+
+\subsection{Use case: High Efficiency Video Coding (HEVC)}%
+\label{sub:use_case_hevc}
+
+An example of video profile based on CRF, a quality-controlled
+variable bitrate, instead of fixed quality scale (ABR).
+HEVC (H.265) was developed as a successor to AVC (H.264) to more
+efficiently compress the future large amounts of data from 2/4/8k
+videos.
+In comparison to AVC, an average saving of around 30 percent can be
+assumed for the same quality.
+Because HEVC is not bound to any size format, it is suitable for
+virtually any image size.
+
+The following example is HD and FullHD oriented and produces a
+picture quality similar to the Blu-ray with some limitations.
+As container Matroska (.mkv) is used, but also mp4 and others are
+possible.
+
+\vspace{2ex} \begin{lstlisting}[language=Bash]
+matroska libx265
+
+# CRF 16 creates a balanced compromise
+# between quality and file size. 
+crf=16
+
+# Preset changes encoding speed and generally
+# degrades the overall result. Medium (default)
+# always fits.
+preset=medium
+
+# Additional parameters that are passed on to the codec.
+# me=star improves the search for very fast
+# movements, but slows down the encoding.
+#x265-params=me=star
+
+# Keyint does FFmpeg automatically, otherwise
+# the setting must match the frame rate.
+#keyint\_min=25
+
+# Profile does FFmpeg automatically.
+#profile=high
+
+# Source sRBG and retention of color space.
+# 720/1080=bt709 if no profile set. Useful
+# for formats smaller than 720 if no lossy
+# conversion is desired.
+colorspace=bt709
+color_trc=bt709
+color_primaries=bt709
+
+# Output in 10 bit, prevents 8-bit step formation
+pixel_format=yuv420p
+\end{lstlisting}
+
+\noindent \textit{NOTE:}
+
+A CRF of 16 delivers satisfactory results in most cases. However, if
+the video material is really \emph{grainy}, a CRF~16 can lead to unwanted large files.  In this case, a trial export of perhaps one minute should be performed. The resulting bit rate can be used to correct the CRF to 17,\,18,\,19\ldots --- remember, a CRF of 0 means lossless, the higher the number the stronger the lossy compression. The approximate calculation of the final file size can be extrapolated from the sample export.
+
+The color space information must be used explicitly so that it can
+be included in the video. Cinelerra\,GG or FFmpeg does not write it
+by itself. Without this information the players (e.\,g.\ \href{https://mpv.io/}{mpv}) stick to the dimensions of the video and take the assumed color model from a table. With videos in the dimensions from 720 to 1080 this is bt709. For smaller dimensions, e.\,g.\ DVD, bt601 is assumed and for 4k and above it is bt2020. Normally this is not a problem, but if you want to export a FullHD without color loss to a smaller size like 576 for example, you have to inform the encoder as well as the decoder of the player. This also applies if the videos are to be loaded on video platforms, where they are then converted into videos of different sizes. It is a security measure to prevent false colors, such as the color profiles in digital photos and the copies made from them.
+
+The HEVC tuning has not been considered here, because it is is
+rarely used and requires background knowledge.
+
+Further links:
+\begin{itemize}
+    \item \href{http://x265.readthedocs.org/en/default/}{x265
+        Documentation}
+    \item \href{http://x265.readthedocs.org/en/latest/cli.html}{x265
+        Command Line Options}
+    \item \href{http://x265.readthedocs.org/en/latest/presets.html}{x265
+        Presets/Tuning}
+\end{itemize}
+
 \subsection{Piping Video to a Command Line}%
 \label{sub:piping_video_command_line}
 
@@ -635,7 +710,7 @@ You can pipe a video to any command line on the computer, such as ffmpeg.  This
 \begin{enumerate}
     \item on a terminal window create a named pipe file, for example:
     \begin{lstlisting}[language=bash]
-    mknod /tmp/piper.yuv p
+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}
@@ -644,7 +719,7 @@ You can pipe a video to any command line on the computer, such as ffmpeg.  This
     \item click for \texttt{OK} on the green checkmark.(the cinelerra 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}[language=bash]
-    /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
+/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}