Andreas's last index entries; some minor fixes from Phyllis; rename index.png to...
[goodguy/cin-manual-latex.git] / parts / AuxilaryPrograms.tex
1 \chapter{Auxiliary Programs}%
2 \label{cha:auxiliary_programs}
3
4 \section{Using Ydiff to check results}
5 \label{sec:ydiff_check_results}
6 \index{Ydiff}
7
8 Delivered with Infinity \CGG{} and in the \CGG{} path, there is a file \texttt{ydiff.C} This program compares the output from 2 files to see the differences . Do: \texttt{cd cin\_path} and key in \texttt{make ydiff}.
9
10 % The following does not work like this.
11 % {                                      % uses braces to localize caption alignment changes.
12 % \begin{figure}[h]
13 %        \captionsetup{justification=raggedright,singlelinecheck=false}
14 %        \includegraphics[width=0.4\linewidth]{ydiff_same.png}
15 %        \caption{Exact match}
16 %        \vspace{-9cm}
17 %        \hspace{0.4\linewidth}
18 %        \captionsetup{justification=raggedleft,singlelinecheck=false}
19 %        \includegraphics[width=0.4\linewidth]{ydiff_change.png}
20 %        \caption{"giraffe" artifacts on 2 files spaced differently}
21 % \end{figure}
22 % }
23
24 % We pack two pictures of unequal height next to each other and
25 % align them flush at
26 % a) the first line of the caption.
27 % b) or tricks with strut, it's flush at the top.
28 \begin{figure}[h]
29   \begin{minipage}[t]{0.49\textwidth}
30     \strut\\[-1em]
31     \includegraphics[width=\linewidth]{ydiff_same.png}
32     \caption{Exact match}
33   \end{minipage}
34   \hfill
35   \begin{minipage}[t]{0.49\textwidth}
36     \strut\\[-1em]
37     \includegraphics[width=\linewidth]{ydiff_change.png}
38     \caption{"Giraffe" artifacts on 2 files spaced differently}
39   \end{minipage}
40 \end{figure}
41
42 You can now use this to check the quality differences of various
43 outputs. For example, in this same directory key in:
44 % The indentation of an environment matches the type area.
45 \begin{list}{}{}
46 \item \texttt{./ydiff /tmp/yourfile.mp4 /tmp/yourfile.mp4}
47 \end{list}
48 %\hspace{2em}\texttt{./ydiff /tmp/yourfile.mp4 /tmp/yourfile.mp4}
49
50 Since you are comparing a file to itself, you will see a clean looking white window in the left-hand corner and columns 2,3,4 will be all zeros. Run this same command with a 3rd spacing parameter of {}-1 as shown below, and you will see artifacts of comparing 2 files starting in a different position.
51 \begin{list}{}{}
52 \item \texttt{./ydiff /tmp/yourfile.mp4 /tmp/yourfile.mp4 -1}
53 \end{list}
54 % \hspace{2em}\texttt{./ydiff /tmp/yourfile.mp4 /tmp/yourfile.mp4 -1}
55
56 Now render yourfile using different quality levels and run ydiff to compare the 2 results. You will see only noise difference which accounts for the quality level. Columns 2,3,4 might no longer be exactly zero but will represent only noise differences. The ydiff output is debug data with lines that show frame size in bytes, sum of error, and sum of absolute value of error. The frames size is sort of useless, the sum of error shows frame gray point drift and the abs error is the total linear color error between the images. At the very end is the total gray point drift and total absolute error on the last line.
57
58
59 \section{Image Sequence Creation}
60 \label{sec:image_sequence_creation}
61 \index{image sequence}
62
63 Example script to create a jpeglist sequence file is next:
64 \begin{lstlisting}[numbers=none]
65 #!/bin/bash
66 out="$1"
67 dir=$(dirname "$out")
68 shift
69 geom=$(jpegtopnm "$1" | head -2 | tail -1)
70 w="$(echo $geom | cut -d " " -f1)"
71 h="$(echo $geom | cut -d " " -f2)"
72 exec > $out
73 echo "JPEGLIST"
74 echo "# First line is always JPEGLIST"
75 echo "# Frame rate:"
76 echo "29.970030"
77 echo "# Width:"
78 echo "$w"
79 echo "# Height:"
80 echo "$h"
81 echo "# List of image files follows"
82 while [ $# -gt 0 ]; do
83   if [ x$(dirname "$1") = x"$dir" ]; then
84         f=./`basename "$1"`;
85   else
86         f="$1";
87   fi
88   echo "$f"
89   shift
90 done
91 \end{lstlisting}
92 To use this script, you will have to install the package on your operating system that
93 includes \textit{jpegtopnm} which is ususally \textit{netpbm}.
94 Example usage of this script follows:
95
96 \qquad \texttt{jpeglist.sh outfile infiles*.jpg}
97
98 \section{Webm\,/\,Vp9 Usage and Example File\protect\footnote{credit Frederic Roenitz}}%
99 \label{sec:webm/vp9_usage_example}
100
101 \textsc{VP9} is a video codec licensed under the BSD license and is
102 considered open source,
103 % Sisvel Announces AV1 Patent Pool, March 10, 2020
104 % https://www.streamingmedia.com/Articles/ReadArticle.aspx?ArticleID=139636
105 %  Webm / VP9 is a media file format which is free to use under the
106 %  BSD license and is open-source; thus there are no licensing
107 %  issues to be concerned about.
108 the \textsc{Webm} container is based on \textsc{Matroska} for video
109 and \textsc{Opus} for audio. There are some common \textsc{VP9} rendering
110 options files that support creation of video for YouTube,
111 Dailymotion, and other online video services.
112
113 YouTube easy startup steps are documented in the Appendix (\ref{sec:youtube_with_cinelerra}). These same steps have been verified to work for creating Dailymotion videos -- however, the created files must be renamed before uploading to change the youtube extension to webm instead for Dailymotion.
114
115 Below is one of the \textsc{VP9} rendering options file with documentation for specifics:
116
117 \textbf{webm libvpx-vp9}
118
119 (20171114-2203)
120
121 from {\small \url{https://developers.google.com/media/vp9/settings/vod/}}
122
123 1280x720 (24, 25 or 30 frames per second)
124
125 Bitrate (bit rate)
126
127 \textsc{VP9} supports several different bitrate modes:
128
129 \textit{mode:}
130
131 \begin{tabular}{p{6cm} p{10cm}}
132         Constant Quantizer (Q) & Allows you to specify a fixed quantizer value; bitrate will vary \\
133         Constrained Quality (CQ) & Allows you to set a maximum quality level. Quality may vary within bitrate parameters\\
134         Variable Bitrate (VBR) & Balances quality and bitrate over time within constraints on bitrate\\
135         Constant Bitrate (CBR) & Attempts to keep the bitrate fairly constant while quality varies\\
136 \end{tabular}
137
138 CQ mode is recommended for file-based video (as opposed to streaming). The following FFMpeg command-line parameters are used for CQ mode:
139
140 \textit{FFMpeg}:
141
142 \begin{center}
143         \begin{tabular}{{p{4cm} p{10cm}}}
144         -b:v <arg> & Sets target bitrate (e.g. 500k)\\
145         -minrate <arg> & Sets minimum bitrate.\\
146         -maxrate <arg> & Sets maximum bitrate.\\
147         -crf <arg> & sets maximum quality level. Valid values are 0-63, lower numbers are higher quality.\\
148 \end{tabular}
149 \end{center}
150
151 \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).
152
153 \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.
154
155 \texttt{bitrate=1024k}\\
156 \texttt{minrate=512k}\\
157 \texttt{maxrate=1485k}\\
158 \texttt{crf=32}
159
160 \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\\
161 \texttt{tile-columns=2}
162
163 (modified from {\small \url{https://trac.ffmpeg.org/wiki/EncodingForStreamingSites}})
164
165 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}.\\
166 \texttt{g=240}
167
168 number of \textit{threads} to use during encoding\\
169 \texttt{threads=8}
170
171 \textit{Quality} may be set to good, best, or realtime\\
172 \texttt{quality=good}
173
174 \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\\
175 \texttt{speed=4}
176
177 \section{Details about .bcast5 Files}
178 \label{sec:details_.bcast5_files}
179 \index{.bcast5}
180
181 The following extensions of files in \CGG{}'s \texttt{.bcast5} directory are explained below.
182
183 % Labeling requires a parameter with the longest word of the labels.
184 \begin{labeling}{ladspa\_plugins{\dots}}
185         \item [.dat] represent saved \textit{data} for perpertual sessions and color palettes; maybe others
186         \item [.idx] original \textit{index} files that were created for loaded video to speed up seeking
187         \item [.mkr] ffmpeg specific \textit{marker} index file that is created for each video to aid seeks
188         \item [.rc] rc stands for \textit{run commands} so basically represents a script
189         \item [.toc] toc is \textit{table of contents} file for MPEG video files (a type of index)
190         \item [Cinelerra\_plugins] a list of the currently loaded plugins available in your \CGG{} session
191         \item [Cinelerra{}\_rc] the user's preferences and settings are saved in this file to be used on startup
192         \item [ladspa\_plugins{\dots}] list of currently loaded ladspa plugins for each version of \CGG{} being used
193         \item [layout\#...\_rc] user-defined window layout setup with the layout name as part of the file name
194         \item [.xml] used for various backups or for the current settings of plugins that you have used
195         \item [.png] thumbnails of files in Resources so they do not have to be created over and over
196 \end{labeling}
197
198 %%% Local Variables:
199 %%% mode: latex
200 %%% TeX-master: "../CinelerraGG_Manual"
201 %%% End: