PDA

View Full Version : "If Video is certain resolution, then" argument


blazer003
29th March 2010, 23:32
I'm relatively new to AVISynth, and this is a problem I came across.
I'm using DGDecNV to process my mts files from my Panasonic GH-1. DGDecNV uses a template so that when you save the output project, it also creates an avs script to load that project into VirtualDub or whatever.

Here's the issue.

I have a majority of clips that are 1080p 24fps, but some clips that are 720p 60fps.

My script uses the decomb filter to remove pulldown from my 24p clips (they're in a 60i format), however my 60p clips don't need or want that pulldown removal. So each time I process a 720p file I have to go in and remove the lines of the script that do the pulldown.

So my question is, first of all, can I get the resolution or the framerate values in AVISynth and if so, can I do a conditional:

"If my clip is 720p, don't do pulldown, but if it is 1080p then do do the following steps to remove pulldown"

or

"If my clip is 29.97fps (what the 24p clips are read as) then process the pulldown, but if it is 59.94 then do not remove pulldown."

Thanks for your help to this somewhat complicated question.

linyx
30th March 2010, 03:30
Source = DGMultiDecode("Video.dgi")
Source = (Source.Width()==1280) ? return Source : Telecide(Guide=1).Decimate() #If the width is 1280, then do nothing. Else do a typical IVTC.

Or
Source = DGMultiDecode("Video.dgi")
Source = (Source.FrameRate()==29.97) ? Telecide(Guide=1).Decimate() : Return Source

There is also GScript which is easier to use for If statements, but that should be a good start for you. ;)
Here are some helpful topics.
AviSynth Clip Properties (http://avisynth.org/mediawiki/Clip_properties)
AviSynth Operators (http://avisynth.org/mediawiki/Operators)

blazer003
30th March 2010, 05:49
Thanks a lot man, I appreciate it. I read a couple things on IF THEN in AVISynth, but this is exactly what I need.

linyx
30th March 2010, 06:31
Thanks a lot man, I appreciate it. I read a couple things on IF THEN in AVISynth, but this is exactly what I need.
Glad I could help.
If you still need more help feel free to ask.

Gavino
30th March 2010, 19:22
Source = (Source.Width()==1280) ? return Source : Telecide(Guide=1).Decimate()
...
Source = (Source.FrameRate()==29.97) ? Telecide(Guide=1).Decimate() : Return Source
You can't put 'return' in the middle of a statement, you'll get a syntax error.
In both the above cases, just remove the word 'return'.

blazer003
30th March 2010, 20:23
After messing around a little bit, here's what I came up with, and it seems to be working.

LoadPlugin("C:\Program Files\DG Software\dgavcdec109\DGDecodeNV.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\decomb.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\NicAudio.dll")
Source = DGSource("__vid__")
Source = (Source.FrameRate()<=30) ? Source.AssumeTFF().Telecide(Guide=1).Decimate() : Source
audio=NicAC3Source("__aud__").ConvertAudioto16bit()
AudioDub (Source, audio)

I don't think the script was coming up with exactly 29.97 as the framerate (maybe 29.970 or something?), so I just changed it to anything less than 30. In my case right now I only have clips that are 59.94 or 29.97 so this works fine.

Second, and I don't know if I'm supposed to have to do this or if I was doing something wrong, but I had to add Source. in front of the AssumeTFF, Telecided and Decimate commands. Maybe you just forgot it. Anyway, this works now.

linyx
30th March 2010, 23:39
You can't put 'return' in the middle of a statement, you'll get a syntax error.
In both the above cases, just remove the word 'return'.
OK, thanks for pointing that out (never rely on something that should work in theory without testing it :D).

Second, and I don't know if I'm supposed to have to do this or if I was doing something wrong, but I had to add Source. in front of the AssumeTFF, Telecided and Decimate commands. Maybe you just forgot it. Anyway, this works now.
Yes you should have to do that, of course you could omit that entirely by using:

LoadPlugin("C:\Program Files\DG Software\dgavcdec109\DGDecodeNV.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\decomb.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\NicAudio.dll")
DGSource("__vid__")
Source = (FrameRate()<=30) ? AssumeTFF().Telecide(Guide=1).Decimate() : last
audio=NicAC3Source("__aud__").ConvertAudioto16bit()
AudioDub (Source, audio)
Or for your 29.97 issue (this *could* work, but won't necessarily):
LoadPlugin("C:\Program Files\DG Software\dgavcdec109\DGDecodeNV.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\decomb.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\NicAudio.dll")
DGSource("__vid__")
Source = (FrameRateNumerator()=30) ? AssumeTFF().Telecide(Guide=1).Decimate() : last
audio=NicAC3Source("__aud__").ConvertAudioto16bit()
AudioDub (Source, audio)
That assumes it is 30/1.001 for 29.970 or use 60 for 59.94. It might not work, though.

Gavino
31st March 2010, 09:39
Source = (FrameRateNumerator()=30) ? AssumeTFF().Telecide(Guide=1).Decimate() : last
That assumes it is 30/1.001 for 29.970 or use 60 for 59.94. It might not work, though.
It won't - FrameRateNumerator is 30000 in this case (denominator = 1001).
(Note also, equality test requires ==)