digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Video Encoding and Conversion (http://www.digitalfaq.com/archives/encode/)
-   -   Mimicking Motion Adaptiveness blur with Mencoder. (http://www.digitalfaq.com/archives/encode/10063-mimicking-motion-adaptiveness.html)

kwag 06-03-2004 08:43 PM

Mimicking Motion Adaptiveness blur with Mencoder.
 
@All,

This is still experimental, but here's the first version, which I've been playing for the last couple of hours, and it seems to be doing it's job :)
The functions used are shape adaptive blur

Here's your filter line, suitable for DVD encodings:

hqdn3d,sab=0.5:0.5:1,noise=3th

Note:
That's line goes AFTER your scaling and cropping commands, and BEFORE the final expand command.

When I finish optimizing the values, I'll post it on the optimal script section, just like the MA script posts.
In the mean time, have fun, and post your comments here :!:

Questions :?:
RTFM ;)
http://www.mplayerhq.hu/DOCS/man/en/manpage.html#GENERAL%20ENCODING%20OPTIONS%20(MENCO DER%20ONLY)


-kwag

maurus 06-04-2004 06:13 AM

We remove also the current two unsharp filters?

-Maurus

Dialhot 06-04-2004 06:27 AM

You do noise on Chroma also ? Won't this be noticiable ?
Eye is far more sensitive to noise in chroma than in luma.

kwag 06-04-2004 09:27 AM

@Maurus,

It's already been taken care of, by the shape adaptive blur and the smart blur.
It basically does the same as unsharp, but more efficiently, because shape adaptive blur is not static, but dynamic (adaptive).

@Phil,
Yes, but the noise level is so low that it can barely be seen by the eye. But the noise on the luma+chroma channels gave me a more flat Q curve, that when applying luma noise only.
Do a small sample, and check it with Bitrate Viewer. You should see a more flat qreen line.

-kwag

incredible 06-04-2004 12:21 PM

Quote:

Originally Posted by kwag
Do a small sample, and check it with Bitrate Viewer. You should see a more flat qreen line.

Does that mean also a higher Q on dark parts where these parts "before" ading the chroma-noise ended up in lower Q. As this would be risky on underwater parts.

If not that would mean the average of the Q is rised a minimal bit (just IMHO!).

So a flat Q curve is not the factor on which we should end up, more Q dynamic means less bitrate chaotic-dynamics as the encoder gots room to breath in its quantisation which "would" calm the Bitrate dynamic a little IMHO :)

kwag 06-04-2004 01:10 PM

@Inc,

Yes indeed, the bitrate is more balanced and distributed.

@All,

I've been doing some serious reading and parameter optimizing, and here's my latest stuff (not final yet!, and probably never will :lol:).

Following are two samples, one 704x480 at an average bitrate of 698Kbps, and another sample, also 704x480 but target average bitrate of ~6,000Kbps, which in reality came out to 1,437Kbps, because quality factor was fulfilled by the encoder, and no need to go higher in bitrate. Both are from the same "Red Planet" test clip, for consistency. Average bitrate measured with Vdub, because average given by Bitrate Viewer is always incorrect (gives lower values).

672Kbps (Real 698Kbps) average bitrate graph:

http://www.digitalfaq.com/archives/i.../2004/06/5.png
Sample here:
http://s2.yousendit.com/d.aspx?id=BF...A956C60D831C05



1,340Kbps (Real 1,437Kbps) average bitrate graph:

http://www.digitalfaq.com/archives/i.../2004/06/6.png
Sample here:
http://s2.yousendit.com/d.aspx?id=47...C50CDBB2CA6261

And here are the settings used for the samples:

Code:

hqdn3d=2:2:2,sab=1:1:8,smartblur=.5:.5:20,noise=3th:3th
And the common encoding parameters:
Code:

lavcopts=vcodec=mpeg2video:vstrict=-1:vmax_b_frames=2:vrc_maxrate=9800:aspect=1.3333:keyint=18:vrc_buf_size=1835:preme=2:precmp=2:autoaspect=1:vrc_eq=tex:scplx_mask=0.01:vqmin=2:mbqmin=1:lmin=0.01
Both samples were encoded using a set MAX bitrate limit of 9,800Kbps.
The small sample had set 700Kbps as vbitrate and the large sample had 6,000Kbps set as vbitrate.
For obvious reasons, filtering, the peak bitrates can't reach higher values, because the material is being blured on motion areas, in a similar way like the MA script. Actually the blur is on objects, so it's not on the complete picture, which is really what we want.
But the results I got with these values, could be the bitrate normalization that we are all looking for ;)

-kwag

Prodater64 06-04-2004 01:49 PM

@Kwag: Are these parameters for DVDs sources, AVIs sources or both?


--------------------------
Visit: Intermediate guide: MencodeMe/Win32 - Avisynth - MakeAvis by Prodater64.
Visit: KVCD - MencodeMe - Auxiliar Task - KVCD Docking Gate by Prodater64.
Visit: Mencoder scripting with AVSEdit and Guide for Multiple Files by Prodater64.
Visit: Mini-guide quick and easy - DVD to (S)KVCD with MencodeMe by Maurus.
Visit: Mencode-me: a newbie oriented GUI - 0.23 is out! by VMesquita.
--------------------------

http://www.digitalfaq.com/archives/error.gif

incredible 06-04-2004 02:05 PM

Kwag, why did you set Vqmin=2???
Ok, the manual says dont go under but as we figured out a vqmin=2 would result in blocks on dark underwater scenes for instance as the quantizer wont go under the q=2 limit (vqmin) on these scenes and mencoder on these scenes at q=2 produces blocks!

Try one at vqmin=1 (for shure) and lmin=0.1 (play with lmin) and tell me your results


EDIT:
Yep as I did assume, i saw the 670kbit one and it gots a lot of blocks especially in dark areas thats cause of an average Q of 5!!

The high avg sample still gots blocks on dark scenes as you set vqmin=2 and cause of the "flat" q curve.

The high one you could encode only using vqscale=2 that would be the same :)

kwag 06-04-2004 02:33 PM

Quote:

Originally Posted by Prodater64
@Kwag: Are these parameters for DVDs sources, AVIs sources or both?

From the first post: "Here's your filter line, suitable for DVD encoding" ;)

-kwag

kwag 06-04-2004 02:52 PM

Quote:

Originally Posted by incredible
Kwag, why did you set Vqmin=2???

It happens when a finger hits the incorrect key :!: :x
Thanks for pointing it out. It should be 1, not 2.
All other parameters are correct. I just verified them.

-kwag

kwag 06-04-2004 03:14 PM

Much better :)
This is from another encode (The first 3 minutes of "Space Cowboys" )

http://www.digitalfaq.com/archives/i.../2004/06/7.png

Dialhot 06-04-2004 04:33 PM

Quote:

Originally Posted by kwag

----
A link is valid for 7 days or 25 downloads, whichever occurs first.
Once the link expires, the file is automatically deleted and cannot
be recovered
----

That is what I just downloaded from the link above. Now we have the answer to "how much time a link can be DLed".

kwag 06-04-2004 04:45 PM

It would be great if everyone that downloads it, automatically puts it on the E-Mule "Incomming" folder. That way, we automatically start sharing sample files :)
W can use the site 'yousendit.com" as initial distribution, and then all (most?) people that download it, share it :!:

-kwag

Dialhot 06-04-2004 04:56 PM

It would be great if ytou can check in you waiting queue and set me as a friend. You sent me only 138KB before dropping me of your DL queue :-)

Prodater64 06-04-2004 06:03 PM

Quote:

Originally Posted by kwag
It would be great if everyone that downloads it, automatically puts it on the E-Mule "Incomming" folder. That way, we automatically start sharing sample files :)
W can use the site 'yousendit.com" as initial distribution, and then all (most?) people that download it, share it :!:

-kwag

I like that idea. I'm downloading just now.


--------------------------
Visit: Intermediate guide: MencodeMe/Win32 - Avisynth - MakeAvis by Prodater64.
Visit: KVCD - MencodeMe - Auxiliar Task - KVCD Docking Gate by Prodater64.
Visit: Mencoder scripting with AVSEdit and Guide for Multiple Files by Prodater64.
Visit: Mini-guide quick and easy - DVD to (S)KVCD with MencodeMe by Maurus.
Visit: Mencode-me: a newbie oriented GUI - 0.23 is out! by VMesquita.
--------------------------

http://www.digitalfaq.com/archives/error.gif

audioslave 06-04-2004 10:46 PM

@kwag
This is great! :D I was wondering if you could post your complete command line, please? Your 2 pass *.bat with this new MA routine...

BTW How much do the 2 methods of encoding (With MA/No MA) differ in time? In other words: Is the line with the MA mimicking much slower?

kwag 06-05-2004 12:40 AM

Quote:

Originally Posted by audioslave
@kwag
This is great! :D I was wondering if you could post your complete command line, please? Your 2 pass *.bat with this new MA routine...

Hi audioslave,

Just put the filter line I posted above, between the crop, scale and expand.
My resizing values won't make sense to you, because they are different for every movie. Use PackShot or MencodeME to get your initial configuration file, and then edit the file with the parameters I posted above. All samples were 2-pass.
Quote:


BTW How much do the 2 methods of encoding (With MA/No MA) differ in time?
It's much slower with the adaptive filters, just as it is with the MA script.
Quote:

In other words: Is the line with the MA mimicking much slower?
Yes it is. By about half :!:

-kwag

Dialhot 06-05-2004 02:57 AM

Quote:

Originally Posted by kwag
Yes it is. By about half :!:

If you want an other option that will divide the speed again by 2, use -mbd=2

I'm curious about the result on the bitrate but I don't have the time to test it (btw if someone can share a source sample he use for its test, I can't find any that gives me enought underflowbuffer to do some research on how tp avoid them).

Koekies 06-06-2004 06:17 AM

I just encoded a movie with the mencoder pre alpha build and your filter the quality is great the bitrate is just way to low :S and the noise=3th didn't seem to work. And I made a couple of mistakes it turned into a 720x480 movie and I don't know why can anybody tell me what I've done wrong.
Thanks in advance

batfile
Code:

Mencoder.exe -include temp.conf -lavcopts vbitrate=796:vpass=1 "C:\CI3\VIDEO_TS\VTS_01_1.VOB" -o "C:\CI3\VIDEO_TS\VTS_01_1.m2v"
Mencoder.exe -include temp.conf -lavcopts vbitrate=796:vpass=2 "C:\CI3\VIDEO_TS\VTS_01_1.VOB" -o "C:\CI3\VIDEO_TS\VTS_01_1.m2v"
pulldown.exe "C:\CI3\VIDEO_TS\VTS_01_1.m2v" "C:\CI3\VIDEO_TS\film.m2v" -framerate 23.976 -prog_seq p prog_frames -drop_frame true

conf file
Code:

vf=kerndeint=15:0:1yuvcsp,pullup,softskip,scale=720:480::0:9,crop=672:378:24:16,hqdn3d=2:2:2,sab=1:1:8,smartblur=.5:.5:20,noise=3th:3th,expand=704:480
of=rawvideo=1
ovc=lavc=1
nosound=1
sws=9

lavcopts=vcodec=mpeg2video:vstrict=-1:vmax_b_frames=2:vrc_maxrate=2200:aspect=1.3333:keyint=18:vrc_buf_size=1835:preme=2:precmp=2:autoaspect=1:vrc_eq=tex:scplx_mask=0.01:vqmin=1:mbqmin=1:lmin=0.01:
intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,12,14,18,27,29,34,37,38,22,26,27,31,36,37,38,40,26,27,29,36,39,38,40,48,27,29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79:
inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,28,30,32,34,22,24,26,30,32,32,34,36,24,26,28,32,34,34,36,38,26,28,30,32,34,36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44
ofps=23.976

Oke nevermind the bitrate that was my mistake :oops: but can anybody tell me why its 720x480?

Prodater64 06-06-2004 06:35 AM

Quote:

Originally Posted by Koekies
...
conf file
Code:

vf=kerndeint=15:0:1yuvcsp,pullup,softskip,scale=720:480::0:9,crop=672:378:24:16,hqdn3d=2:2:2,sab=1:1:8,smartblur=.5:.5:20,noise=3th:3th,expand=704:480
of=rawvideo=1
ovc=lavc=1
nosound=1
sws=9

lavcopts=vcodec=mpeg2video:vstrict=-1:vmax_b_frames=2:vrc_maxrate=2200:aspect=1.3333:keyint=18:vrc_buf_size=1835:preme=2:precmp=2:autoaspect=1:vrc_eq=tex:scplx_mask=0.01:vqmin=1:mbqmin=1:lmin=0.01:
intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,12,14,18,27,29,34,37,38,22,26,27,31,36,37,38,40,26,27,29,36,39,38,40,48,27,29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79:
inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,28,30,32,34,22,24,26,30,32,32,34,36,24,26,28,32,34,34,36,38,26,28,30,32,34,36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44
ofps=23.976

Oke nevermind the bitrate that was my mistake :oops: but can anybody tell me why its 720x480?

Hi:
Maybe
Quote:

vf=kerndeint=15:0:1,yuvcsp,...

--------------------------
Visit: Intermediate guide: MencodeMe/Win32 - Avisynth - MakeAvis by Prodater64.
Visit: KVCD - MencodeMe - Auxiliar Task - KVCD Docking Gate by Prodater64.
Visit: Mencoder scripting with AVSEdit and Guide for Multiple Files by Prodater64.
Visit: Mini-guide quick and easy - DVD to (S)KVCD with MencodeMe by Maurus.
Visit: Mencode-me: a newbie oriented GUI - 0.23 is out! by VMesquita.
--------------------------

http://www.digitalfaq.com/archives/error.gif

Koekies 06-06-2004 06:55 AM

thanx I'll try that :)



EDIT:
That wasn't it :(

Koekies 06-06-2004 07:27 AM

Hi this is what dos says.

MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 3) 29.970 fps 9800.0 kbps (1225.0 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x480 fps:29.97 ftime:=0.0334
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1 (-1=autodetect) osd: 1
================================================== ========================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 480 (preferred csp: Mpeg PES)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.3.1
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
================================================== ========================
Writing AVI header...
VDec: vo config request - 720 x 480 (preferred csp: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
videocodec: libavcodec (720x480 fourcc=3267706d [mpg2])

[mpeg2video @ 009B1B2C]MPEG1/2 doesnt support 2997/125 fps, there may be AV sync
issues
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
[mpeg2video @ 009B1B2C]rc buffer underflowmin 0mb A-V:0.000 [0:0]
Pos: 0.3s 9f ( 0%) 0fps Trem: 0min 0mb A-V:0.000 [0:0]
Skipping frame!

Mencoder chooses to use 720x480 :? is there anyway you can force mencoder not to do that :?:

-Koekies

rds_correia 06-06-2004 08:49 AM

Hi koekies,
Can you try just
Code:

vf=scale=720:480::0:9,crop=672:378:24:16,expand=704:480
Just to see if you still get 720x480?
Cheers

Koekies 06-06-2004 09:02 AM

I'll try :) Bicubic resizing gives the same problem as lancos :( Which is better quality? and I'm trying the experimental motion estimation method X1 anyone tried that before?

Koekies 06-06-2004 09:05 AM

I think the motion estimation command vme=5 took away some tiny blocks you could see when there was fast motion :) I'm not sure though it could be something else.

Koekies 06-06-2004 09:19 AM

Mencoder still says

Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 480 (preferred csp: Mpeg PES)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
VDecoder init failed
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.3.1
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
================================================== ========================
Writing AVI header...
VDec: vo config request - 720 x 480 (preferred csp: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
videocodec: libavcodec (720x480 fourcc=3267706d [mpg2])

Koekies 06-06-2004 09:30 AM

In the man_page from mplayer I found this
Code:

−zoom
 
 Allow software scaling, where available. Could be used to force scaling with −vf scale.
NOTE: −vf scale will IGNORE options −x / −y / −xy / −fs / −aspect without −zoom.

Could I use that?

rds_correia 06-06-2004 09:47 AM

Maybe, but it seems to me that your problem is either on expand or crop where the 1st of them takes precedence.
This doesn't seem a scaling problem but mencoder scale is way different than any AVISynth resizer.
Give it a try, anyway.
Cheers

bigggt 06-06-2004 10:02 AM

Hi guys man i know this isin't for newbies because i don't understand anything you guys are doing but when i alter the temp.conf file how do i run it without using the gui
:oops: :cry:

Koekies 06-06-2004 10:15 AM

create a bat file like this

Code:

Mencoder.exe -include temp.conf -lavcopts vbitrate="your bitrate here":vpass=1 "path to your file you want to encode" -o "path to your encoded file example c:\movie\skvcd.m2v"
Mencoder.exe -include temp.conf -lavcopts vbitrate=="your bitrate here":vpass=2 "path to your file you want to encode" -o "path to your encoded file"

or isn't this what you wanted to know? :P

-Koekies

Koekies 06-06-2004 10:17 AM

No luck with the zoom command I don't think it was meant to be used for what I wanted it to bad the -x="x" and -y="y" commands only work in mplayer :(

bigggt 06-06-2004 10:19 AM

HI Koekies

Code:

create a bat file like this

Code:
Mencoder.exe -include temp.conf -lavcopts vbitrate="your bitrate here":vpass=1 "path to your file you want to encode" -o "path to your encoded file example c:\movie\skvcd.m2v"
Mencoder.exe -include temp.conf -lavcopts vbitrate=="your bitrate here":vpass=2 "path to your file you want to encode" -o "path to your encoded file"


is that for me

The only way i know how to get mencoder to run is through one og the Gui's made here(MEncoderMe or packshot)

I started one like Karl said and then edited the file but now i don't know what to do to start again without the GUi(which will overwrite what i just changed)

if your above answer is what i need to do i just don't understand :D

thanx for your help

Koekies 06-06-2004 10:22 AM

First tell me what your conf file is named
Is it in the same dir as mencoder?
Then you create a tekst file copy the stuff in it I just posted
rename it to *.bat and run it

bigggt 06-06-2004 10:27 AM

Thanx buddy please bare with me because i am not computer smart

my conf file is simply named temp.conf

and yes it is in the same folder as mencoder

I tried to run the bat file(by double clicking it) that was created the same time as my conf file but it starts and just closes

Koekies 06-06-2004 10:31 AM

Quote:

Originally Posted by rds_correia
...mencoder scale is way different than any AVISynth resizer.

Well according to the manual you can select lancos bicubic etc.

Code:

−sws <software scaler type> (see −vf scale option too)
 
 This option sets the quality (and speed, respectively) of the software scaler, with the −zoom option. For example with x11 or other outputs which lack hardware acceleration. Possible settings are:
NOTE: For −sws 2 and 7, the sharpness can be set with the scaling parameter (p) of −vf scale (0 (soft) − 100 (sharp)), for −sws 9, it specifies the filter length (1 − 10).
 
 0  fast bilinear (default)
 1  bilinear
 2  bicubic (good quality)
 3  experimental
 4  nearest neighbour (bad quality)
 5  area
 6  luma bicubic / chroma bilinear
 7  gauss
 8  sincR
 9  lanczos
 10  bicubic spline

these are software scalers I think avisynth uses ones that are very simmilar

Koekies 06-06-2004 10:37 AM

@ bigggt the bat created by mencodeme doesn't just work like that
because of the value %%PASS%% or something it only works with mencodeme.
So copy that line so you have it two times. replace the first %%PASS%% with 1 and the second with 2

encode bat mencodeme makes
Mencoder.exe -include temp.conf -lavcopts vbitrate=843:vpass=%%PASS%% "C:\movies\Timeline\alliance-timeline-xvid\alliance-timeline-xvid.avi" -o "C:\movies\Timeline\alliance-timeline-xvid\alliance-timeline-xvid.mpv"

what you do to it
Mencoder.exe -include temp.conf -lavcopts vbitrate=843:vpass=1 "C:\movies\Timeline\alliance-timeline-xvid\alliance-timeline-xvid.avi" -o "C:\movies\Timeline\alliance-timeline-xvid\alliance-timeline-xvid.mpv"
Mencoder.exe -include temp.conf -lavcopts vbitrate=843:vpass=2 "C:\movies\Timeline\alliance-timeline-xvid\alliance-timeline-xvid.avi" -o "C:\movies\Timeline\alliance-timeline-xvid\alliance-timeline-xvid.mpv"

bigggt 06-06-2004 10:47 AM

Thanx Koekies

I have to leave for the day but i will try when i get home tonight

I appreciate your help :D

bigggt 06-06-2004 05:35 PM

OK i get and did what you said but i still don't get how to run the bat file,i can't just double click it :roll:

Koekies 06-06-2004 05:42 PM

why not?
run it in dos see why it shuts down there must be some mencoder error if it shuts down immediatly

bigggt 06-06-2004 06:51 PM

Thanx Buddy I final i got it (thanx to you :wink: )

The error i was getting was something to the effect of not finding the directory or something


All times are GMT -5. The time now is 10:33 PM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.