I am trying to encode a video from Avisynth to FFMPEG but the video hangs each time, whether I encode directly to mp4 or to
HUFFYUV. I have tried increasing the buffer size but the video still hangs, at a random frame of the video each time. One time it was frame 150, next time it worked until frame 44,000.
To mp4:
Code:
ffmpeg -i input.avs -c:a mp3 -qscale:a 0 -c:v libx264 -preset slower -crf 18 -profile:v high -pix_fmt yuv420p -tune grain output.mp4
To
huffyuv:
Code:
ffmpeg -i input.avs -acodec copy -c:v huffyuv -bufsize 500000k output.avi
In the past, if I managed to get it to the Huffyuv, converting it to mp4 proceeded without issue. I was also able to encode this script successfully using a similar script that did not upscale to HD, but most of my scripts no matter the functions used have this hanging issue with FFMPEG.
Here is my Avisynth script:
Code:
Import("C:\Program Files (x86)\AviSynth+\plugins64+\ReplaceFramesMC2_AD.avsi")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\Deemphasize.avs")
video = AVISource("D:\VW011_before_avisynth_YT_progressive_version.avi")
last = video.ConvertToYV16(matrix="Rec709",interlaced=True)
AssumeBFF().nnedi3(field=-2)
ReplaceFramesMC2_AD(last, 13106,1)
ReplaceFramesMC2_AD(last, 13108,7)
ReplaceFramesMC2_AD(last, 13124,1)
ReplaceFramesMC2_AD(last, 13126,1)
ReplaceFramesMC2_AD(last, 13128,27)
ReplaceFramesMC2_AD(last, 26980,5)
#removes strip on left side
no_stripe =last.DeStripe(2,2,80).Crop(0,0,120,0)
last = Layer(last, no_stripe, op="add")
#center image part 1 to save processing time (no need to apply filters to black areas)
Crop(8,0,-4,-8)
#removes some dropout lines
RemoveDirtSMC(55).RemoveDirtSMC(25).RemoveDirtSMC(55)
FFT3DFilter(sigma=2, bt=5)
SpotLess(RadT=3, ThSAD=5000, Blksz=16)
smoothuv2(radius=3,interlaced=0)
AssumeBFF().SeparateFields().SelectEvery(4,0,3).Weave()
first = last.Trim(0,20472)
#avoids filtering first or ending, will add back at end
second = last.trim(20472,23678)
ending = last.trim(23678,0)
#further filtering of drop outs on dave street segement
second = second.AssumeBFF().nnedi3(field=-2)
second = second.SpotLess(RadT=3, ThSAD=4000, Blksz=16)
second = second.AssumeBFF().SeparateFields().SelectEvery(4,0,3).Weave()
#____________________
final = first ++ second ++ ending
final = final.AssumeBFF().nnedi3(field=-2)
#add back border cropped earlier
final = final.AddBorders(2,0,10,8)
final = final.AssumeBFF().SeparateFields().SelectEvery(4,0,3).Weave()
#deinterlace for YT, remove combing
final = final.QTGMC( Preset="fast", EZKeepGrain=1.0, NoisePreset="Faster", NoiseProcess=0)
final = final.VInverse2()
#upscale to 1080 then add grain
final = final.nnedi3_rpow2(4, cshift="Spline64Resize", fwidth=1440, fheight=1080)
final = final.AddgrainC(var=10)
#Adds Segue
blackVideo = BlankClip(clip=final,length=100)
Clip1 = final.Trim(0,22928)
Clip2 = final.Trim(22928, 0)
editVideo = Clip1 ++ blackVideo ++ Clip2
editVideo = editVideo.Subtitle("Part Two", lsp=10, align = 5, text_color = color_white, size = 120,first_frame = 22929, last_frame=23144)
return editVideo
Any help is appreciated, as I don't know what else to do.
Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz. 16 GM RAM