[Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-20 Thread Derek Fountain
I'm using a tuned version of the 3 pass lav2avi.sh script which basically 
does:

lav2wav ... &
lav2yuv ... | mencoder ... 

lav2yuv ... | mencoder ...vpass=1...

lav2yuv ... | mencoder ...vpass=2...

I wanted to put a denoise step in there. The options seem to be,

1) stick a denoise on each lav2yuv step and do the denoise 3 times
2) stick a denoise on the last lav2yuv step and hope it doesn't screw the 2 
video passes too much
3) make a separate (and enormous) yuv file
4) denoise and put the resultant yuv through yuv2lav to get back to a sensible 
file I can put into mencoder 3 times.

(4) seems the most reasonable idea. Is that right, or did I miss something 
more obvious?


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-20 Thread Steven M. Schultz

On Mon, 20 Sep 2004, Derek Fountain wrote:

> I'm using a tuned version of the 3 pass lav2avi.sh script which basically 
> does:

The MPlayer/mencoder developers have deprecated (and highly 
discourage the use of) the 3 pass method and recommend the use
of the 2 pass method.  The lav2avi.sh script hasn't been 
updated/rewritten.

> lav2wav ... &
> lav2yuv ... | mencoder ... 
> lav2yuv ... | mencoder ...vpass=1...
> lav2yuv ... | mencoder ...vpass=2...
> 
> I wanted to put a denoise step in there. The options seem to be,

> 1) stick a denoise on each lav2yuv step and do the denoise 3 times

That'd work but the first pass is primarily audio encoding and
frame counting so it's not necessary to put a denoising (or any other
video filtering) step in the first pass.

> 2) stick a denoise on the last lav2yuv step and hope it doesn't screw the 2 
> video passes too much

That also would work fine and would be a lot faster than denoising
3 times.

> 3) make a separate (and enormous) yuv file

That's what I've done at times when I'm going to be making multiple
encodings (varying the video bitrate, etc). 

> 4) denoise and put the resultant yuv through yuv2lav to get back to a sensible
> file I can put into mencoder 3 times.

> (4) seems the most reasonable idea. Is that right, or did I miss something 
> more obvious?

It sounds like (4) is a variation of (3) - creating a denoised yuv
file that gets put thru mencoder multiple times.


5) Skip the multi-pass method completely and just do it in one pass.

I've never found the improvement between the 1 and 2 pass methods
to be visibly impressive.  Just calculate a bitrate based on the
desired size and elapsed time and use that value for the 'vbitrate'.

6) Use the hqdn3d denoising filter in mencoder.  I don't think it's as 
   effective as yuvdenoise but it might well be "good enough" for your needs.

Good Luck!

Cheers,
Steven Schultz



---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-20 Thread Martin Collins
On Mon, 20 Sep 2004 16:12:31 +0800
Derek Fountain <[EMAIL PROTECTED]> wrote:

> I wanted to put a denoise step in there. The options seem to be,
> 
> 1) stick a denoise on each lav2yuv step and do the denoise 3 times

What Steven said about 3 pass.

> 2) stick a denoise on the last lav2yuv step and hope it doesn't
> screw the 2 video passes too much

It will negate the point of 2 video passes. Both passes must have the
same options or the statistics gathered on the first pass will be
meaningless.

> 3) make a separate (and enormous) yuv file

A denoised yuv file would be a valid option if you pipe it straight
into mencoder as is.

> 4) denoise and put the resultant yuv through yuv2lav to get back to
> a sensible file I can put into mencoder 3 times.
> 
> (4) seems the most reasonable idea. Is that right, or did I miss
> something more obvious?

Decode, denoise, reencode, decode, reencode. This is not a reasonable
idea!

Stick with two pass unless you're using a high bitrate and don't much
care how big your final file is.

yuvdenoise may or may not be more effective than hqdn3d but it is waaay
slower. I suggest you just add hqdn3d to pass 2 and 3 of the script,
after deinterlacing and before any crop or scale.

Martin


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-20 Thread Steven M. Schultz

On Mon, 20 Sep 2004, Martin Collins wrote:

> What Steven said about 3 pass.

I had hoped to say "forget it - it's twice the encoding time for 
relatively little benefit".   For causual viewing it's not worth
the extra time and for archival purposes I'll create a high rate
mpeg-2 stream for a DVD.

> Stick with two pass unless you're using a high bitrate and don't much
> care how big your final file is.

I know the mplayer/mencoder folks verge on being fanatical about
the 2 pass method but the times I've used it there was little to no
difference (except for the elapsed time - 2 pass takes 2x as long ;)).
The 3 pass method has fallen out of favor since it can lead to A/V
sync issues (I think that was the problem - have to check the mailing
list archives to be certain).

Oick a bitrate using 'calcbpp.pl' (in the MPlayer TOOLS/ 
directory) - or if the filesize doesn't matter then use a high
rate (but be careful - playing back high bitrate MPEG-4 takes a lot
of cpu power).

> yuvdenoise may or may not be more effective than hqdn3d but it is waaay
> slower. I suggest you just add hqdn3d to pass 2 and 3 of the script,

That's because hqdn3d isn't as effective.  It's better than nothing
though.   I have a feeling though that any filtering/encoding is going
to be waaay slow on a 500MHz system :)

> after deinterlacing and before any crop or scale.

It's a matter of taste.  Seeing the interlacing is less bothersome 
to me than the effects of deinterlacing.  Deinterlacing can be done 
at playback time (often with a choice of how it's done so you can 
select the method that looks the best).

But since it sounds like the goal is computer playback in small areas
(384x288 or so) this might be worth thinking about:

 For lower ("VCD") resolution I think it's better capturing at the 
1/2 size (384x288 for "PAL") to begin with.  This will be progressive 
(since it's only 1 field) and then you don't have to deal with 
deinterlacing at all.  That would be less data captured, less to 
denoise, and no scaling - quite a speedup factor when all of those 
steps are taken into account.

Cheers,
Steven Schultz



---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-20 Thread Martin Collins
On Mon, 20 Sep 2004 13:35:46 -0700 (PDT)
"Steven M. Schultz" <[EMAIL PROTECTED]> wrote:

>   I know the mplayer/mencoder folks verge on being fanatical

Period :-)

>   about the 2 pass method but the times I've used it there was
>   little to no difference (except for the elapsed time - 2 pass
>   takes 2x as long ;)). The 3 pass method has fallen out of
>   favor since it can lead to A/V sync issues (I think that was
>   the problem - have to check the mailing list archives to be
>   certain).

Yup, sync.
The value of two pass is in maximizing quality in a limited size /
bitrate. If you are at liberty to increase bitrate then one pass will
be fine. If size is not an issue use a single pass with vqscale instead
of vbitrate.
 
> > after deinterlacing and before any crop or scale.
> 
>   It's a matter of taste.  Seeing the interlacing is less
>   bothersome to me than the effects of deinterlacing. 
>   Deinterlacing can be done at playback time (often with a
>   choice of how it's done so you can select the method that
>   looks the best).

Once you've scaled I imagine deinterlacing will not work. I could be
wrong though. For me interlacing looks horrible on a monitor.
Deinterlacing with pp=lb the only negative effect I've noticed is
slight softening. Anyway, if you deinterlace do it first was my point.
 
So Derek, pick a short bit of video and experiment. There is no One
True Way to treat video, try the various options, keep notes, read
this list and mplayer-users and build your own scripts that do it your
way.

Martin


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-21 Thread Derek Fountain
>  But since it sounds like the goal is computer playback in small areas
>  (384x288 or so) this might be worth thinking about:
>
>   For lower ("VCD") resolution I think it's better capturing at the
>  1/2 size (384x288 for "PAL") to begin with.  This will be progressive
>  (since it's only 1 field) and then you don't have to deal with
>  deinterlacing at all.  That would be less data captured, less to
>  denoise, and no scaling - quite a speedup factor when all of those
>  steps are taken into account.

That's pretty much exactly what I'm doing now. I get there in the end... :o) 
I've also discovered that denoising make no difference either to the quality 
of the final video or to the size of the file. Since I'm capturing video 
which originates from a digital TV receiver the quality is pretty good in the 
first place.

The video is actually football (soccer to some) so it's constant fast motion. 
Anything lower than VCD resolution means you can't really see the player 
numbers or faces, so I was trying to get the best picture possible from low 
bit rate. 500kbs is still coming out at 300MB per hour. I was trying to get 
closer to 200MB per hour but trial and error is proving a rather slow 
process!

While I'm asking, here's another quick question: can I do anything with the 
sound to lower the file size? It's just crowd noise and commentary so I can 
drop the quality right down if that's possible. I was just trying to work out 
what lav2yuv actually does with the sound. My command:

 lav2yuv ... | mencoder -oac copy ...

appears to be giving me MP3 sound, which implies lav2yuv puts out an MP3 sound 
track. Is that right, and can I tune it?


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-21 Thread Martin Collins
On Tue, 21 Sep 2004 17:25:00 +0800
Derek Fountain <[EMAIL PROTECTED]> wrote:

> While I'm asking, here's another quick question: can I do anything
> with the sound to lower the file size? It's just crowd noise and
> commentary so I can drop the quality right down if that's possible.
> I was just trying to work out what lav2yuv actually does with the
> sound. My command:
> 
>  lav2yuv ... | mencoder -oac copy ...
> 
> appears to be giving me MP3 sound, which implies lav2yuv puts out an
> MP3 sound track. Is that right, and can I tune it?

lav2yuv puts out no sound. lav2wav outputs pcm which is encoded to mp3
and stashed in frameno.avi in the 1st phase of lav2avi.sh. You could
add options to this phase to reduce the mp3 bitrate.

The best way to reduce the size of the sound is to encode to vorbis
instead of mp3 but this means you can't use avi you must use mkv or
ogm instead. This in turn means that to play on Windows you would need
to install special dshow filters and codecs.

I regularly record talk radio to ogg vorbis. Using -q -1 and resampling
to 22050 samples/s takes up ~14MB per hour. This would allow you a video
bitrate of ~430kb/s for an hour of video in 200MB. That's going to look
pretty bad but may be acceptable to you.

Get oggtools and mkvtools. Replace the 1st phase of the script with just
encoding the sound to ogg. After the 3rd phase mux the ogg with the avi
using mkvmerge to create an mkv file.

The script has no options to improve the video quality. You should at
least use mbd=2. I would also recommend
mv0:cbp:trell:keyint=125:naq:v4mv:vratetol=32000
but all this will increase encoding time a lot.

Martin


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-21 Thread Derek Fountain
> > I'm using a tuned version of the 3 pass lav2avi.sh script which basically
> > does:
>
>  The MPlayer/mencoder developers have deprecated (and highly
>  discourage the use of) the 3 pass method and recommend the use
>  of the 2 pass method.  The lav2avi.sh script hasn't been
>  updated/rewritten.

The MPlayer docs describe the 2 pass method like this:

mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o 
movie.avi
mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o 
movie.avi

or like this:

mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac mp3lame 
-lameopts vbr=3 -o movie.avi
mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac mp3lame 
-lameopts vbr=3 -o movie.avi

but, er, that doesn't appear to make sense when the input is coming from 
lav2yuv because there's no sound. So what is the two pass method now 
recommended? 1 audio pass and 1 video pass, or 2 video passes and some voodoo 
with the sound I don't know about?

Sorry to repeatedly ask noobie questions, but google isn't strangely unhelpful 
on this topic. Probably because there are so many tools and methods of doing 
things. :o}


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-21 Thread Steven M. Schultz

On Wed, 22 Sep 2004, Derek Fountain wrote:

> The MPlayer docs describe the 2 pass method like this:
...

> but, er, that doesn't appear to make sense when the input is coming from 
> lav2yuv because there's no sound. So what is the two pass method now 
> recommended? 1 audio pass and 1 video pass, or 2 video passes and some voodoo 
> with the sound I don't know about?

In the MPlayer documentation hierarchy you'll find a file in
DOCS/tech called encoding-tips.txt

In that I see that the "-audiofile" option is valid with 'mencoder'

I think that means you can use an external file to supply the audio
thusly:

mencoder -audiofile out.mp3 -oac copy ...

just prepare the .mp3 or whatever ahead of time and use that.

As an experiment you might try doing a one pass encoding to compare
against the results of a 2 pass.  It might be possible you don't
see much, if any, difference and can thus save a lot of time.

Cheers,
Steven Schultz



---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users


Re: [Mjpeg-users] Where to denoise in 3 pass encoding

2004-09-21 Thread Derek Fountain
>  mencoder -audiofile out.mp3 -oac copy ...
>
>  just prepare the .mp3 or whatever ahead of time and use that.

OK. That appears to mean the lav2wav-to-mp3 stage is still required, which is 
what I thought. I still have it in my script.

>  As an experiment you might try doing a one pass encoding to compare
>  against the results of a 2 pass.  It might be possible you don't
>  see much, if any, difference and can thus save a lot of time.

Yes, I've been through that test and your implication is correct - that second 
video pass achieves no visible change (to the video or filesize) at the low 
bit rate setting I'm using. I also found a lot of tips in the mplayer docs 
and archives which detail various tweaks which they claim give better quality 
output. I've tried them all and they all just add to the encoding time! I 
guess at higher bit rates and file sizes they will add something under some 
circumstances, but I'm back to where I started 3 days ago: capture with -d2, 
then use mencoder to pass the audio, then again to do one pass of the video. 
I guess sometimes life just isn't as complicated as we think it should 
be... :o)


---
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
___
Mjpeg-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mjpeg-users