Re: [Cin] SAR, DAR, PAR - oh, my!

2024-01-08 Thread Andrew Randrianasulu via Cin
пн, 8 янв. 2024 г., 13:42 Terje J. Hanssen :

>
>
> Den 08.01.2024 01:39, skrev Andrew Randrianasulu:
>
>
>
> пн, 8 янв. 2024 г., 01:52 Terje J. Hanssen :
>
>>
>>
>> Den 07.01.2024 23:35, skrev Andrew Randrianasulu:
>>
>>
>>
>> пн, 8 янв. 2024 г., 01:31 Andrea paz :
>>
>>> I don't quite understand how ffmpeg considers the various aspect
>>> ratios. However from the site lurkertech you pointed to (and from
>>> which I had taken some definitions put in the manual) PAR and SAR are
>>> not the same thing: PAR is about pixel shape and size; SAR is about
>>> frame shape and size.
>>>
>>> To change the manual I would like to be sure that ffmpeg really
>>> considers PAR=SAR.
>>>
>>
>> lets wait until ffmpeg-users reply to just send email :)
>>
>>>
>> The wikipedia article section "Confusion with display aspect ratio"
>> points out:
>>
>> https://en.wikipedia.org/wiki/Pixel_aspect_ratio#Confusion_with_display_aspect_ratio
>> Pixel aspect ratio is often confused with different types of image aspect
>> ratios; the ratio of the image width and height. Due to non-squareness of
>> pixels in Standard-definition TV, there are two types of such aspect
>> ratios: *storage aspect ratio* (*SAR*) and *display aspect ratio
>> * (abbreviated *DAR*,
>> also known as *image aspect ratio
>> * and *picture aspect
>> ratio *). Also, *pixel
>> aspect ratio* (*PAR*) is also known as *sample aspect ratio*
>> (abbreviated *SAR*) in some industrial standards (such as H.264
>> [2]
>> ) and
>> output of programs (such as *ffmpeg
>> *[3]
>> ). Note
>> the reuse of the abbreviations *PAR* and *SAR*. This article uses only
>> the terms pixel aspect ratio, display aspect ratio and storage aspect ratio
>> to avoid ambiguity.
>>
>> And in Note 3
>> "ffprobe shows PAR as SAR" .
>> ffmpeg.org. Retrieved 2022-06-10.
>> https://trac.ffmpeg.org/ticket/1776
>>
>
> well, both cingg and ffmpeg can interface with digitizing boards, but
> after another pass at reading
>
> https://lurkertech.com/lg/video-systems/#sqnonsq
>
> I hopefully hope that only DEVICE DRIVERS for analog input cards must deal
> with picture aspect ratio, as they deal with sampling of analog video.
>
> One can also hope that modern smartphone cameras also follow square pixels
> convention, because they typically do not send video over SDI but hand it
> into system-on-chip shared memory where encoder/display blocks deal with it
> directly.
>
> Hm, yet another definition; "Picture Aspect Ratio" used.
>
>
> However, the CinGG manual seemingly uses this Pixel-Display-Storage Aspect
> Ratio definitions:
>
> https://cinelerra-gg.org/download/CinelerraGG_Manual/Temporary_Track_Output_Size.html#2525
>
> In Settings → Format there is the additional possibility to vary the
> shape of the pixels from 1:1 (square) to handle anamorphic formats. In such
> cases we use:
>
>   *PAR* = DAR/SAR
> Is it correct that Canvas size "W Ratio" and "H Ratio" define PAR, while
> "Aspect Ratio" defines DAR in the Settings > Format widget?
>
> But there is something confusing I don't understand (possibly wrong) with
> the Presets values as far as I can see:
>
>- Preset 1080i/25 set: Canvas size Width=1920,
>Height=1080, W Ratio=1., H Ratio=1. and Aspect ratio=16.:9.
>- Preset HDV 1080i/25 set:Canvas size Width=1440, Height=1080, W
>Ratio=1., H Ratio=1. and Aspect ratio=16.:9.
>
> The first is obviously  FHD w/DAR=16:9 out of the frame size 1920x1080. If
> so, shouldn't PAR be 1:1, that is W Ratio=1.000 and H Ratio=1.000?
> The second HDV w/DAR=16:9 (anamorphic squeezed), should seemingly instead
> have PAR 4:3, that is W Ratio=1., H Ratio=1.?
>


well, this is *very possible* that I mixed them all wrong way!


It really advisable to try and get at least main source code downloaded to
you linux machine,Terje.

Even if build attempt fails out we *eventually* will come to something
working, so it will be easier for you to see how changes affect
display/editing of real media.

>
>
> Else the PAL SD-DV(D) is seemingly ok
>
>- Preset PAL 576i -DV(D) set: Canvas size Width= 720, Height=576, W
>Ratio=0.5000, H Ratio=0.5333 and Aspect ratio=4.:3.
>
>
>
>
>
>
>
>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] SAR, DAR, PAR - oh, my!

2024-01-08 Thread Terje J. Hanssen via Cin



Den 08.01.2024 01:39, skrev Andrew Randrianasulu:



пн, 8 янв. 2024 г., 01:52 Terje J. Hanssen :



Den 07.01.2024 23:35, skrev Andrew Randrianasulu:



пн, 8 янв. 2024 г., 01:31 Andrea paz :

I don't quite understand how ffmpeg considers the various aspect
ratios. However from the site lurkertech you pointed to (and from
which I had taken some definitions put in the manual) PAR and
SAR are
not the same thing: PAR is about pixel shape and size; SAR is
about
frame shape and size.

To change the manual I would like to be sure that ffmpeg really
considers PAR=SAR.


lets wait until ffmpeg-users reply to just send email :)



The wikipedia article section "Confusion with display aspect
ratio" points out:

https://en.wikipedia.org/wiki/Pixel_aspect_ratio#Confusion_with_display_aspect_ratio
Pixel aspect ratio is often confused with different types of image
aspect ratios; the ratio of the image width and height. Due to
non-squareness of pixels in Standard-definition TV, there are two
types of such aspect ratios: /storage aspect ratio/ (/SAR/) and
/display aspect ratio
/ (abbreviated
/DAR/, also known as /image aspect ratio
/ and /picture
aspect ratio
/). Also,
/pixel aspect ratio/ (/PAR/) is also known as /sample aspect
ratio/ (abbreviated /SAR/) in some industrial standards (such as
H.264 ^[2]
 )
and output of programs (such as /ffmpeg
/^[3]
 ).
Note the reuse of the abbreviations /PAR/ and /SAR/. This article
uses only the terms pixel aspect ratio, display aspect ratio and
storage aspect ratio to avoid ambiguity.

And in Note 3
"ffprobe shows PAR as SAR" .
ffmpeg.org . Retrieved 2022-06-10.
https://trac.ffmpeg.org/ticket/1776


well, both cingg and ffmpeg can interface with digitizing boards, but 
after another pass at reading


https://lurkertech.com/lg/video-systems/#sqnonsq

I hopefully hope that only DEVICE DRIVERS for analog input cards must 
deal with picture aspect ratio, as they deal with sampling of analog 
video.


One can also hope that modern smartphone cameras also follow square 
pixels convention, because they typically do not send video over SDI 
but hand it into system-on-chip shared memory where encoder/display 
blocks deal with it directly.



Hm, yet another definition; "Picture Aspect Ratio" used.


However, the CinGG manual seemingly uses this Pixel-Display-Storage 
Aspect Ratio definitions:

https://cinelerra-gg.org/download/CinelerraGG_Manual/Temporary_Track_Output_Size.html#2525

In Settings → Format there is the additional possibility to vary the 
shape of the pixels from 1:1 (square) to handle anamorphic formats. In 
such cases we use:


/PAR/ = DAR/SAR

Is it correct that Canvas size "W Ratio" and "H Ratio" define PAR, while 
"Aspect Ratio" defines DAR in the Settings > Format widget?


But there is something confusing I don't understand (possibly wrong) 
with the Presets values as far as I can see:


 * Preset 1080i/25 set: Canvas size Width=1920,
   Height=1080, W Ratio=1., H Ratio=1. and Aspect
   ratio=16.:9.
 * Preset HDV 1080i/25 set:    Canvas size Width=1440, Height=1080, W
   Ratio=1., H Ratio=1. and Aspect ratio=16.:9.

The first is obviously  FHD w/DAR=16:9 out of the frame size 1920x1080. 
If so, shouldn't PAR be 1:1, that is W Ratio=1.000 and H Ratio=1.000?
The second HDV w/DAR=16:9 (anamorphic squeezed), should seemingly 
instead have PAR 4:3, that is W Ratio=1., H Ratio=1.?


Else the PAL SD-DV(D) is seemingly ok

 * Preset PAL 576i -DV(D) set: Canvas size Width= 720, Height=576, W
   Ratio=0.5000, H Ratio=0.5333 and Aspect ratio=4.:3.





-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] SAR, DAR, PAR - oh, my!

2024-01-07 Thread Andrew Randrianasulu via Cin
пн, 8 янв. 2024 г., 01:52 Terje J. Hanssen :

>
>
> Den 07.01.2024 23:35, skrev Andrew Randrianasulu:
>
>
>
> пн, 8 янв. 2024 г., 01:31 Andrea paz :
>
>> I don't quite understand how ffmpeg considers the various aspect
>> ratios. However from the site lurkertech you pointed to (and from
>> which I had taken some definitions put in the manual) PAR and SAR are
>> not the same thing: PAR is about pixel shape and size; SAR is about
>> frame shape and size.
>>
>> To change the manual I would like to be sure that ffmpeg really
>> considers PAR=SAR.
>>
>
> lets wait until ffmpeg-users reply to just send email :)
>
>>
> The wikipedia article section "Confusion with display aspect ratio" points
> out:
>
> https://en.wikipedia.org/wiki/Pixel_aspect_ratio#Confusion_with_display_aspect_ratio
> Pixel aspect ratio is often confused with different types of image aspect
> ratios; the ratio of the image width and height. Due to non-squareness of
> pixels in Standard-definition TV, there are two types of such aspect
> ratios: *storage aspect ratio* (*SAR*) and *display aspect ratio
> * (abbreviated *DAR*,
> also known as *image aspect ratio
> * and *picture aspect
> ratio *). Also, *pixel
> aspect ratio* (*PAR*) is also known as *sample aspect ratio* (abbreviated
> *SAR*) in some industrial standards (such as H.264
> [2]
> ) and
> output of programs (such as *ffmpeg
> *[3]
> ). Note the
> reuse of the abbreviations *PAR* and *SAR*. This article uses only the
> terms pixel aspect ratio, display aspect ratio and storage aspect ratio to
> avoid ambiguity.
>
> And in Note 3
> "ffprobe shows PAR as SAR" .
> ffmpeg.org. Retrieved 2022-06-10.
> https://trac.ffmpeg.org/ticket/1776
>

well, both cingg and ffmpeg can interface with digitizing boards, but after
another pass at reading

https://lurkertech.com/lg/video-systems/#sqnonsq

I hopefully hope that only DEVICE DRIVERS for analog input cards must deal
with picture aspect ratio, as they deal with sampling of analog video.

One can also hope that modern smartphone cameras also follow square pixels
convention, because they typically do not send video over SDI but hand it
into system-on-chip shared memory where encoder/display blocks deal with it
directly.


>
>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] SAR, DAR, PAR - oh, my!

2024-01-07 Thread Terje J. Hanssen via Cin



Den 07.01.2024 23:35, skrev Andrew Randrianasulu:



пн, 8 янв. 2024 г., 01:31 Andrea paz :

I don't quite understand how ffmpeg considers the various aspect
ratios. However from the site lurkertech you pointed to (and from
which I had taken some definitions put in the manual) PAR and SAR are
not the same thing: PAR is about pixel shape and size; SAR is about
frame shape and size.

To change the manual I would like to be sure that ffmpeg really
considers PAR=SAR.


lets wait until ffmpeg-users reply to just send email :)



The wikipedia article section "Confusion with display aspect ratio" 
points out:

https://en.wikipedia.org/wiki/Pixel_aspect_ratio#Confusion_with_display_aspect_ratio
Pixel aspect ratio is often confused with different types of image 
aspect ratios; the ratio of the image width and height. Due to 
non-squareness of pixels in Standard-definition TV, there are two types 
of such aspect ratios: /storage aspect ratio/ (/SAR/) and /display 
aspect ratio / 
(abbreviated /DAR/, also known as /image aspect ratio 
/ and /picture aspect 
ratio /). Also, 
/pixel aspect ratio/ (/PAR/) is also known as /sample aspect ratio/ 
(abbreviated /SAR/) in some industrial standards (such as H.264 
^[2] 
 ) and 
output of programs (such as /ffmpeg 
/^[3] 
 ). Note 
the reuse of the abbreviations /PAR/ and /SAR/. This article uses only 
the terms pixel aspect ratio, display aspect ratio and storage aspect 
ratio to avoid ambiguity.


And in Note 3
"ffprobe shows PAR as SAR" . 
ffmpeg.org. Retrieved 2022-06-10.

https://trac.ffmpeg.org/ticket/1776
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] SAR, DAR, PAR - oh, my!

2024-01-07 Thread Andrew Randrianasulu via Cin
пн, 8 янв. 2024 г., 01:31 Andrea paz :

> I don't quite understand how ffmpeg considers the various aspect
> ratios. However from the site lurkertech you pointed to (and from
> which I had taken some definitions put in the manual) PAR and SAR are
> not the same thing: PAR is about pixel shape and size; SAR is about
> frame shape and size.
>
> To change the manual I would like to be sure that ffmpeg really
> considers PAR=SAR.
>

lets wait until ffmpeg-users reply to just send email :)

>
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


Re: [Cin] SAR, DAR, PAR - oh, my!

2024-01-07 Thread Andrea paz via Cin
I don't quite understand how ffmpeg considers the various aspect
ratios. However from the site lurkertech you pointed to (and from
which I had taken some definitions put in the manual) PAR and SAR are
not the same thing: PAR is about pixel shape and size; SAR is about
frame shape and size.

To change the manual I would like to be sure that ffmpeg really
considers PAR=SAR.
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin


[Cin] SAR, DAR, PAR - oh, my!

2024-01-07 Thread Andrew Randrianasulu via Cin
Apparently, ffmpeg uses SAR (sample aspect ratio) as fundamental metric.

Cingg's aspect_ratio variable in asset.h is DISPLAY aspect ratio, so we try
to work out DAR from sample_aspect_ratio provided by ffmpeg and (coded)
dimensions

https://stackoverflow.com/questions/69560311/confused-about-parpixel-aspect-ratio-in-video



SAR and PAR are the same. sample is the generic term for the elementary
"particles" of media. pixel is specific to video, whereas audio has sample.

sample aspect ratio is the term used in modern video codec standards.

The only equation to know is SAR * width / height = DAR.





we do not display sar/dar in our asset info, I guess we better to!


in ffmpeg.C


AVRational FFMPEG::to_sample_aspect_ratio(Asset *asset)

{

#if 1

double display_aspect = asset->width / (double)asset->height;

double sample_aspect = display_aspect / asset->aspect_ratio;

int width = 100, height = width * sample_aspect + 0.5;

float w, h;

MWindow::create_aspect_ratio(w, h, width, height);

return (AVRational){(int)w, (int)h};

--


and


--

vid->length = secs * vid->frame_rate;

vid->aspect_ratio =
(double)st->sample_aspect_ratio.num / st->sample_aspect_ratio.den;

vid->nudge = st->start_time;


-===--


May be this line needs correcting ? (on decoding)


-===--

float FFMPEG::ff_aspect_ratio(int stream)
{

//return ffvideo[stream]->aspect_ratio;

AVFormatContext *fmt_ctx = ffvideo[stream]->fmt_ctx;

AVStream *strm = ffvideo[stream]->st;
AVCodecParameters *par =
ffvideo[stream]->st->codecpar;

AVRational dar;

AVRational sar = av_guess_sample_aspect_ratio(fmt_ctx, strm, NULL);

if (sar.num && ffvideo[stream]->get_rotation_angle() == 0) {
   av_reduce(, ,

  par->width  * sar.num,

  par->height * sar.den,

  1024*1024);

  return av_q2d(dar);

  }

return ffvideo[stream]->aspect_ratio;

}


-==--


I copied it from ffmpeg.


there is plenty of more complex explanations, for example at


https://lurkertech.com/lg/pixelaspect/


But I think for now we better to concentrate on what ffmpeg gives and takes.
-- 
Cin mailing list
Cin@lists.cinelerra-gg.org
https://lists.cinelerra-gg.org/mailman/listinfo/cin