Encoding MPEG-2 to X264

This forum is for questions and discussion of all the aspects of handling your footage. If you have questions about capturing/ripping footage, AviSynth, or compression/encoding/converting, look here.

Encoding MPEG-2 to X264

Postby Anno-san » Mon Sep 06, 2010 11:21 am

I am trying to encode a Berserk video that I ripped from DVD. My main problem is that I am trying to deblock and sharpen the video but I keep getting errors when I open the avs script. I am using Deblock_QED MT2 to deblock and Sharptools to sharpen the video. There is also significant grain throughout the footage, so I guess I'll use Removegrain.

When I open this script I receive an error that says "there is no function named Deblock_QED".

Code: Select all
LoadPlugin("C:\Users\User1\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("C:\Users\User1\dvd rip\Berserk Forces Full Version.d2v", info=3)
ConvertToYV12()
Last.MergeChroma(Last.PointResize((Last.width/2),(Last.Height/2)).Spline36Resize(Last.Width, Last.Height).Blur(0.5))
tfm()
tdecimate(mode=1)
Deblock_QED(uv=1)


I also am wondering if it would just be more effective to use AnimeIVTC() instead, as I haven't IVTC'd the video yet and would like to make it VFR.
User avatar
Anno-san
 
Joined: 24 Dec 2009

Re: Encoding MPEG-2 to X264

Postby mirkosp » Mon Sep 06, 2010 12:40 pm

If you want to vfr then I suggest you to read this. There's a simple explanation from the 2pass IVTC to the timecodes muxing. Do keep in mind, however, that doing VFR AMVs can be annoyingly and pointlessly complicated, so you might want to drop the vfr idea.
You also want to resize after IVTCing. I don't quite get the point of the whole chroma resizing at all... especially not with pointresize ad blurring. I mean, sure, technically halvening the chroma like that doesn't kill chroma detail since the chroma samples are half the width and height to begin with, but resizing it like that just doesn't make sense anyway, and you're still doing an extra blur... you don't really need to use tricks to boost compression, if that's what it is.
As for deblock_QED, make sure the code here is saved in an avsi in your plugins folder, if you want it to autoload, otherwise just Import() the avs.
PS: You don't really care for the info of mpegsource, so drop that too. <.<
Image
User avatar
mirkosp
MODkip
 
Joined: 24 Apr 2006
Location: Gallarate (VA), Italy
Status: (」・ワ・)」(⊃・ワ・)⊃

Re: Encoding MPEG-2 to X264

Postby Anno-san » Tue Sep 07, 2010 10:55 am

I made the below script and there seems to be some combing artifacts (possibly chroma artifacts).

[code=LoadPlugin("C:\Users\user\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("C:\Users\user\dvd rip\Berserk Forces Full Version.d2v", info=3)
tfm(pp=6)
tdecimate(mode=1)
Deblock_QED(uv=1)
Removegrain()

Then I found some problems in this image:
Image

1. There appear to be combing or maybe chroma artifacts. Is the tfm(pp=6) causing this, or is it the UV= parameter in Deblock_QED?
2. There are black borders at either side of the frame. What commands would crop those out?
User avatar
Anno-san
 
Joined: 24 Dec 2009

Re: Encoding MPEG-2 to X264

Postby Anno-san » Tue Sep 07, 2010 11:11 am

Image

This image also shows major combing artifacts, despite IVTC. Also, in another video forum someone said that my graphics card was causing chroma upsampling bugs in the .vob files I ripped. That was why I used the Merge.Chroma..... commands.

Does anyone know what the problem is?
User avatar
Anno-san
 
Joined: 24 Dec 2009

Re: Encoding MPEG-2 to X264

Postby mirkosp » Tue Sep 07, 2010 1:30 pm

Try using different parameters in the tfm:
Code: Select all
TFM(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))

I'll also repeat the suggestion to remove the info parameter of mpeg2source as you don't really need it.

As for the chroma upsampling, I doubt it's the video card... it's more about the renderer that deals with it.
Image
User avatar
mirkosp
MODkip
 
Joined: 24 Apr 2006
Location: Gallarate (VA), Italy
Status: (」・ワ・)」(⊃・ワ・)⊃

Re: Encoding MPEG-2 to X264

Postby Cannonaire » Wed Sep 08, 2010 1:20 am

Is that combing problem there before you use that mergechroma line? I've seen the exact same thing happen when I try to derainbow before deinterlacing and IVTC. If you're keeping that chroma line, make sure it comes after TFM and TDecimate. That should fix your problem I think, but it's a good idea to always do the deinterlacing and IVTC first thing after loading your source unless a filter specifically needs to go before it, which is generally only the case with dot crawl removal from what I've seen. Basically, you never want to resize vertically if your source is still interlaced.

I'm not entirely sure about this, but I would think and mpeg2 source from DVD would already be in YV12, in which case you don't need the ConvertToYV12() line. Your program should tell you what colorspace the footage is in (if you're using AVSP, hit f5 to preview and the info will be displayed in the lower right).

As far as cropping goes, use Crop(0,0,-0,-0), and replace the first and third 0s (left and right) with the number of pixels you want cropped off. This must be an even number on each side because the video is YV12. It is generally better to overcrop slightly than to undercrop, but you have to be a bit careful. Also, different episodes within one anime may have different border sizes to be cropped. It is also ideal (though not entirely necessary with x264) to crop to a resolution evenly divisible by 16, such as 720 or 704.

Hope this helps!
Image Think millionaire, but with cannons. || Resident Maaya Sakamoto fan.
User avatar
Cannonaire
 
Joined: 05 May 2010
Location: Oregon
Status: OVERLOAD

Re: Encoding MPEG-2 to X264

Postby Mister Hatt » Thu Sep 09, 2010 7:33 am

Report back with screenshots after using Mirko's TFM line. I am wondering if that temporal shifting in the chroma is in the source or just a bad IVTC. That's what you're seeing tho.
Mister Hatt
 
Joined: 25 Dec 2007
Status: better than you

Re: Encoding MPEG-2 to X264

Postby Anno-san » Thu Sep 09, 2010 8:48 pm

I used this script and the results were still basically the same; there was an interlaced frame within every 5 frames, thus telecine. The same problem is visible using madvr. Odd though, I've never had IVTC problems before.

Code: Select all
LoadPlugin("C:\Users\user1\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("C:\Users\user1\dvd rip\Berserk Forces Full Version.d2v", info=3)
tfm(mode=1,pp=6,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))
tdecimate(mode=1)
Deblock_QED()
Removegrain()
crop(10,0,-14,0)
Last.MergeChroma(Last.PointResize((Last.width/2),(Last.Height/2)).Spline36Resize(Last.Width, Last.Height).Blur(0.5))
User avatar
Anno-san
 
Joined: 24 Dec 2009

Re: Encoding MPEG-2 to X264

Postby Mister Hatt » Thu Sep 09, 2010 9:49 pm

That final line you have is probably causing your chroma shifting issues I'd imagine. From the look of it it shouldn't be, but who knows what crazy things avs can do. Why exactly do you need VFR? It will make editing in an NLE a royal pain.
Mister Hatt
 
Joined: 25 Dec 2007
Status: better than you


Return to Footage Help

Who is online

Users browsing this forum: No registered users and 0 guests