Log in

View Full Version : x264 encoding question


AniiG2
22nd December 2021, 04:22
Hello Guys,

Greetings from Kolkata, India.

You can consider me a rookie-the-novice when decoding a DVD to .mkv is considered.

I use Windows 7, 32 bit machine (a desktop of neanderthal era).

Few days ago, I was decoding a NTSC DVD.
1. I used DgIndex to create d2v into 23.976.
2. In avsPmod I took that d2v to create the .avs to make a lossless .avi file through lagarith codec and there, in the script, I tried to do something stated as below:

LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\warpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\TDeint.dll")
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\UnDot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\TIVTC.dll")
MPEG2Source("C:\Users\Ani\Videos\LA BELLE\VIDEO_TS\VTS_02_1.d2v", cpu=0)
QTGMC(InputType=1, Preset="slower", SourceMatch=3, sharpness=0.6, TR2=1, Edithreads=1)
tfm()
Tdecimate()
TDeint(full=false)
warpsharp_unsharpmask(strength=10, radius=30, threshold=5)
Undot() # Minimal Noise

And when put the .avs into VirtualDub, it shows Frame rate as 19. something instead of 23.976.

1. Please suggest me what parametric syntax I should put in tfm and Tdecimate to get back 23.976 as Frame rate for the lossless .avi (through lagarith codec) in VirtualDub.

2. FFTW3.dll is not functioning in my .avs script. I put in System32 of windows but didn't work. I tried to execute it through command prompt as admin but it went in vain. Same thing happened in case of decomb.dll.

3. How to use RemoveGrainS? Please suggest me with parametric syntax. Are they same for NTSC and PAL?

4. How to use MCTemporalDenoise? Please suggest me with parametric syntax. Are they same for NTSC and PAL?

5. Even I don't know the use of TemporalDegrain. Please suggest. Are they same for NTSC and PAL?

6. What should be the parametric syntax of SMDegrain? Please suggest. Are they same for NTSC and PAL?

7. I cannot use EZDenoise (a function of QTGMC to eradicate noise) due to non-functioning of FFTW3.dll. Please suggest me what to do?

8. Can you give me a link from where I would be able to get FluxSmooth.dll?

9. What else should I use to get nice, clean .mkv?

Sorry to bother you. I know all of these have been answered here already but I just couldn't find.

Love,

AniiG2

FranceBB
22nd December 2021, 23:27
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\warpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\TDeint.dll")
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\UnDot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.6\plugins\TIVTC.dll")
MPEG2Source("C:\Users\Ani\Videos\LA BELLE\VIDEO_TS\VTS_02_1.d2v", cpu=0)
QTGMC(InputType=1, Preset="slower", SourceMatch=3, sharpness=0.6, TR2=1, Edithreads=1)
tfm()
Tdecimate()
TDeint(full=false)
warpsharp_unsharpmask(strength=10, radius=30, threshold=5)
Undot() # Minimal Noise

And when put the .avs into VirtualDub, it shows Frame rate as 19. something instead of 23.976.

Please suggest me what parametric syntax I should put in tfm and Tdecimate to get back 23.976 as Frame rate for the lossless .avi (through lagarith codec) in VirtualDub.


It's 11PM and I'm tired, but I've just witnessed Chelsea win against Brentford to get to the Carabao Cup semi final (https://i.imgur.com/N9O7I2h.png), so I'm gonna help you eheheheheh

First of all, if your source is actually telecined, there's no reason to use QTGMC and then TFM and TDecimate. On top of that, TDeint() is yet another deinterlacer, you really don't need it there.

Your script should really be:

MPEG2Source("C:\Users\Ani\Videos\LABELLE\VIDEO_TS\VTS_02_1.d2v", cpu=0)

tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))
tdecimate()

this will get you back to 23,976p as it will inverse telecine the source; in other words, first it deinterlaces it to 29,970p and then it detects the 3:2 pulldown and decimates the duplicated frames to get 23,976p back.

FFTW3.dll is not functioning in my .avs script. I put in System32 of windows but didn't work.

Is the FFTW3.dll you downloaded 32bit, so x86?
Is your operative system 32bit x86 as well?
'cause if you have a 64bit OS, then you MUST put x86 libraries into SysWOW64 (I know, I know, it's rather confusing, but hey, I blame it on Microsoft).


3. How to use RemoveGrainS? Please suggest me with parametric syntax. Are they same for NTSC and PAL?

4. How to use MCTemporalDenoise? Please suggest me with parametric syntax. Are they same for NTSC and PAL?

5. Even I don't know the use of TemporalDegrain. Please suggest. Are they same for NTSC and PAL?


RemogeGrain(), MCTemporalDenoise(), TemporalDegrain()? What are you trying to do? Denoise? If that's the case, you can try with DFTTest() which is my de facto favorite denoise and works in high bit depth too if needed. :)

6. What should be the parametric syntax of SMDegrain? Please suggest. Are they same for NTSC and PAL?

I don't use SMDegrain, however I know a colleague who does use it extensively, his name on this forum is "Tormento", so I'll hand over to him to comment on this. ;)


7. I cannot use EZDenoise (a function of QTGMC to eradicate noise) due to non-functioning of FFTW3.dll. Please suggest me what to do?


Check my previous comment about FFTW3 and the 32bit-ness of your OS and I'm sure it's gonna work if you put the 32bit dll inside SysWOW64.

8. Can you give me a link from where I would be able to get FluxSmooth.dll?

Sure, the most updated version is, of course, the pfmod (whenever you see something with "pfmod" in it, go for it, it means that Ferenc Pinter brought it to this millennium and made it work with recent version of Avisynth) ;)

https://github.com/pinterf/FluxSmooth/releases

9. What else should I use to get nice, clean .mkv?

Dunno, upload a sample and define what you have in mind xD
Anyway, since you seem to be looking for indexing, inverse telecine and denoise, I'll write a script for you:


#Indexing
MPEG2Source("C:\Users\Ani\Videos\LABELLE\VIDEO_TS\VTS_02_1.d2v", cpu=0)

#Inverse telecine
tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))
tdecimate()

#Denoise
dfttest(sigma=64, tbsize=1, lsb_in=false, lsb=false, Y=true, U=true, V=true, opt=0, dither=0)

#Clipping
Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240)



About the denoising part, lower the sigma according to your taste.

Enjoy! ;)

qyot27
23rd December 2021, 03:11
If you used Forced Film mode in DGIndex, like you apparently said you did*, then both the QTGMC and TDecimate (and TDeint) steps are completely unnecessary, as setting Forced Film in and of itself will return the video to 23.976 and nothing else is needed. But that's assuming that using Forced Film mode is the correct thing to do for that source: if DGIndex is detecting that the source is Film, then Forced Film is correct. Otherwise, set it to Honor Pulldown Flags and then you can use the TFM/TDecimate combo.

*from here:
1. I used DgIndex to create d2v into 23.976.

AniiG2
24th December 2021, 21:56
It's 11PM and I'm tired, but I've just witnessed Chelsea win against Brentford to get to the Carabao Cup semi final (https://i.imgur.com/N9O7I2h.png), so I'm gonna help you eheheheheh

First of all, if your source is actually telecined, there's no reason to use QTGMC and then TFM and TDecimate. On top of that, TDeint() is yet another deinterlacer, you really don't need it there.

Your script should really be:

MPEG2Source("C:\Users\Ani\Videos\LABELLE\VIDEO_TS\VTS_02_1.d2v", cpu=0)

tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))
tdecimate()

this will get you back to 23,976p as it will inverse telecine the source; in other words, first it deinterlaces it to 29,970p and then it detects the 3:2 pulldown and decimates the duplicated frames to get 23,976p back.



Is the FFTW3.dll you downloaded 32bit, so x86?
Is your operative system 32bit x86 as well?
'cause if you have a 64bit OS, then you MUST put x86 libraries into SysWOW64 (I know, I know, it's rather confusing, but hey, I blame it on Microsoft).



RemogeGrain(), MCTemporalDenoise(), TemporalDegrain()? What are you trying to do? Denoise? If that's the case, you can try with DFTTest() which is my de facto favorite denoise and works in high bit depth too if needed. :)



I don't use SMDegrain, however I know a colleague who does use it extensively, his name on this forum is "Tormento", so I'll hand over to him to comment on this. ;)



Check my previous comment about FFTW3 and the 32bit-ness of your OS and I'm sure it's gonna work if you put the 32bit dll inside SysWOW64.



Sure, the most updated version is, of course, the pfmod (whenever you see something with "pfmod" in it, go for it, it means that Ferenc Pinter brought it to this millennium and made it work with recent version of Avisynth) ;)

https://github.com/pinterf/FluxSmooth/releases



Dunno, upload a sample and define what you have in mind xD
Anyway, since you seem to be looking for indexing, inverse telecine and denoise, I'll write a script for you:


#Indexing
MPEG2Source("C:\Users\Ani\Videos\LABELLE\VIDEO_TS\VTS_02_1.d2v", cpu=0)

#Inverse telecine
tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))
tdecimate()

#Denoise
dfttest(sigma=64, tbsize=1, lsb_in=false, lsb=false, Y=true, U=true, V=true, opt=0, dither=0)

#Clipping
Limiter(min_luma=16, max_luma=235, min_chroma=16, max_chroma=240)



About the denoising part, lower the sigma according to your taste.

Enjoy! ;)

Thanks a ton to you for such a long reply and a bit of Chelsea too (I reckon you are a supporter of Chelsea; though I try to watch Liverpool as I have started to like Md. Salah) as they won the match.

Meanwhile, I solved the problem (at least temporarily) of TDecimate by specifying (Mode=7, rate=23.976).

Thank you again for letting me know about dfttest but I have checked it also required to fix access violation (executing it in System32 of Windows) and I cannot do it AT ALL. Unfortunately, this dfttest also needs access from System32. :(

Due to which I cannot use FFTW3.dll, decomb.dll, denoiser.dll etc. To me, functioning of FFTW3.dll is very much important.

And, YES, I have downloaded all 32 bit version for sure.

I wish to write you more but it is 2.20 am here.

BTW, I have checked your codes and peruse them tomorrow.

I'll ask you (not literally, LOL) again later.

love,

AniiG2

AniiG2
24th December 2021, 22:00
If you used Forced Film mode in DGIndex, like you apparently said you did*, then both the QTGMC and TDecimate (and TDeint) steps are completely unnecessary, as setting Forced Film in and of itself will return the video to 23.976 and nothing else is needed. But that's assuming that using Forced Film mode is the correct thing to do for that source: if DGIndex is detecting that the source is Film, then Forced Film is correct. Otherwise, set it to Honor Pulldown Flags and then you can use the TFM/TDecimate combo.

*from here:

Thank you for replying me.

Otherwise, set it to Honor Pulldown Flags and then you can use the TFM/TDecimate combo.
I'll do this from next time.

love

AniiG2

FranceBB
25th December 2021, 01:56
Thank you again for letting me know about dfttest but I have checked it also required to fix access violation (executing it in System32 of Windows) and I cannot do it AT ALL. Unfortunately, this dfttest also needs access from System32. :(

Due to which I cannot use FFTW3.dll, decomb.dll, denoiser.dll etc. To me, functioning of FFTW3.dll is very much important.

And, YES, I have downloaded all 32 bit version for sure.

Which operative system do you have?
As I said, if you have a x64 OS, then you MUST put 32bit dlls in SysWOW64 and NOT in System32!

AniiG2
25th December 2021, 04:16
Which operative system do you have?
As I said, if you have a x64 OS, then you MUST put 32bit dlls in SysWOW64 and NOT in System32!

I use Windows 7, 32 bit machine (a desktop of neanderthal era).

https://i.ibb.co/GCc6K8X/neanderthal.png

FranceBB
25th December 2021, 17:36
I use Windows 7, 32 bit machine (a desktop of neanderthal era).

https://i.ibb.co/GCc6K8X/neanderthal.png

Uhm... this is odd then, you shouldn't really get those issues.
I have an idea, though!
I have Windows XP 32bit, so I can give you my DLLs and see if it works.
So first thing first:

- Download and install this Avisynth+ version: Link (https://github.com/AviSynth/AviSynthPlus/releases/download/v3.7.0/AviSynthPlus_3.7.0_20210111_vcredist_xp.exe)

- Download and put those plugins inside your plugins+ folder in Avisynth (only the plugins/plugins+, ignore the 64): Link (https://mega.nz/file/mEEjCYaT#2IOaWttrE2jIbNB85hQPtcXiOcFyvO7xtTTJcKDT3pg)

- Download FFTW 32bit and put it in System32 from here: Link (https://forum.videohelp.com/attachments/45495-1525285716/fftw337-4windows.7z)

Then come back to me and tell me whether it works or not.
Please run the script under AVSMeter and tell me what it says if it produces an error.


Merry Christmas!!

https://media3.giphy.com/media/3o6fJdYXEvMa5ZmlI4/giphy.gif

AniiG2
27th December 2021, 03:39
FranceBB, Thanks a ton for your concern about my probable but not palpable successful functioning in DVD encoding.

I have two questions for you ; - the little code that you wrote for me with tfm () and TDecimate(); is this applicable for PAL DVD too? Because I have seen many interlaced PAL videos. I mean -
tfm(mode=1,pp=5,slow=2,micmatching=2,clip2=tdeint(mode=2,type=3))
tdecimate()

I mean is there any need of changing values of parameters of tfm? I was reading here and there.
Is this sufficient? -

mpeg2source("c:\**\***\VIDEO_TS\##.d2v")
tfm(d2v="c:\**\***\VIDEO_TS\##.d2v")
tdecimate(cycle=25)

And the last line of avs script will be (I prefer to do it; - AssumeFPS(24,1)

My Second question is ridiculous; it is not a question, rather it is a request.

Can you find me latest version of FFTW3.dll? I have two copies of them, one is of 1.83mb in size and other one is of 3.83. Both are for x86 i.e. for 32 bit but I cannot recall which one the later version.
But I mean not the .dll file stand alone; I need wisdom, F File, F03 i.e. the full bag of FFTW3.dll as you sent earlier. 3 lib files (associated with FFTW3) were there along with Application files.

I will also try to find out one.

I forgot to mention that VC++ redistributable 2015 was not in my machine. Dun'no somehow it was missing. However, I have re-installed that. But the problem remains.

what more? I have asked you a lot already.

Love,

AniiG2

manono
29th December 2021, 02:53
Few days ago, I was decoding a NTSC DVD.
1. I used DgIndex to create d2v into 23.976.

Which means you used Forced Film in DGIndex, probably a bad move, especially if you followed it with
QTGMC(InputType=1, Preset="slower", SourceMatch=3, sharpness=0.6, TR2=1, Edithreads=1)
tfm()
Tdecimate()
which make no sense at all. You were told this earlier.
Otherwise, set it to Honor Pulldown Flags and then you can use the TFM/TDecimate combo.
I'll do this from next time.
No, you should start over and do it again.

You should provide a short unreencoded sample, 10 seconds or so with steady movement cut using DGIndex.

And when put the .avs into VirtualDub, it shows Frame rate as 19. something instead of 23.976.
Because you tried to IVTC an already 23.976fps D2V file. Like I and others have said, do it over, this time using 'Honor Pulldown Flags'.

And no, you don't do this with PAL sources. Make available the sample.

FranceBB
29th December 2021, 06:52
FranceBB, Thanks a ton

No problem. ;)


I have two questions for you ; - the little code that you wrote for me with tfm () and TDecimate(); is this applicable for PAL DVD too?


Absolutely NOT! Eheheheh that's for IVTC, so it takes a 29.970 source and it performs inverse telecine to 23,976. Use it only with telecined sources that have 3:2 pulldown.



I mean is there any need of changing values of parameters of tfm?


If you have a PAL source which is 25i, a simple call to QTGMC() or if it's too slow TDeint() will be sufficient.
About TDeint, you can use something like:

tdeint(mode=2, order=-1, field=-1, mthreshL=6, mthreshC=6, map=0, type=2, debug=false, mtnmode=1, sharp=true, cthresh=6, blockx=16, blocky=16, chroma=true, MI=64, tryWeave=true, link=1, denoise=true, slow=2)


And the last line of avs script will be (I prefer to do it; - AssumeFPS(24,1)


Why? To do a 4% slow-down and go back to 23,976p? If the source was 23,976p and has been speeded up + pitch adjusted by 4% 48'000Hz to 25p, then you don't need any of the above as the source you're dealing with is already progressive 25p and as such you can, technically, slow it down to 23,976p to get the original speed back.



Can you find me latest version of FFTW3.dll 32bit?


Since you have Windows 7 32bit x86, this is the version I compiled and that I'm currently running on my Windows XP x86. I targeted Windows XP 32bit and SSE2, so it should be as compatible as possible and it should work. Put it in your C:\WINDOWS\system32 exactly as it is without renaming it: https://we.tl/t-BRHWzSSLSC

(the link expires in 7 days)

Then run a script with:

ColorBars(848, 480, pixel_type="YV12")
dfttest()
trim(0, 100)

in AVSMeter and tell me the error (if it outputs an error).
Otherwise, run it in AVSPmod and tell me what it says.




I forgot to mention that VC++ redistributable 2015 was not in my machine. Dun'no somehow it was missing. However, I have re-installed that. But the problem remains.


Just to be sure, install this one which is an AIO package with all the C++ Redistributable x86: https://github.com/abbodi1406/vcredist/releases/

and also the latest Windows 7 x86 compatible .NET Framework from the Microsoft Website: https://dotnet.microsoft.com/en-us/download/dotnet-framework


Then reboot and repeat the test above with the script I wrote and tell me what AVSPmod and AVSMeter say.
If it still doesn't work, then we might have to use Dependency Walker to see what is wrong with your setup and it's not gonna be easy eheheheh



what more? I have asked you a lot already.

eheheheh that's alright.


by the way:


No, you should start over and do it again.


Manono is right, you should re-index your source with the right settings if you wanna use DGIndex, otherwise FFMpegSource2("source.vob", atrack=-1) will probably do it just as well.

Forteen88
31st December 2021, 21:09
4. How to use MCTemporalDenoise? Please suggest me with parametric syntax. Are they same for NTSC and PAL?

5. Even I don't know the use of TemporalDegrain. Please suggest. Are they same for NTSC and PAL?

6. What should be the parametric syntax of SMDegrain? Please suggest. Are they same for NTSC and PAL?Since you encode DVD-resolution, you should use the denoiser STPresso (it don't work good on HD-video though), because it optimizes the denoising so that it makes the compression more effective for the encoder.
You should probably decrease the degrain-strength of the STPresso though, because I thought it degrain too much in default mode.