Log in

View Full Version : using qtgmc in ffmpeg


agni451
10th November 2012, 15:26
Is there any way to use qtgmc instead of the built-in yadif filter? My video files are mpeg2, and that should be (http://msdn.microsoft.com/en-us/library/windows/desktop/dd407173%28v=vs.85%29.aspx) Directshow compatible. My avs ("A.avs") looks like this:


SetMemoryMax(1600)
SetMTMode(3,8)


video=DirectShowSource("S:\TEST5\A.m2v")


SetMTMode(2)
video=video.AssumeTFF()
video=video.QTGMC(Preset="Slow")
video=video.SelectEven()


video=video.Lanczos4Resize(1920,1080)


video2=BlankClip(video,length=102)


return(video+video2)
and then the ffmpeg commandline looks like:


ffmpeg -v verbose -y -i "S:\TEST5\A.avs" -c:v libx264 -preset slow -b:v 7550k -r:v 30000/1001 -x264opts open-gop:b-pyramid=strict:slices=4:qpmax=51:nr=250 -f rawvideo "S:\TEST5\A.264"
Unfortunately all I get is "AFIFileOpen failed with error -2147221164. S:\TEST5\A.avs: Operation not permitted". Even when I just try to load the video in avisynth, no filters or anything:


DirectshowSource("S:\TEST5\A.m2v")
I get the same message. I am currently using the absolute latest version of ffmpeg (N-46469-gc995644 (Nov 5 2012)) with --enable-avisynth and --enable-libx264 and avisynth 2.58. I really need to be able to get the quality of qtgmc here, so how do I do this?

sneaker_ger
10th November 2012, 16:09
Are you trying to use 64 bit ffmpeg with 32 bit AviSynth?
Use a pipe or 32 bit ffmpeg.

agni451
11th November 2012, 00:55
Are you trying to use 64 bit ffmpeg with 32 bit AviSynth?
Use a pipe or 32 bit ffmpeg.

yeah... so I was using 64-bit ffmpeg with 32-bit avisynth. So stupid. Now I have 32-bit ffmpeg, and when I try to open the single line avs script, it for some reason reads the video as 165x97 @ 33.33fps, when it's 1920x1080 at 29.97fps, and says "not divisible by 2" as well as "error while opening encoder for ouput stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height"

I changed the longer avs script to what I'm used to- using DGIndex as a frameserver:


LoadPlugin("C:\Program Files (x86)\DGMPGDec\DGDecode.dll")
SetMemoryMax(1600)
SetMTMode(3,8)

video=MPEG2Source("S:\TEST5\A.d2v")

SetMTMode(2)
video=video.AssumeTFF()
video=video.QTGMC(Preset="Slow")
video=video.SelectEven()

video=video.Lanczos4Resize(1920,1080)

video2=BlankClip(video,length=102)

return(video+video2)


It reads it in correctly in terms of dimensions and fps, but it still gives that "error while opening encoder..." thing and then stops. Now what am I doing wrong?

EDIT: It is also giving the error "x264 [error]: malloc of size 8294400 failed"

sneaker_ger
11th November 2012, 02:14
You may be running out of memory, try switching to a pipe:
avs2pipemod (http://www.mediafire.com/download.php?33fpx9bibdk8y4j) -y4mp script.avs | ffmpeg -f yuv4mpegpipe -i - -c:v libx264 -preset slow -b:v 7550k -r:v 30000/1001 -x264opts open-gop:b-pyramid=strict:slices=4:qpmax=51:nr=250 -f rawvideo "S:\TEST5\A.264"

You can also keep using ffmpeg 64 bit this way. (Faster and can use more memory.)

Chikuzen
14th November 2012, 16:25
Since only 8 MB of memory is not allocatable, it will crash even if divides process.
save number of threads from 8 to 4 or less.

sneaker_ger
14th November 2012, 22:30
Since only 8 MB of memory is not allocatable, it will crash even if divides process.
save number of threads from 8 to 4 or less.

What is causing the problem and why can it be solved by reducing the number of threads?

agni451
16th November 2012, 13:31
You may be running out of memory, try switching to a pipe:
avs2pipemod (http://www.mediafire.com/download.php?33fpx9bibdk8y4j) -y4mp script.avs | ffmpeg -f yuv4mpegpipe -i - -c:v libx264 -preset slow -b:v 7550k -r:v 30000/1001 -x264opts open-gop:b-pyramid=strict:slices=4:qpmax=51:nr=250 -f rawvideo "S:\TEST5\A.264"

You can also keep using ffmpeg 64 bit this way. (Faster and can use more memory.)

This works very well, thanks! I have another question though- what if I were to want to do a 2-pass encode using avisynth and have the .stats file in the working directory? How would that work with the avs2pipemod?

sneaker_ger
16th November 2012, 19:28
I don't quite understand. Why wouldn't it work?

You can do a short test if you just encode 1000 frames. (add "Trim(0,999)" to the last line of your script)