Log in

View Full Version : AVIsynth won't see my cine AVI film, why?


MartinS
1st April 2020, 14:16
Hi all

Background:
I have some 25,000 ft of standard 8 and 16mm family cine dating from 1937. I am digitising these for the family "archives"

Using an LED light source in a projector and with the lens removed, I am capturing the image at the gate with a Nikon D810, bellows and a Nikkor 55mm reversed lens. An Arduino microcomputer controls the stepper motor and the firing of the camera. I have then been dropping a folder with the 16,000 odd frames into Premiere Pro CC etc.

I then bumped into VideoFreds web site and realised that I can do a ton better than I have so far,

But,

I am have having trouble getting AviSynth/VisualDub/VideoFred-script working and need some direction.

I installed the above and it didn't work. So I hit "Restore Point"

Then, whether it be right or wrong I consulted YouTube....


....and ended up installing

AviSynth 23bit
AvsPmod
ffmpeg 32bit & 64bit
L-Smash
VirtualDub 32bit
ffinput driver 32bit, X264 32bit & 64bit

Again, I can still open the .avi in VirtualDub, but when I file>open>script I get the error

<file "c:\users......01_C_Film_Restoring_Blending_Cleaning_Only.avs" does not have a video stream>

What could I be doing wrong?

Film codec, script error, s/w install & plugins?

What info of the install do you want to know to help me understand and track down the fault?

Martin

wonkey_monkey
1st April 2020, 14:21
:script:

Stereodude
1st April 2020, 14:24
Post the contents of the 01_C_Film_Restoring_Blending_Cleaning_Only.avs script

What format are the pictures from the D810 in? You have a folder full of JPEGs that you're trying to open?

johnmeyer
1st April 2020, 18:26
Actually, you should really post 2-3 seconds of one of the AVI files. You could also use Mediainfo to report on the content and structure of the AVI file. "AVI" doesn't help much because it is a container which can house video encoded with just about any codec. Some codecs cannot be opened by the standard AVISynth AVI read function. There are several ways to get the video into the script, but it is impossible to recommend a solution without seeing a sample of the video.

MartinS
1st April 2020, 22:09
JohnMayer
Actually, you should really post 2-3 seconds of one of the AVI files. You could also use Mediainfo to report on the content and structure of the AVI file.

Sterodude
What format are the pictures from the D810 in? You have a folder full of JPEGs that you're trying to open?

The stills that I have taken are 2400x1600 JPG's. I drop the folders (1000 each) into Premiere. Each folder becomes a clip. I assemble the film on the timeline from where I can crop, steady, colour correct, as necessary. I can then export in a variety of codecs and pixel sizes. The following sample export was "AVI" "PalDV" for 720x576.

[How do I post video....200kb is one frame?]

Video data:

General
Complete name : F:\SampleAVI .avi
Format : AVI
Format/Info : Audio Video Interleave
Commercial name : DV
File size : 10.7 MiB
Duration : 2 s 960 ms
Overall bit rate mode : Constant
Overall bit rate : 30.4 Mb/s
Recorded date : 2020-04-01T21:27:35+01:00
Writing application : Adobe Premiere Pro 2020.0 (Windows)

Video
ID : 0
Format : DV
Codec ID : dvsd
Duration : 2 s 960 ms
Bit rate mode : Constant
Bit rate : 24.4 Mb/s
Encoded bit rate : 28.8 Mb/s
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 25.000 FPS
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Bottom Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 2.357
Time code of first frame : 00:06:07:24 / 00:06:07:24
Time code source : Adobe tc_A / Adobe tc_O
Stream size : 10.2 MiB (95%)

Audio
ID : 1
Format : PCM
Format settings : Little
Codec ID : 1
Duration : 2 s 960 ms
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 555 KiB (5%)

The above AVI is simply get things working. It is interlaced which I do not want but I was going to worry about the best input format when I had understood what the overall benefits were of using AVISynth.

The script is

# 8mm film restoration script by videoFred.
# www.super-8.be

# info@super-8.be

# version 01.C with frame blending and cleaning but without degraining, for better render speed
# release date: june 20, 2012
#============================================================================================

# august 2010: added removerdirtMC() as suggested by John Meyer
# october 2010: auto sharpening parameters

# march 2011: new autolevels.dll by Jim Battle
# www.thebattles.net/video/autolevels.html

# june 2012: improved stabilising

#=============================================================================================

# cleaning, resizing, stabilizing, sharpening, auto-levels and auto-white balance.
#=============================================================================================




film= "F:\SampleAVI.AVI" # source clip, you must specify the full path here




#PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
result="resultS1" # specify the wanted output here

trim_begin=2 trim_end= 16 play_speed= 18 #trim frames and play speed (PAL: 16.6666 or 18.75)

final_framerate = 25 # final frame rate

frame_blend= 0.4 # the amount of frame blending


#COLOR AND LEVELS PARAMATERS
#----------------------------------------------------------------------------------------------------------------------------
saturation=1.2 #for all outputs

gamma= 1.2 # for all outputs

blue= 0 red= 0 #manual color adjustment, when returning result3 or result4. Values can be positive or negative

black_level=0 white_level=235 output_black=0 output_white=255 # manual levels, when returning result4


#AUTO LEVELS PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------

autolev_low= 4 # limit of autolevels low output
autolev_high= 235 # limit of autolevels high output



#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=40 CTop=40 CRight=40 CBottom=40 #crop values after Depan and before final resizing

W=720 H=576 #final size after cropping

bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150


#STABILISING PARAMETERS, YOU REALY MUST USE RESULTS7 TO CHECK STABILISATION!
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=20
maxstabV=20 #maximum values for the stabiliser (in pixels) 20 is a good start value

est_left=40 est_top=40 est_right=40 est_bottom=40 #crop values for special Estimate clip

trust_value= 1.0 # scene change detection, higher= more sensitive
cutoff_value= 0.5 # no need to change this, but you can play with it and see what you get




#CLEANING PARAMETERS
#--------------------------------------------------------------------------------------------------------------

dirt_strenght=20 # set this lower for clean films.




# SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------

USM_sharp_ness= 28 USM_radi_us= 3 #this is the start value for the unsharpmask sharpening
#do not set radius less then 3
#the script will automatically add two other steps with lower radius







# END VARIABLES, BEGIN SCRIPT
#=================================================================================================================================


SetMemoryMax(800) #set this to 1/3 of the available memory


#LoadPlugin("plugins/Deflicker.dll")
#Loadplugin("plugins/Depan.dll")
#LoadPlugin("plugins/DepanEstimate.dll")
#Loadplugin("plugins/removegrain.dll")
#LoadPlugin("plugins/removedirt.dll")
#LoadPlugin("plugins/MVTools.dll")
#LoadPlugin("plugins/MVTools2.dll")
#Loadplugin("plugins/warpsharp.dll")
#LoadPlugin("plugins/autolevels_06.dll")
#LoadPlugin("plugins/Motion_06Dec05B.dll")
#Import("plugins/03_RemoveDirtMC.avs")




source= AviSource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
trimming= framecount(source)-trim_end
source1= trim(source,0,trimming)





#STABILIZING/CROPPING
#..........................................................................................................................................
stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)

mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)

WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)


#UNSHARPMASK AUTO_PARAMETERS
#-------------------------------------------------------------------------------------------------------------------------------------------

USM_sharp_ness1 = USM_sharp_ness
USM_sharp_ness2 = USM_sharp_ness+(USM_sharp_ness/2)
USM_sharp_ness3 = USM_sharp_ness*2

USM_radi_us1 = USM_radi_us
USM_radi_us2 = USM_radi_us-1
USM_radi_us3 = USM_radi_us2-1


#CLEANING/PRESHARPENING/RESIZING
#...........................................................................................................................................


noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation)




cleaned= RemoveDirtMC(noise_baseclip,dirt_strenght).unsharpmask(USM_sharp_ness1,USM_radi_us1,0).unsharpmask(USM_sharp_ness2,USM_radi_us2,0).Lanczos4Resize(W,H)



# FINAL SHARPENING
#.................................................................................................................................................



final_result= cleaned.unsharpmask(USM_sharp_ness3,USM_radi_us3,0)





#RESULT1: AUTOLEVELS,AUTOWHITE
#.................................................................................................................................................
result1= final_result.converttoRGB24().autolevels(output_low= autolev_low, output_high= autolev_high).converttoYV12().coloryuv(autowhite=true).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT2: MANUAL LEVELS, AUTOWHITE
#.................................................................................................................................................
result2= final_result.levels(black_level,1.0,white_level,0,255).coloryuv(autowhite=true).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)


#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#.................................................................................................................................................
result3= final_result.coloryuv(off_U=blue,off_V=red).converttoRGB24().autolevels(output_low= autolev_low, output_high= autolev_high).converttoYV12().BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#..................................................................................................................................................
result4= final_result.coloryuv(off_U=blue,off_V=red).levels(black_level,1.0,white_level,0,255).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5
#..................................................................................................................................................
result5= overlay(source1,greyscale(stab_reference),x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)




#PARAMETERS FOR THE COMPARISONS
#..................................................................................................................................................
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot





source4=Lanczos4Resize(source1,W2,H2).changeFPS(final_framerate)



#COMPARISONS: ORIGINAL VS RESULTS
#......................................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"result1: autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"result2: autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"result3: autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"result4: manual colors and levels correction",size=28,align=2))
resultS5= stackhorizontal(subtitle(result2,"result2: autowhite, manual levels",size=28,align=2),subtitle(result1,"result1: autowhite, autolevels",size=28,align=2))
resultS6= stackhorizontal(subtitle(result4,"result4: manual levels and color corrections",size=28,align=2),subtitle(result3,"result3: manual color corrections, autolevels",size=28,align=2))

#SPECIAL COMPARISON CLIP FOR TESTING THE STABILIZER
#.........................................................................................................................................................................
resultS7= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2),subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5)).converttoYUY2()



Eval(result)

manono
2nd April 2020, 01:29
The following sample export was "AVI" "PalDV" for 720x576.
You have to install a DV codec in order to be able to use AVISource. It probably wasn't the best idea to export as DV, but what's done is done. First, get and install the Cedocida DV Codec (https://www.videohelp.com/software/Cedocida-DV-Codec).

Then open your script with the AVISource line only in VDub in File->Open Video file. Something like this:

AviSource("Video.avi")
Return last

You can worry about the rest of the script after opening your video.

Stereodude
2nd April 2020, 03:36
You have to install a DV codec in order to be able to use AVISource. It probably wasn't the best idea to export as DV, but what's done is done. First, get and install the Cedocida DV Codec.

Then open your script with the AVISource line only in VDub in File->Open Video file. Something like this:

AviSource("Video.avi")
Return last

You can worry about the rest of the script after opening your video.
How do you know he has it in DV format? :confused:

Presumably he still has the JPEGs or whatever he captured with the camera and should start from there.

manono
2nd April 2020, 03:53
How do you know he has it in DV format? :confused:

Because he said after working on it in Premiere he exported as DV and posted the specs:

The stills that I have taken are 2400x1600 JPG's. I drop the folders (1000 each) into Premiere. Each folder becomes a clip. I assemble the film on the timeline from where I can crop, steady, colour correct, as necessary. I can then export in a variety of codecs and pixel sizes. The following sample export was "AVI" "PalDV" for 720x576.

[How do I post video....200kb is one frame?]

Video data:

Quote:
General
Complete name : F:\SampleAVI .avi
Format : AVI
Format/Info : Audio Video Interleave
Commercial name : DV
File size : 10.7 MiB
Duration : 2 s 960 ms
Overall bit rate mode : Constant
Overall bit rate : 30.4 Mb/s
Recorded date : 2020-04-01T21:27:35+01:00
Writing application : Adobe Premiere Pro 2020.0 (Windows)

Video
ID : 0
Format : DV
Codec ID : dvsd

Edit: I think I understand now. Not all that's being posted is showing up and because I'm a mod I can see it all. After I made my earlier post I came back later to check if there had been a reply and didn't see my post. I logged in and there it was. I removed my post and reposted and then you could see it. The same thing must be happening here because when I check this thread while logged out the post you don't see isn't there. I log in again and there's the complete (and very long) post. I'll post it again (if I can).

The stills that I have taken are 2400x1600 JPG's. I drop the folders (1000 each) into Premiere. Each folder becomes a clip. I assemble the film on the timeline from where I can crop, steady, colour correct, as necessary. I can then export in a variety of codecs and pixel sizes. The following sample export was "AVI" "PalDV" for 720x576.

[How do I post video....200kb is one frame?]

Video data:

Quote:
General
Complete name : F:\SampleAVI .avi
Format : AVI
Format/Info : Audio Video Interleave
Commercial name : DV
File size : 10.7 MiB
Duration : 2 s 960 ms
Overall bit rate mode : Constant
Overall bit rate : 30.4 Mb/s
Recorded date : 2020-04-01T21:27:35+01:00
Writing application : Adobe Premiere Pro 2020.0 (Windows)

Video
ID : 0
Format : DV
Codec ID : dvsd
Duration : 2 s 960 ms
Bit rate mode : Constant
Bit rate : 24.4 Mb/s
Encoded bit rate : 28.8 Mb/s
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 25.000 FPS
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Bottom Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 2.357
Time code of first frame : 00:06:07:24 / 00:06:07:24
Time code source : Adobe tc_A / Adobe tc_O
Stream size : 10.2 MiB (95%)

Audio
ID : 1
Format : PCM
Format settings : Little
Codec ID : 1
Duration : 2 s 960 ms
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 555 KiB (5%)
The above AVI is simply get things working. It is interlaced which I do not want but I was going to worry about the best input format when I had understood what the overall benefits were of using AVISynth.

The script is

Quote:
# 8mm film restoration script by videoFred.
# www.super-8.be

# info@super-8.be

# version 01.C with frame blending and cleaning but without degraining, for better render speed
# release date: june 20, 2012
#============================================================================================

# august 2010: added removerdirtMC() as suggested by John Meyer
# october 2010: auto sharpening parameters

# march 2011: new autolevels.dll by Jim Battle
# www.thebattles.net/video/autolevels.html

# june 2012: improved stabilising

#=============================================================================================

# cleaning, resizing, stabilizing, sharpening, auto-levels and auto-white balance.
#=============================================================================================




film= "F:\SampleAVI.AVI" # source clip, you must specify the full path here




#PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
result="resultS1" # specify the wanted output here

trim_begin=2 trim_end= 16 play_speed= 18 #trim frames and play speed (PAL: 16.6666 or 18.75)

final_framerate = 25 # final frame rate

frame_blend= 0.4 # the amount of frame blending


#COLOR AND LEVELS PARAMATERS
#----------------------------------------------------------------------------------------------------------------------------
saturation=1.2 #for all outputs

gamma= 1.2 # for all outputs

blue= 0 red= 0 #manual color adjustment, when returning result3 or result4. Values can be positive or negative

black_level=0 white_level=235 output_black=0 output_white=255 # manual levels, when returning result4


#AUTO LEVELS PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------

autolev_low= 4 # limit of autolevels low output
autolev_high= 235 # limit of autolevels high output



#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=40 CTop=40 CRight=40 CBottom=40 #crop values after Depan and before final resizing

W=720 H=576 #final size after cropping

bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150


#STABILISING PARAMETERS, YOU REALY MUST USE RESULTS7 TO CHECK STABILISATION!
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=20
maxstabV=20 #maximum values for the stabiliser (in pixels) 20 is a good start value

est_left=40 est_top=40 est_right=40 est_bottom=40 #crop values for special Estimate clip

trust_value= 1.0 # scene change detection, higher= more sensitive
cutoff_value= 0.5 # no need to change this, but you can play with it and see what you get




#CLEANING PARAMETERS
#--------------------------------------------------------------------------------------------------------------

dirt_strenght=20 # set this lower for clean films.




# SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------

USM_sharp_ness= 28 USM_radi_us= 3 #this is the start value for the unsharpmask sharpening
#do not set radius less then 3
#the script will automatically add two other steps with lower radius







# END VARIABLES, BEGIN SCRIPT
#=================================================================================================================================


SetMemoryMax(800) #set this to 1/3 of the available memory


#LoadPlugin("plugins/Deflicker.dll")
#Loadplugin("plugins/Depan.dll")
#LoadPlugin("plugins/DepanEstimate.dll")
#Loadplugin("plugins/removegrain.dll")
#LoadPlugin("plugins/removedirt.dll")
#LoadPlugin("plugins/MVTools.dll")
#LoadPlugin("plugins/MVTools2.dll")
#Loadplugin("plugins/warpsharp.dll")
#LoadPlugin("plugins/autolevels_06.dll")
#LoadPlugin("plugins/Motion_06Dec05B.dll")
#Import("plugins/03_RemoveDirtMC.avs")




source= AviSource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
trimming= framecount(source)-trim_end
source1= trim(source,0,trimming)





#STABILIZING/CROPPING
#..........................................................................................................................................
stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)

mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)

WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)


#UNSHARPMASK AUTO_PARAMETERS
#-------------------------------------------------------------------------------------------------------------------------------------------

USM_sharp_ness1 = USM_sharp_ness
USM_sharp_ness2 = USM_sharp_ness+(USM_sharp_ness/2)
USM_sharp_ness3 = USM_sharp_ness*2

USM_radi_us1 = USM_radi_us
USM_radi_us2 = USM_radi_us-1
USM_radi_us3 = USM_radi_us2-1


#CLEANING/PRESHARPENING/RESIZING
#...........................................................................................................................................


noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation)




cleaned= RemoveDirtMC(noise_baseclip,dirt_strenght).unsharpmask(USM_sharp_ness1,USM_radi_us1,0).unsharpmask(USM_sharp_ness2,USM_radi_us2,0).Lanczos4Resize(W,H)



# FINAL SHARPENING
#.................................................................................................................................................



final_result= cleaned.unsharpmask(USM_sharp_ness3,USM_radi_us3,0)





#RESULT1: AUTOLEVELS,AUTOWHITE
#.................................................................................................................................................
result1= final_result.converttoRGB24().autolevels(output_low= autolev_low, output_high= autolev_high).converttoYV12().coloryuv(autowhite=true).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT2: MANUAL LEVELS, AUTOWHITE
#.................................................................................................................................................
result2= final_result.levels(black_level,1.0,white_level,0,255).coloryuv(autowhite=true).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)


#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#.................................................................................................................................................
result3= final_result.coloryuv(off_U=blue,off_V=red).converttoRGB24().autolevels(output_low= autolev_low, output_high= autolev_high).converttoYV12().BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#..................................................................................................................................................
result4= final_result.coloryuv(off_U=blue,off_V=red).levels(black_level,1.0,white_level,0,255).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5
#..................................................................................................................................................
result5= overlay(source1,greyscale(stab_reference),x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)




#PARAMETERS FOR THE COMPARISONS
#..................................................................................................................................................
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot





source4=Lanczos4Resize(source1,W2,H2).changeFPS(final_framerate)



#COMPARISONS: ORIGINAL VS RESULTS
#......................................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"result1: autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"result2: autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"result3: autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"result4: manual colors and levels correction",size=28,align=2))
resultS5= stackhorizontal(subtitle(result2,"result2: autowhite, manual levels",size=28,align=2),subtitle(result1,"result1: autowhite, autolevels",size=28,align=2))
resultS6= stackhorizontal(subtitle(result4,"result4: manual levels and color corrections",size=28,align=2),subtitle(result3,"result3: manual color corrections, autolevels",size=28,align=2))

#SPECIAL COMPARISON CLIP FOR TESTING THE STABILIZER
#.........................................................................................................................................................................
resultS7= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2),subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5)).converttoYUY2()



Eval(result)

MartinS
2nd April 2020, 09:22
manono
You have to install a DV codec in order to be able to use AVISource. It probably wasn't the best idea to export as DV, but what's done is done. First, get and install the Cedocida DV Codec.

stereodude
How do you know he has it in DV format?

Presumably he still has the JPEGs or whatever he captured with the camera and should start from there.


Just to clarify:

I captured just a few reels of cine to prove the system. Initially with the DSLR but I am considering moving to a machine vision camera (Flir Blackfly maybe).

I DO have the jpg stills and only encoded them into the AVI as the most simple introduction to the AVISynth/VirtualDub/VideoFred world (I would not touch AVI otherwise).

The AVI codec was just the standard Adobe installed one.

First, get and install the Cedocida DV Codec.

Then open your script with the AVISource line only in VDub in File->Open Video file. Something like this:

AviSource("Video.avi")
Return last

I shall do this and report back.

PS
Many sample clips open in VirtualDub but none open via a AVISynth script.

Does VirtualDub use Win 10 system codecs, whilst AVISynth uses it's own? It seems so.

MartinS
2nd April 2020, 12:37
OK, slight progress!

I installed Cedocida DV Codec and with Premiere produced a sample "Video1".

With the script:

AviSource("Video1.avi")
Return last

sample "Video1" opened in VirtualDub.

But

adding "Video1" to VideoFred's script gave me this same error as previous:

https://forum.doom9.org/attachment.php?attachmentid=17260&stc=1&d=1585827064


Now what do I do?

Stereodude
2nd April 2020, 18:12
The stills that I have taken are 2400x1600 JPG's. I drop the folders (1000 each) into Premiere. Each folder becomes a clip. I assemble the film on the timeline from where I can crop, steady, colour correct, as necessary. I can then export in a variety of codecs and pixel sizes. The following sample export was "AVI" "PalDV" for 720x576.
Well, my first question is why you are exporting in such a low resolution and in such an old format? Is there really that little detail in your film source?

Edit: I haven't used John's script but you can open an image sequence in Avisynth so the initial work in Premiere may be unnecessary.

Stereodude
2nd April 2020, 18:19
Because he said after working on it in Premiere he exported as DV and posted the specs:

Edit: I think I understand now. Not all that's being posted is showing up and because I'm a mod I can see it all. After I made my earlier post I came back later to check if there had been a reply and didn't see my post. I logged in and there it was. I removed my post and reposted and then you could see it. The same thing must be happening here because when I check this thread while logged out the post you don't see isn't there.
Yes, I couldn't see the post until today.

MartinS
2nd April 2020, 20:56
Stereodude
Well, my first question is why you are exporting in such a low resolution and in such an old format? Is there really that little detail in your film source?

Edit: I haven't used John's script but you can open an image sequence in Avisynth so the initial work in Premiere may be unnecessary.

I submitted a post before #9 which hasn't appeared. It explained that I only exported the DV AVI to prove-out the AVISynth/DirtualDub/VideoFred system.

I don't use AVI and especially DV (most of my film-making is 4K-8K). I am trying to keep it simple until I get it working. Then I can re-assess the overall workflow.


My "Video1" AVI file at least works with the script:

AviSource("Video1.avi")
Return last


I simply want help and advice on how to get VideoFred's standard script working with this "Video1" AVI file.

poisondeathray
2nd April 2020, 21:15
In the script, the line that says this

film= "F:\SampleAVI.AVI" # source clip, you must specify the full path here


Change the path and filename to what you actually have, save it

MartinS
3rd April 2020, 08:34
These pix are of a) the simple script that works and b) VideoFreds that does not.

Both with the same video file and pathname.



film= "F:\Video1.avi" # source clip, you must specify the full path here


#PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
result="resultS1" # specify the wanted output here

trim_begin=2 trim_end= 16 play_speed= 18 #trim frames and play speed (PAL: 16.6666 or 18.75)

final_framerate = 25 # final frame rate

frame_blend= 0.4 # the amount of frame blending


#COLOR AND LEVELS PARAMATERS
#----------------------------------------------------------------------------------------------------------------------------
saturation=1.2 #for all outputs

gamma= 1.2 # for all outputs

blue= 0 red= 0 #manual color adjustment, when returning result3 or result4. Values can be positive or negative

black_level=0 white_level=235 output_black=0 output_white=255 # manual levels, when returning result4


#AUTO LEVELS PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------

autolev_low= 4 # limit of autolevels low output
autolev_high= 235 # limit of autolevels high output



#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=40 CTop=40 CRight=40 CBottom=40 #crop values after Depan and before final resizing

W=720 H=576 #final size after cropping

bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150


#STABILISING PARAMETERS, YOU REALY MUST USE RESULTS7 TO CHECK STABILISATION!
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=20
maxstabV=20 #maximum values for the stabiliser (in pixels) 20 is a good start value

est_left=40 est_top=40 est_right=40 est_bottom=40 #crop values for special Estimate clip

trust_value= 1.0 # scene change detection, higher= more sensitive
cutoff_value= 0.5 # no need to change this, but you can play with it and see what you get




#CLEANING PARAMETERS
#--------------------------------------------------------------------------------------------------------------

dirt_strenght=20 # set this lower for clean films.




# SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------

USM_sharp_ness= 28 USM_radi_us= 3 #this is the start value for the unsharpmask sharpening
#do not set radius less then 3
#the script will automatically add two other steps with lower radius







# END VARIABLES, BEGIN SCRIPT
#=================================================================================================================================


SetMemoryMax(800) #set this to 1/3 of the available memory


#LoadPlugin("plugins/Deflicker.dll")
#Loadplugin("plugins/Depan.dll")
#LoadPlugin("plugins/DepanEstimate.dll")
#Loadplugin("plugins/removegrain.dll")
#LoadPlugin("plugins/removedirt.dll")
#LoadPlugin("plugins/MVTools.dll")
#LoadPlugin("plugins/MVTools2.dll")
#Loadplugin("plugins/warpsharp.dll")
#LoadPlugin("plugins/autolevels_06.dll")
#LoadPlugin("plugins/Motion_06Dec05B.dll")
#Import("plugins/03_RemoveDirtMC.avs")




source= AviSource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
trimming= framecount(source)-trim_end
source1= trim(source,0,trimming)





#STABILIZING/CROPPING
#..........................................................................................................................................
stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)

mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)

WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)


#UNSHARPMASK AUTO_PARAMETERS
#-------------------------------------------------------------------------------------------------------------------------------------------

USM_sharp_ness1 = USM_sharp_ness
USM_sharp_ness2 = USM_sharp_ness+(USM_sharp_ness/2)
USM_sharp_ness3 = USM_sharp_ness*2

USM_radi_us1 = USM_radi_us
USM_radi_us2 = USM_radi_us-1
USM_radi_us3 = USM_radi_us2-1


#CLEANING/PRESHARPENING/RESIZING
#...........................................................................................................................................


noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation)




cleaned= RemoveDirtMC(noise_baseclip,dirt_strenght).unsharpmask(USM_sharp_ness1,USM_radi_us1,0).unsharpmask(USM_sharp_ness2,USM_radi_us2,0).Lanczos4Resize(W,H)



# FINAL SHARPENING
#.................................................................................................................................................



final_result= cleaned.unsharpmask(USM_sharp_ness3,USM_radi_us3,0)





#RESULT1: AUTOLEVELS,AUTOWHITE
#.................................................................................................................................................
result1= final_result.converttoRGB24().autolevels(output_low= autolev_low, output_high= autolev_high).converttoYV12().coloryuv(autowhite=true).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT2: MANUAL LEVELS, AUTOWHITE
#.................................................................................................................................................
result2= final_result.levels(black_level,1.0,white_level,0,255).coloryuv(autowhite=true).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)


#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#.................................................................................................................................................
result3= final_result.coloryuv(off_U=blue,off_V=red).converttoRGB24().autolevels(output_low= autolev_low, output_high= autolev_high).converttoYV12().BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#..................................................................................................................................................
result4= final_result.coloryuv(off_U=blue,off_V=red).levels(black_level,1.0,white_level,0,255).BlendFPS(final_framerate, frame_blend).addborders(bord_left, bord_top, bord_right, bord_bot)

#RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5
#..................................................................................................................................................
result5= overlay(source1,greyscale(stab_reference),x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)




#PARAMETERS FOR THE COMPARISONS
#..................................................................................................................................................
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot





source4=Lanczos4Resize(source1,W2,H2).changeFPS(final_framerate)



#COMPARISONS: ORIGINAL VS RESULTS
#......................................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"result1: autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"result2: autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"result3: autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"result4: manual colors and levels correction",size=28,align=2))
resultS5= stackhorizontal(subtitle(result2,"result2: autowhite, manual levels",size=28,align=2),subtitle(result1,"result1: autowhite, autolevels",size=28,align=2))
resultS6= stackhorizontal(subtitle(result4,"result4: manual levels and color corrections",size=28,align=2),subtitle(result3,"result3: manual color corrections, autolevels",size=28,align=2))

#SPECIAL COMPARISON CLIP FOR TESTING THE STABILIZER
#.........................................................................................................................................................................
resultS7= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2),subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5)).converttoYUY2()



Eval(result)

johnmeyer
3rd April 2020, 15:30
The usual troubleshooting method for situations like this is to return the intermediate variables.

I'd start by commenting out the Eval(result) line and replacing it with Return(film). That effectively removes everything in between those statements and should give you the equivalent of your two-line test script. If that works, change the line to Return(source).

Keep going, using various intermediate variables. To speed it up, implement a binary search, which means you would use one of the last variables (final_result) as the next step, and then one of the middle variables, etc.

If the initial test works, then I suspect the problem is probably with the series of "result" lines. Fred changed those a lot in the decade since I produced and posted my versions of his original work.

MartinS
4th April 2020, 12:47
johnmayer
The usual troubleshooting method for situations like this is to return the intermediate variables.

I'd start by commenting out the Eval(result) line and replacing it with Return(film). That effectively removes everything in between those statements and should give you the equivalent of your two-line test script. If that works, change the line to Return(source).

Keep going, using various intermediate variables. To speed it up, implement a binary search, which means you would use one of the last variables (final_result) as the next step, and then one of the middle variables, etc.

If the initial test works, then I suspect the problem is probably with the series of "result" lines. Fred changed those a lot in the decade since I produced and posted my versions of his original work.

OK....partway through doing what you suggested above, I realised that "RemoveDirtMC" was in RED and it was important:o.

Questions

** To what file does the script statement RemoveDirtMC refer and where should the plugin file be found on the HDD, in AVISYnth plugins or anywhere?

** When "this" is in it's correct volume location, do I need to "import" the path into the script, or does AVISynth know where it is?

** Or am I barking up the wrong tree?

StainlessS
4th April 2020, 13:01
** To what file does RemoveDirtMC refer and where should it be found?
On Wiki:- http://avisynth.nl/index.php/External_filters#Spatio-Temporal_Denoisers

Put it in your plugins directory, or Import() it.

johnmeyer
4th April 2020, 15:30
I think VideoFred put the functions in a different file, and his main script doesn't include those functions. You'll need to find them, download them, and then import them into your script.

When I created my own version of VideoFred's script (which I posted in his three main threads on film restoring), I kept all the functions in the main script, so I could avoid having different versions of each function floating around.

Here is the RemoveDirt function I use. It calls RemoveDirtMC. My code includes two different versions of RemoveDirtMC. I created the one that is active in order to improve both quality and speed by doing the estimation in multiple steps. "RemoveDirtMC_old" is the original version which you will find in dozens of posts in this forum. You are welcome to use that instead.

You can just put this code at the end of your script. I always put functions at the end of the script rather than the beginning, but everyone has their own style of script writing.

#REMOVE DIRT FUNCTION
#......................................................................................................................................................................
function RemoveDirt(clip input, int "limit", bool "_grey")
{
clensed=input.Clense(grey=_grey, cache=4)
alt=input.RemoveGrain(2)
return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)

# Alternative settings
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=true)
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=false)
}

function RemoveDirtMC(clip,int "limit", bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)

# Alternative way to do pre-filtering.
# prefiltered = fft3dfilter(clip,sigma=1,sigma2=2,sigma3=3,sigma4=5,bw=64,bh=64)

prefiltered = RemoveGrain(clip,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)

super=MSuper(clip, hpad=32, vpad=32,pel=2)

bvec = MAnalyse(superfilt,isb=true, blksize=16, overlap=2,delta=1, truemotion=true)
fvec = MAnalyse(superfilt,isb=false, blksize=16, overlap=2,delta=1, truemotion=true)

# Increase thSAD if moving objects are being removed
bvec_re = Mrecalculate(super,bvec,blksize=8, overlap=0,thSAD=100)
fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=100)

backw = MFlow(clip,super,bvec_re)
forw = MFlow(clip,super,fvec_re)

clp=interleave(forw,clip,backw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}

#This function is the previous way to do motion estimation. It is slower and not as accurate.
function RemoveDirtMC_old(clip,int limit, bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)
i=MSuper(clip,pel=2)
fvec = MAnalyse(i,isb=false, blksize=16, delta=1, truemotion=true)
bvec = MAnalyse(i,isb=true, blksize=16, delta=1, truemotion=true)
backw = MFlow(clip,i,bvec)
forw = MFlow(clip,i,fvec)
clp=interleave(forw,clip,backw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}

MartinS
6th April 2020, 10:58
Well blow me down!

I have found the source of my (initial) troubles.

I found this thread

https://forum.videohelp.com/threads/370771-Cannot-open-AVS-file-in-VirtualDub-1-10-4

and tried removing "FFInputDriver.vdplugin" from VDub plugins, and ALL of VideoFred's scripts now open in VirtualDub:D

I am amazed how much better the sample cine film looks. In many ways it is much more simple and better than Premiere CC.......especially the cleaning. in the sample the cracks in the emulsion are still visible. I am going to experiment with wet-gate cine capture.

So now I know that things work I can study how the scripts operate and how they can benefit my current or revised workflow. I am considering an MV camera, possibly a Flir Blackfly USB with my modified arduino controlled projector.

Thank you all for your help......but I might be back.

johnmeyer
6th April 2020, 15:52
Pay special attention to the sharpening settings. VideoFred's scripts are brilliant, but I found that his settings were oriented towards pristine film, and that for older film the sharpening often introduced artifacts. The increase in clarity, when it works, is amazing, but just make sure to pay close attention to problems.

I posted about this problem in the very first post that I made in VideoFred's initial, long thread about his restoration script:

https://forum.doom9.org/showthread.php?p=1405197#post1405197

MartinS
6th April 2020, 22:54
Yup, will do John.....ta