Andrea's additional cleanup and help
[goodguy/cin-manual-latex.git] / parts / AuxilaryPrograms.tex
1 \chapter{Auxiliary Programs}%
2 \label{cha:Auxiliary_Programs}
3 \section{Using Ydiff to check results}
4 \label{sec:Ydiff to check results}
5
6 Delivered with Infinity Cinelerra and in the Cinelerra path, there is a file \ {}``ydiff.C''. \ This program compares the output from 2 files to see the differences . \ Do: cd cin\_path and key in ``make ydiff''. 
7 \medskip
8
9 You can now use this to check the quality differences of various outputs. \ For example, in this same directory key in:
10 \hspace{2em}./ydiff /tmp/yourfile.mp4 /tmp/yourfile.mp4 
11 \medskip
12
13 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.
14 \medskip
15
16 \hspace{2em}./ydiff /tmp/yourfile.mp4 /tmp/yourfile.mp4 -1
17 \medskip
18
19 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.
20
21 {                                       % uses braces to localize caption alignment changes.
22 \begin{figure}
23         \captionsetup{justification=raggedright,singlelinecheck=false}
24         \includegraphics[width=0.4\linewidth]{ydiff_same.png}
25         \caption{Exact match}
26         \vspace{-9cm}
27         \hspace{0.4\linewidth}
28         \captionsetup{justification=raggedleft,singlelinecheck=false}
29         \includegraphics[width=0.4\linewidth]{ydiff_change.png}
30         \caption{{\textquotedbl}giraffe{\textquotedbl} artifacts on 2 files spaced differently}
31 \end{figure}
32 }
33 \clearpage
34
35 \section{Image Sequence Creation}
36 \label{sec:Image Sequence Creation}
37 Example script to create a jpeglist sequence file is next:
38 \medskip
39
40 \begin{lstlisting}[numbers=none]
41 #!/bin/bash
42 out="$1"
43 dir=`dirname "$out"`
44 shift
45 geom=`jpegtopnm "$1" | head -2 | tail -1`
46 w=`(set - $geom; echo $1)`
47 h=`(set - $geom; echo $2)`
48 exec > $out
49 echo "JPEGLIST"
50 echo "# First line is always JPEGLIST"
51 echo "# Frame rate:"
52 echo "29.970030"
53 echo "# Width:"
54 echo "$w"
55 echo "# Height:"
56 echo "$h"
57 echo "# List of image files follows"
58 while [ $# -gt 0 ]; do
59 if [ x`dirname "$1"` = x"$dir" ]; then f=./`basename "$1"`; else f="$1"; fi
60 echo "$f"
61 shift
62 done
63 \end{lstlisting}
64 \medskip
65
66 Example usage of this script follows:
67 \medskip
68
69 \ \ \ \ \ jpeglist.sh outfile infiles*.jpg
70 \medskip
71
72 \section{Webm / Vp9 Usage and Example File (credit Frederic Roenitz)}
73 \label{sec:Webm / Vp9 Usage and Example File}
74
75 There are some common VP9 rendering options files that support creation of video for YouTube, Dailymotion, and other online video services. \ Webm / VP9 \ is a media file format which is free to use under the BSD license and is open-source; thus there are no licensing issues to be concerned about. \ The Webm container is based on Matroska for video and Opus for audio.
76 \medskip
77
78 Youtube easy startup steps are documented in the previous section, A.2. \ 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.
79
80 {}- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
81 \medskip
82
83 Below is one of the VP9 rendering options file with documentation for specifics:
84 \medskip
85
86 webm libvpx-vp9
87 \medskip
88
89 \# 20171114-2203
90 \# from https://developers.google.com/media/vp9/settings/vod/
91 \# 1280x720 (24, 25 or 30 frames per second)
92 \#
93 \#
94 \# Bitrate (bit rate)
95 \#
96
97 \# VP9 supports several different bitrate modes:
98 \# mode 
99 \# Constant Quantizer (Q) \ \ Allows you to specify a fixed quantizer value; bitrate will vary
100 \# Constrained Quality (CQ) Allows you to set a maximum quality level. Quality may vary within bitrate parameters
101 \# Variable Bitrate (VBR) \ \ Balances quality and bitrate over time within constraints on bitrate
102 \# Constant Bitrate (CBR) \ \ Attempts to keep the bitrate fairly constant while quality varies
103
104 \#
105 \# CQ mode is recommended for file-based video (as opposed to live
106 \# streaming). The following FFMpeg command-line parameters are used
107 \# for CQ mode:
108 \#
109 \# FFMpeg 
110 \# -b:v {\textless}arg{\textgreater} \ \ \ \ \ Sets target bitrate (e.g. 500k)
111 \# -minrate {\textless}arg{\textgreater} Sets minimum bitrate.
112 \# -maxrate {\textless}arg{\textgreater} Sets maximum bitrate.
113 \# -crf {\textless}arg{\textgreater} Sets maximum quality level. Valid values are 0-63, lower numbers are higher quality.
114 \#
115 \# Note: Bitrate is specified in kbps, or kilobits per second. In video
116 \# compression a kilobit is generally assumed to be 1000 bits (not
117 \# 1024).
118 \#
119 \# Note: Other codecs in FFMpeg accept the -crf parameter but may
120 \# interpret the value differently. If you are using -crf with other
121 \# codecs you will likely use different values for VP9.
122
123 bitrate=1024k
124
125 minrate=512k
126
127 maxrate=1485k
128
129 crf=32
130 \medskip
131
132 \# Tiling splits the video into rectangular regions, which allows
133 \# multi-threading for encoding and decoding. The number of tiles is
134 \# always a power of two. 0=1 tile, 1=2, 2=4, 3=8, 4=16, 5=32.
135 tile-columns=2
136 \medskip
137
138 \# modified from https://trac.ffmpeg.org/wiki/EncodingForStreamingSites
139 \# To use a 2 second GOP (Group of Pictures), simply multiply your output
140 \# frame rate * 2. For example, if your input is -framerate 30, then use
141 \# -g 60.
142 g=240
143 \medskip
144
145 \# number of threads to use during encoding.
146 threads=8
147 \medskip
148
149 \# May be set to good, best, or realtime
150 quality=good
151 \medskip
152
153 \# This parameter has different meanings depending upon whether quality
154 \# is set to good or realtime. Speed settings 0-4 apply for VoD in good
155 \# and best, with 0 being the highest quality and 4 being the
156 \# lowest. Realtime valid values are 5-8; lower numbers mean higher
157 \# quality
158 \medskip
159
160 speed=4
161
162 \section{Details about .bcast5 Files}
163 \label{sec:Details about .bcast5 Files}
164 \medskip
165
166 The following extensions of files in Cinelerra's .bcast5 directory are explained below.
167
168 % Labeling requires a parameter with the longest word of the labels.
169 \begin{labeling}{ladspa\_plugins{\dots}}
170         \item [.dat] represent saved ``data'' for perpertual sessions and color palettes; maybe others
171         \item [.idx] original ``index'' files that were created for loaded video to speed up seeking
172         \item [.mkr] ffmpeg specific ``marker'' index file that is created for each video to aid seeks
173         \item [.rc] rc stands for ``run commands'' so basically represents a script
174         \item [.toc] toc is ``table of contents'' file for MPEG video files (a type of index)
175         \item [Cinelerra\_plugins] a list of the currently loaded plugins available in your Cinelerra session
176         \item [Cinelerra\_rc] the user's preferences and settings are saved in this file to be used on startup
177         \item [ladspa\_plugins{\dots}] ist of currently loaded ladspa plugins for each version of Cinelerra being used
178         \item [layout\#...\_rc] user-defined window layout setup with the layout name as part of the file name
179         \item [.xml] generally contain the current settings of plugins that you have used
180         \item [.png] thumbnails of files in Resources so they do not have to be created over and over
181 \end{labeling}
182