Re: [Mjpeg-users] aspect ratio for converting stills into mpeg

2005-02-15 Thread Trent Piepho
On Tue, 15 Feb 2005, Steven M. Schultz wrote:
> On Tue, 15 Feb 2005, Trent Piepho wrote:
> 
> > There is no need to do anything special for 720x480 instead of 704x480, you
> > can use the same math.
> 
>   What about the difference in SAR between D1 and DV/DVD?  If it's not

D1, DVD, and DV all use a sampling rate of 13.5 MHz and have the same sample
aspect ratio.  I have no idea where 9:10 would come from, expect as some sort
of compromise value, like the MPEG1 list of SARs.

>   Pick up a book on FCP-HD or Adobe's "Premiere" (Photoshop even has
>   a NTSC DV preset that uses 9:10 and 720x534).

If you want 720x486 output, you would use 720x534 input.  From the
simple formula I posted before:

  Output Height = Input Height / Input SAR * Output SAR
  Output Height = 534 / (1/1) * (10/11) = 485.45

Think of the relation like this:

720x486 (10:11) <=> 720x534 (1:1)

Read as, "720 by 486 with a sample aspect ratio of 10 to 11 is equivalent to
720 by 534 with a sample aspect ratio of 1 to 1."

> > If you are going from a non-anamorphic DVD to a computer, the input SAR is
> 
>   He's going, as I recall from computer to DVD so it'd be from 1:1 to
>   non-square.

I suppose when I used "input" and "output" it confused things.  You are just
finding what resolution and SAR is equivalent to another resolution and SAR,
it doesn't matter which direction you are going.

>   What does seem to be confusing me (perhaps others too)  is that there 
>   is the SAR of 10:11 (ratio of 12.272727 and 13.5MHz) and the 
>   "NTSC DV" SAR of 9:10 which is used by some fairly highend video 
>   editors.

Sounds like they are just approximating 10/11 = 0.9090909090... to 0.9?

> > If you are going from a non-anamorphic DVD to a computer, the input SAR is
> > 10/11, and the output is 1/1.  The input height is 480 and the input width 
> > is
> 
>   Or 9/10 depending which book was last consulted :)

Can you find anything on the web that defines D1/DVD/DV as having a 9/10 SAR?

>   I'm not sure if fiddling with the numbers (if I put 720x528 in I can
>   get 720x480 out) instead of padding 704 to 720 is the right thing to 
> do.  

If you think about it, it's not different at all.  Start with 720x528 and
scale to 720x480 or start with 704x528, pad 8 pixels on each side to get
720x528, and then scale to 720x480.  The only difference is do you want
the 8 pixel border to be black or do you want to stick something there?

> > Want to scale vertically and get 720x480?  
> > 480 / (10/11) * (1/1) = 528, use 720x528
> 
> > Want to scale vertically and get 704x480?
> > 480 / (10/11) * (1/1) = 528, use 704x528
> 
>   Huh?  The same vertical size being used?   That's making the assumption
>   that the 720x480 image is a 4:3 image and I thought that was not

Where do you get the idea that a 720x480 image is 4:3?
> 
>   IF you have Wx480 being a 4:3 image then W can only be 704 for a SAR
>   of 10:11.   Only way I see of getting 720 is to fudge things with the
>   assumption that 720x480 represents a 4:3 image OR use a SAR of 9:10.

It much simpler than all that.  720x480 with a SAR of 10:11 isn't a 4:3 image. 
Just as 720x528 with a SAR of 1:1 isn't 4:3.  There is no need to go to 9:10
land.

>   the 4:3 image - that's true for 10:11 but what about 9:10 which is
>   a number I've seen used.  Wouldn't that make 720x534 -> 720x480
>   the right thing to do?  Either that or pad 704x480 to 720x480.

IF the SAR was 9:10 for DV, the math is simple:
480 / (9/10) * (1/1) = 533.33

But it's not 9:10, it's 10:11.



---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] aspect ratio for converting stills into mpeg

2005-02-15 Thread Steven M. Schultz

On Tue, 15 Feb 2005, Trent Piepho wrote:

> There is no need to do anything special for 720x480 instead of 704x480, you
> can use the same math.

What about the difference in SAR between D1 and DV/DVD?  If it's not
a fiction doesn't that need to be taken into account?  I have seen
(in a couple different books and programs) 9:10 and 720x486 vs 720x480
mentioned.

If that's so then to get 720x480 you need to create the graphics
at 720x534 and scale to 720x480.

Pick up a book on FCP-HD or Adobe's "Premiere" (Photoshop even has
a NTSC DV preset that uses 9:10 and 720x534).

> If you are going from a non-anamorphic DVD to a computer, the input SAR is

He's going, as I recall from computer to DVD so it'd be from 1:1 to
non-square.

What does seem to be confusing me (perhaps others too)  is that there 
is the SAR of 10:11 (ratio of 12.272727 and 13.5MHz) and the 
"NTSC DV" SAR of 9:10 which is used by some fairly highend video 
editors.

> If you are going from a non-anamorphic DVD to a computer, the input SAR is
> 10/11, and the output is 1/1.  The input height is 480 and the input width is

Or 9/10 depending which book was last consulted :)

> 704 or 720.

I'm not sure if fiddling with the numbers (if I put 720x528 in I can
get 720x480 out) instead of padding 704 to 720 is the right thing to 
do.  
If you look at a DVD created from digitizing a analog source you will
PLAINLY see a 704x480 frame centered inside the DVD 720x480 frame!

> Want to scale vertically and get 720x480?  
> 480 / (10/11) * (1/1) = 528, use 720x528

> Want to scale vertically and get 704x480?
> 480 / (10/11) * (1/1) = 528, use 704x528

Huh?  The same vertical size being used?   That's making the assumption
that the 720x480 image is a 4:3 image and I thought that was not
the case unless the SAR is 9:10!

IF you have Wx480 being a 4:3 image then W can only be 704 for a SAR
of 10:11.   Only way I see of getting 720 is to fudge things with the
assumption that 720x480 represents a 4:3 image OR use a SAR of 9:10.

Now IF you use 9:10 THEN you can get 720x480 from 720x534.

Matt's page does make mention of the 720x480 frame not representing
the 4:3 image - that's true for 10:11 but what about 9:10 which is
a number I've seen used.  Wouldn't that make 720x534 -> 720x480
the right thing to do?  Either that or pad 704x480 to 720x480.

NOTE:

If you look at a DVD created from digitizing a analog source you will
PLAINLY see a 704x480 frame centered inside the DVD 720x480 frame! 
It's done by padding, not scaling.

It's all so confusing! ;)

At any rate there is the need for scaling - I think we can agree
on that much at least. 

Cheers,
Steven Schultz



---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


[Mjpeg-users] Re: [Mjpeg-developer] y4mdenoise

2005-02-15 Thread Steven Boswell II
This was originally posted to mjpeg-developer, but
I figured most users would be interested in this.

>What are normal values for not-moved, moved, and
>new?

It depends entirely on your video.  There are no
normal values.  In general, one should watch the
numbers coming from y4mdenoise, and then look at
the original video, and based on that, tweak the
-z/-Z/-t/-T threshold parameters to match what you
would expect it to find on that particular video.

>(I get 4 lines for a given frame, presumably the
>two interlaced fields times the two domains (Y
>and CrCb))

Indeed, that is what you're seeing.

y4mdenoise's verbose output looks like this:

Frame A: BB.B% not-moved, CC.C%+DD.D% moved,
EE.E%+FF.F% new

A is the frame number, repeated for each field and
for each component of the video (i.e.  Y and
CbCr).  B is the percentage of pixels found in the
zero-motion pass (i.e.  the -z/-Z options).  C is
the percentage of pixels found in the
motion-searching pass for which the found region
had a zero motion vector.  D is the percentage of
pixels found in the motion-searching pass for
which the found region had a non-zero motion
vector.  (The relation between B and C should give
you additional info for how well you chose values
for -z/-Z/-t/-T.)  E is the percentage of pixels
found to be new information during the
motion-searching pass, using a heuristic that
tends to speed up results for scene-changes and
other times when there is very little repeated
information between two frames.  F is the
percentage of pixels found to be new information
at the end of the frame, when all analysis is
completed.

As soon as I can figure out how to explain all
that simply, I'll put it into the manpage :-)

Steven Boswell
ulatekh at yahoo dot com




__ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250


---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] aspect ratio for converting stills into mpeg

2005-02-15 Thread Trent Piepho
On Tue, 15 Feb 2005, Steven M. Schultz wrote:
>   Go thru the references and you'll find that NTSC full frame is 704x480
>   NOT 720x480.  If you really want 720x480 I'll get to that in a minute
>   or two...

Actually, you'll find the full frame is 710.85x486.  This number is difficult
for digital systems, so we round down to the nearest multiple of 16 and use
704x480 instead. 

>   IF you really want (or need) 720x480 you have a couple choices:
> 
>   1) Pad (as per the references above) the 704x480 scaled image with
> 
>   2) Pretend (as I have seen in several books) that the SAR is really
>  9:10 instead of 10:11.  I have seen the distinction drawn between

There is no need to do anything special for 720x480 instead of 704x480, you
can use the same math.

1) Horizontal only scaling
  Output Width = Input Width * Input SAR / Output SAR
  Output Height = Input Height

2) Vertical only scaling
  Output Width = Input Width
  Output Height = Input Height / Input SAR * Output SAR

If you are going from a non-anamorphic DVD to a computer, the input SAR is
10/11, and the output is 1/1.  The input height is 480 and the input width is
704 or 720.

Want to scale vertically and get 720x480?  
480 / (10/11) * (1/1) = 528, use 720x528

Want to scale vertically and get 704x480?
480 / (10/11) * (1/1) = 528, use 704x528

Want to scale horizontally and get 704x480?
704 * (10/11) / (1/1) = 640, use 640x480

Want to scale horizintally and get 720x480?
720 * (10/11) / (1/1) = 654.54, use 654x480



---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] aspect ratio for converting stills into mpeg

2005-02-15 Thread Steven M. Schultz
Hi -

On Tue, 15 Feb 2005, Eric Jorgensen wrote:

> I am currently creating some mpeg video from stills
> (png and jpeg) but am having some trouble with aspect

I would avoid JPEG as much as possible - the lossy nature of jpeg 
causes the mpeg2 encoding (which is of course lossy ;)) to produce
less than stellar results. PNG is MUCH preferable!

> ratios and the rectangular pixel problem.  I am
> working in NTSC and creating in 720x480.

> However, my understanding is that I should be creating it in
> 720x"something else" and letting the conversion
> utility (jpeg2yuv/png2yuv?) worry about sizing?

Close but not quite.  The conversion utilities do not do any 
resampling/resizing.  To perform the resampling step you need to
use a scaling program such as 'y4mscaler'.  It's not part of
mjpegtools but does require mjpegtools can be obtained from:

http://www.mir.com/DMG

If you're using the last release version of mjpegtools (1.6.2) you'll
want the 0.6.2 version of y4mscaler, if you're using the cvs version
of mjpegtools you'll want the 0.8.1 version of y4mscaler

Once you have that then pay particular attention to:

http://www.mir.com/DMG/aspect.html
 
Especially the first three sections: Definitions, Quick Facts and
DV Frame Sizes

and one of the references at the bottom of that page:

http://www.uwasa.fi/~f76998/video/conversion/

specifically paragraph 4.5.3.

> My command line right now looks like:
> 
> png2yuv -f 24 -I p -b 1  -j k%04d.png | \
> yuvfps -r 3:1001 | mpeg2enc -f 8 -o video.m2v

guaranteed to not do the Right Thing :(

> I am about to start a big project and want to make
> sure that I don't shoot myself in the foot later.

Ready to dive in (simple algegra and arithmetic only ;))?

In the past the advice was to create a 4/3 image using 1:1 (square)
pixels on the computer  at 720x540 and then scale to 720x480.  This
is not exactly correct because a 720x480 does NOT represent a
4/3 image - it's slightly wider (extra 8 pixels on each side).  It will
be "close" (~1% error in aspect) though.

Go thru the references and you'll find that NTSC full frame is 704x480
NOT 720x480.  If you really want 720x480 I'll get to that in a minute
or two...

Given that we want a 704x480 10:11 frame what size frame needs to be
generated using 1:1 pixels?

Two ways to do this.

1) You can generate the frames slightly narrower and scan UP to the
   desired width - if you have artwork with thin lines then this is
   the approach you want to take:

   a) 1:1 pixels
   b) Frame height (H) of 480
   c) Display Aspect Ratio (DAR) of 4:3
   d) The equation (from "Definitions") above 
   
   WDAR
   -  = ---
   HSAR

or

   W (4/3)
   -   = -
   480   (1/1)

I get W = 640.  So you should generate 640x480 PNG images and then
AFTER conversion (png2yuv) scale the data with something like:

... y4mscaler -I sar=1:1 -O sar=10:11 -O size=704x480 ...

The OTHER way is to create the images slightly taller and scale
vertically (this tends to cause flickering if you have thin lines
in the generated images).  You specify the desired width and solve
for the height.

   a) 1:1 pixels
   b) Frame width (W) of 704
   c) DAR of 4:3
   d) same equation as above:

 704(4/3)
 ---  = -
 W  (1/1)

I get W = 528, so you'd create the images at 704x528 and use the
same 'y4mscaler' command as above.

IF you really want (or need) 720x480 you have a couple choices:

1) Pad (as per the references above) the 704x480 scaled image with
   8 pixels on each side (don't worry - they will NOT be seen unless
   you have a monitor with 'underscan' capability).  y4mscaler will
   do this for you:  y4mscaler -I sar=1:1 -O preset=DVD 

2) Pretend (as I have seen in several books) that the SAR is really
   9:10 instead of 10:11.  I have seen the distinction drawn between
   D1 and NTSC DV/DVD SAR - basically it amounts to treating the DV/DVD
   frame as having a 9:10 SAR instead of 10:11 (as for broadcast TV).
   
   Then run thru the calculations above and you'll find that you need 
   to create the images at 720x534 and scale to 720x480.  The proof 
   is left as an exercise to the reader (HINT: (9/10)*534 = 480.6 :-))

Now that I've probably made a few goofs and managed to confuse things
even more it's time to let someone else help answer the quest

[Mjpeg-users] aspect ratio for converting stills into mpeg

2005-02-15 Thread Eric Jorgensen
Hello,

I am currently creating some mpeg video from stills
(png and jpeg) but am having some trouble with aspect
ratios and the rectangular pixel problem.  I am
working in NTSC and creating in 720x480.  However, my
understanding is that I should be creating it in
720x"something else" and letting the conversion
utility (jpeg2yuv/png2yuv?) worry about sizing?

My command line right now looks like:

png2yuv -f 24 -I p -b 1  -j k%04d.png | \
yuvfps -r 3:1001 | mpeg2enc -f 8 -o
video.m2v

I am about to start a big project and want to make
sure that I don't shoot myself in the foot later.

Thanks!

Eric



---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Opteron + mjpegtools

2005-02-15 Thread Steven M. Schultz

On Tue, 15 Feb 2005, Michael Hanke wrote:

> I'm using the recommendation -t 3 by Steven Boswell. The source material is 
> very (not to say extremly) noisy.

I think the recommendation for extremely noisy material is '-t 4'
(and I have used 5 for the worst material).  That parameter has a
large influence on the speed of y4mdenoise.

The manpage currently gives these guidlines:

-t 1 : Digital cable TV, most LaserDiscs, DV camcorder video
-t 2 : VHS camcorder video, commercially-produced videotapes
-t 3 : Analog cable TV, VHS videotape (at the 2-hour speed)
-t 4 : VHS videotape (at the 6-hour speed)

EP (6hr) mode VHS is about as low quality (especially if the
tapes are old - the ones I just finished processing had developed
a very noticeable colorcast) as one can get and still have a picture ;)

> architecture. In my case, this may also be a part of the problem because my 
> RAM is slow (PC133), too.

The bottleneck in this case is probably not the speed of the RAM but
instead the number of cpu cycles/second 

> Did anyone try to use alternative compilers?

Never got around to doing that.  It was simpler (or so it seemed)
to get a faster system ;)

Cheers,
Steven Schultz



---
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
___
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users