Credit Andrea - Anamorphic document
authorGood Guy <good1.2guy@gmail.com>
Thu, 15 Feb 2024 23:57:05 +0000 (16:57 -0700)
committerGood Guy <good1.2guy@gmail.com>
Thu, 15 Feb 2024 23:57:05 +0000 (16:57 -0700)
Anamorphic.tex [new file with mode: 0644]
images/DAR.png [new file with mode: 0644]
parts/Anamorphic.tex [new file with mode: 0644]
parts/Anamorphic_title.tex [new file with mode: 0644]

diff --git a/Anamorphic.tex b/Anamorphic.tex
new file mode 100644 (file)
index 0000000..752b331
--- /dev/null
@@ -0,0 +1,41 @@
+\documentclass[
+a4paper,
+12pt,
+oneside,
+svgnames,
+%draft
+]{memoir} % paper size, font size and other options for document
+\input{common/packages.tex} % common packages
+\input{common/settings.tex}
+
+%\includeonly{common/title,parts/Installation}% ,parts/Introduction,parts/Windows
+
+\begin{document}
+
+\input{parts/Anamorphic_title.tex}        % create and use custom title page
+
+\thispagestyle{empty}           % no page numbers
+% \newpage
+\setlength{\parskip}{1\baselineskip}
+\frontmatter
+
+\tableofcontents
+
+\pagestyle{ruled}
+
+\mainmatter%
+
+\include{parts/Anamorphic}
+
+\newpage
+
+\pagestyle{ruled}
+
+% \listoftodos
+
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:
diff --git a/images/DAR.png b/images/DAR.png
new file mode 100644 (file)
index 0000000..fb2ba7e
Binary files /dev/null and b/images/DAR.png differ
diff --git a/parts/Anamorphic.tex b/parts/Anamorphic.tex
new file mode 100644 (file)
index 0000000..2369b0c
--- /dev/null
@@ -0,0 +1,132 @@
+\chapter{Overview}%\r
+\label{cha:anamorphic}\r
+\r
+\section{\textbf{HDV, anamorphic and non-square pixels}}%\r
+\label{sec:hdv}\r
+\r
+A guide on how to handle anamorphic formats in \CGG{}.\r
+For a detailed discussion see: {\small \url{https://lurkertech.com/lg/pixelaspect/}}\r
+\r
+\subsection{\textbf{Theory}}%\r
+\label{sub:theory}\r
+\r
+There are two aspect ratios: the \textit{Pixel Aspect Ratio} and the \textit{Frame Aspect Ratio}. See Figure~\ref{fig:DAR} (from {\small \url{https://stackoverflow.com/questions/18877243/why-ffmpeg-print-sar-instead-of-par}}):\r
+\r
+\begin{figure}[htpb]\r
+       \centering\r
+       \includegraphics[width=0.85\linewidth]{DAR.png}\r
+       \caption{DAR and SAR compared}\r
+       \label{fig:DAR}\r
+\end{figure}\r
+\r
+Unfortunately, there are two opposing schools of thought in describing various aspect ratios:\r
+\r
+\begin{enumerate}\r
+       \item PAR = Pixel (\textit{pixel}) aspect ratio and SAR = Storage (\textit{frame}) aspect ratio.\r
+       \item PAR = Picture (\textit{frame}) aspect ratio and SAR = Sample (\textit{pixel}) aspect ratio.\r
+\end{enumerate}\r
+\r
+Ffmpeg follows this second way, and in addition the total absence of PAR replaced by W/H of the input frame. \CGG{} uses ffmpeg to show the results in the Resources window, Media Folder, \texttt{Asset/RMB $\rightarrow$ Info $\rightarrow$ Detail}, which indicates S(ample)AR.\r
+\r
+For practical purposes the concepts are the same and only the definitions change. The important thing is to understand that the pixel aspect ratio, whether called PAR or SAR, is the conversion factor that, in the case of non-squared pixels, brings the aspect ratio of the input frame to that of the output frame. The basic formula for understanding the various aspect ratios is as follows:\r
+\r
+\qquad $DAR = SAR \times PAR(=W/H)$\r
+\r
+with:\r
+\r
+\textbf{DAR} = Display Aspect Ratio. It is the aspect ratio of the frame on the screen. In \CGG{} is the shape of canvas (or project or output). It is a \textit{frame} aspect ratio.\r
+\r
+\textbf{PAR} = \textbf{W/H} = Picture Aspect Ratio. It is the initial aspect ratio (input), for example of the source media file. It is also, the number of pixel (Width and Height) used to memorize the asset. It is a \textit{frame} aspect ratio. To avoid confusion with the other definition of PAR (that is: Pixel aspect ratio) we will use W/H ratio more.\r
+\r
+\textbf{SAR} = Sample Aspect Ratio. It is the ratio of the sides of the single pixel. It is a correction factor for the recordered frame format resolution, to get the desired output display resolution at a given DAR. It is a \textit{pixel} aspect ratio.\r
+\r
+Monitors and modern HD+ TVs have square pixels. Since most formats, sensors, digital video signals and displays have square pixels, then the reproduction will always be correct.\r
+Older NTSC and PAL TVs do not have pixels but scan frequencies that support both anamorphic and non-anamorphic signals. For an overview on older PAL/NTSC TVs, see wikipedia: {\small \url{https://en.wikipedia.org/wiki/Pixel_aspect_ratio#Pixel_aspect_ratios_of_common_video_formats}}.\r
+\r
+SAR being the ratio of single pixel sizes, is 1 (or 1:1) for square pixels while it is different from 1 for rectangular pixels. We have the following values for the formats DV and HDV (from: {\small \url{https://www.mail-archive.com/ffmpeg-user@ffmpeg.org/msg27522.html}}, with further variations):\r
+\r
+\begin{center}\r
+\renewcommand\arraystretch{1.3}\r
+\begin{tabular}{|c||c|c||c|c||c|}\r
+       \hline\r
+       \multirow{2}{*}{\textbf{DV; HDV}} & \textbf{Display} & \textbf{DAR} & \textbf{Picture} & \textbf{PAR} & \textbf{SAR =} \\\r
+        & \textbf{(Output)} & \textbf{(W/H)} & \textbf{(Input)} & \textbf{(W/H)} & \textbf{DAR $\times$ W/H} \\\r
+       \hline\r
+       16:9-2160 & 3840 x 2160 & 16:9 & 3840 x 2160 & 16:9 & 1:1 \\\r
+       4:3-2160 & 2880 x 2160 &  4:3  &  2880 x 2160 &  4:3  &   1:1 \\\r
+       16:9-1080 & 1920 x 1080 & 16:9  &  1920 x 1080 & 16:9 & 1:1 \\\r
+       16:9-1080 & 1920 X 1080 & 16:9  &  1440 x 1080 &  4:3  & 1:1 \\\r
+       16:9-720 &  1280 x 720 &  16:9 &  1280 x 720 & 16:9 &  1:1 \\\r
+       16:9-1080 &  1920 X 1080 & 16:9 & 1440 x 1080 &  4:3 & 4:3 \\\r
+       16:9-576 &  1024 x 576 &  16:9  & 720 x 576  &  5:4& 64:45 \\\r
+       4:3-576 &   768 x 576  &  4:3 & 720 x 576  &  5:4& 16:15 \\\r
+       16:9-480 &   853 x 480 &  16:9 & 720 x 480 &   3:2& 32:27 \\\r
+       4:3-480 &  640 x 480 &  4:3 & 720 x 480  &  3:2 &  8:9 \\\r
+\hline\r
+\end{tabular}\r
+\end{center}\r
+\r
+To summarize: in the digital domain, one can use the concept of SAR (\textit{pixel} aspect ratio) when dealing with anamorphic digital formats (for example, when transcoding to a format that has a different WxH). Similarly, in the context of \textit{Standard-definition television} or with \textit{DV}, \textit{HDV} and a few other formats, SAR uses the formula DAR = SAR x (W/H), where SAR is the conversion factor between Input and the Output aspect ratio.\r
+\r
+\subsection{\textbf{How \CGG{} works}}%\r
+\label{sub:how_cgg_works}\r
+\r
+What has been said so far is to clarify the theoretical framework; if users want to go deeper into the subject, they will certainly be dealing with these formulas and definitions. However, \CGG{} does not require knowledge of the formula or the definitions of PAR and SAR. The \texttt{Format} window in the \texttt{Settings} pulldown, is used to set the Width/Height and DAR; PAR and SAR are used in a hidden way.\r
+\r
+So:\r
+\r
+\begin{itemize}\r
+       \item SAR\textit{source} is shown in \texttt{Asset/RMB $\rightarrow$ Info $\rightarrow$ Detail}; The  SAR\textit{project} is not shown in the \texttt{Settings $\rightarrow$ Format} window and cannot be set directly. It can be calculated from: SAR\textit{project}=DAR/(W/H).\r
+       \item DAR is shown in \texttt{Display Aspect Ratio}. It determines the shape of the frame. It is the factor that adapts the WxH\textit{source} to the WxH\textit{project}. Its value allows you to vary the frame aspect ratio by involving the shape of the pixels as well. \texttt{Auto} changes the DAR to always have square pixels. If the asset has rectangular pixels the Auto setting will result in a distorted (vertically stretched) frame.\r
+       \item W/H is calculated from the \texttt{Width} and \texttt{Height} values of the canvas. \texttt{W/H Ratio} can also be used to automate calculations. We have:\r
+       \r
+       WxH\textit{source} = WxH\textit{project} $\rightarrowtail$ Correct display.\r
+       \r
+       WxH\textit{source} < WxH\textit{project} $\rightarrowtail$ pad (letterbox, pillarbox).\r
+       \r
+       WxH\textit{source} > WxH\textit{project} $\rightarrowtail$ crop.\r
+       \r
+       To avoid cropping/padding we can use a scaling step via \texttt{Asset/RMB $\rightarrow$ Info $\rightarrow$ Resize} or with the \texttt{Scale} plugin. The scaling process does not alter the image because it maintains the pixel form factor by simply varying the resolution.\r
+\end{itemize}\r
+\r
+From \texttt{Settings --> Format} window you set the format (Width, Height and DAR) or you apply a preset, at this point the sources will have to adapt to this format.\r
+\r
+To see some useful examples, see Raffaella Traniello: {\small \url{http://www.g-raffa.eu/Cinelerra/HOWTO/anamorphic.html}}\r
+\r
+\subsection{\textbf{Use Case}}%\r
+\label{sub:use_case}\r
+\r
+For a video tutorial, see \href{https://youtu.be/JyIkdX3q_Ho}{HDV, anamorphic and non-square pixels}.\r
+\r
+How to downconvert/scale between two standard 16:9 anamorphic video formats. From \textbf{HDV 1080i} (called \textit{16:9-1080}, PAR 4:3, in the table) to \textbf{DV 16:9}, preset\textit{ PAL 576i (16:9) -DV(D)} (called \textit{16:9-576} in the table).\r
+\r
+Source: HDV (mpegts); WxH=1440x1080; SAR=4:3; DAR=16:9. The format is anamorphic with rectangular pixels stretched horizontally. For the formula seen above we have:\r
+\r
+$DAR (16:9) = 1440/1080 \times SAR (4:3) = 1.3333 \times 1.3333 = 1.777$\r
+\r
+\paragraph{Step 1:} As we go from a project size of 1440x1080 to a size of 720x576, we have to choose whether we want to crop or downscale the source. In the first case we continue with \textit{step 2}; in the second case we must first downscale, for example, using the \texttt{Resize} command found in the \texttt{Resource} window; \texttt{RMB} on source \texttt{$\rightarrow$ Info $\rightarrow$ Resize}. This way we vary the initial W/H preparing it for the preset we will use in \textit{step 2}.\r
+\r
+\paragraph{Step 2:} We change the project from the initial one (of the source) to the preset \textit{PAL 576i (16:9) -DV(D)}.\r
+\r
+Now we have:\r
+\r
+720$\times$576; W Ratio=0.5000; H Ratio=0.5333; DAR 16:9\r
+\r
+from which:\r
+\r
+SAR = DAR / (720/576) = 1.7778 / 1.25 = 1.4222 = 64:45\r
+\r
+Note that the video is cropped if we did not downscale in \textit{step1}.\r
+\r
+\paragraph{Step3:} Render with \textit{dv\_pal.avi} or \textit{dv\_pal.qt} preset. Now we have:\r
+\r
+720$\times$576; SAR = 64:45 (=1.4222); DAR = 16:9\r
+\r
+The difference between the new SAR (1.4222) versus the initial SAR (1.3333) of the source can be explained by taking into account that when Height=576 pixels, the width needs to be displayed horizontal (unsqeezed) with W=576$\times$16/9=1024 pixels (square). But the width needs to be stored (compressed, squeezed) within SD-DV(D)'s format W=720 pixels; therefore:\r
+\r
+SAR=(576$\times$16/9)/720=64/45=1.4222 \\\r
+PAR = W/H = 720/576 = 1.25 \\\r
+DAR = 16:9 (unchanged) \\\r
+\r
+\paragraph{NOTE:} the \textit{dv\_pal-avi} render preset provides interlaced video, consistent with the chosen project preset (576i). However, the avi format used does not provide this information in \texttt{RMB $\rightarrow$ Info $\rightarrow$ Asset Interlacing} or even in ffprobe. If the \textit{dv\_pal.qt} render preset is used, it provides the correct information (\textit{Top Fields First}, the standard for SD PAL).\r
+\r
diff --git a/parts/Anamorphic_title.tex b/parts/Anamorphic_title.tex
new file mode 100644 (file)
index 0000000..2f439b1
--- /dev/null
@@ -0,0 +1,55 @@
+% ================================================================
+% Page 1 -- Title page definition
+%
+\thispagestyle{empty}
+%\providecommand{\HUGE}{\Huge}% if not using memoir
+\newlength{\drop}% for my convenience
+
+%% specify the Webomints family
+%\newcommand*{\wb}[1]{\fontsize{#1}{#2}\usefont{U}{webo}{xl}{n}}
+%% select a (FontSite) font by its font family ID
+\newcommand*{\FSfont}[1]{\fontencoding{T1}\fontfamily{#1}\selectfont}
+%% if you don’t have the FontSite fonts either \renewcommand*{\FSfont}[1]{}
+%% or use your own choice of family.
+%% select a (TeX Font) font by its font family ID
+\newcommand*{\TXfont}[1]{\fontencoding{T1}\fontfamily{#1}\selectfont}
+%% Generic publisher’s logo
+\newcommand*{\plogo}{\fbox{$\mathcal{PL}$}}
+
+%% Some shades
+\definecolor{Dark}{gray}{0.2}
+\definecolor{MedDark}{gray}{0.4}
+\definecolor{Medium}{gray}{0.6}
+\definecolor{Light}{gray}{0.8}
+%%%% Additional font series macros
+
+\newcommand*{\titleLL}{\begingroup% Lost Languages
+\drop=0.085\textheight
+\fboxsep0.5\baselineskip\sffamily
+\vspace*{\drop}
+\begingroup
+\centering
+\HUGE\textbf{Personal Video Archiving - Anamorphic, Sar, Dar, and Par}\par
+%
+\endgroup
+\vspace*{2\baselineskip}
+\vspace*{0.3\baselineskip}
+{\textcolor{Dark}{\large\textbf{%
+      Aspect Ratio and Anamorphic with Sar, Dar, and Par infromation and uses.}}}\par
+%
+\centering
+\vspace{8\baselineskip}
+{\textcolor{Dark}{\large\textbf{{%
+      Author - Andrea Paz}}}}\par
+%
+{\textcolor{Dark}{\large\today}}\par
+\endgroup}
+\titleLL % use cutom title
+\clearpage
+
+\bigskip%
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "../Anamorphic and Aspect Ratio"
+%%% End: