Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th November 2019, 09:52   #1  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 27
QTinput error in output with Avisynth+

Hi,

Can someone advise me why QTinput doesn't seem to work with Avisynth+, when it was working fine with Avisynth?

This is how it outputs now in Avisynth+



Just a simple script

qtinput("D:\Video.mov", audio=1)
ConvertAudioTo16bit()
converttoyv12()
QTGMC(Preset="Slow", sharpness=1.2)
selecteven()


If I use ffms2, directshowsource and so on, they all display and output just fine. Any feedback would be appreciated. Thank you.
astronob is offline   Reply With Quote
Old 13th November 2019, 15:17   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,266
Well firstly, QTSource is quite old (version I have is 2006, on Wiki latest v0.1.4 2011):- http://avisynth.nl/index.php/QTSource

I would suggest LSmashVideoSource() as better option for ISO containers, more recent and specifically for ISO containers [does not need to index file, and does not need Quicktime].
Code:
Function IsISOFileName(String s) { # req RT_Stats
        s=RT_GetFileExtension(s) Return(s==".mov"||s==".mp4"||s==".m4v"||s==".3gp"||s==".3g2"||s==".mj2"||s==".dvb"||s==".dcf"||s==".m21")
}
Best not to obscure your problem with extraneous stuff, ie qtinput("D:\Video.mov") would have been enough.
Maybe add an Info, just so it can be seen what it was decoded to, ie
Code:
qtinput("D:\Video.mov")
info
And what does MediaInfo produce for the clip, particularly, what bit depth, width, colorspace,
the green stuff at the bottom, and diagonal slanting might suggest problem with width/rowsize/pitch.

Have you actually tried with this clip in Avs standard ?

Also, have you tried any other settings, eg, color, mode, raw, info, vfw

Function Prototype [prototype from WIKI says "file" is optional(quoted), I doubt that is the case]
Code:
QTInput (string "file", int "color", int "quality", int "audio", int "mode", string "raw", int "info", int "dither", string "vfw", float "gamma", float "vfrFPS")
EDIT: If the clip aint too big, maybe you could post it somewhere.

EDIT: Also, which version Quicktime you got installed ?
EDIT: And which version QTSource.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 13th November 2019 at 15:44.
StainlessS is offline   Reply With Quote
Old 13th November 2019, 23:46   #3  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,996
Quote:
Originally Posted by astronob View Post
Hi,

Can someone advise me why QTinput doesn't seem to work with Avisynth+, when it was working fine with Avisynth?

This is how it outputs now in Avisynth+
I haven't had a chance to play with the sample you sent me yet, but I suspect 10 bit is an issue for QTSource.

Code:
Video
ID                                       : 1
Format                                   : YUV
Codec ID                                 : v210
Codec ID/Hint                            : AJA Video Systems Xena
Duration                                 : 13 s 280 ms
Bit rate mode                            : Constant
Bit rate                                 : 221 Mb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 5:4
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 10 bits
Scan type                                : Interlaced
Scan type, store method                  : Interleaved fields
Scan order                               : Top Field First
Compression mode                         : Lossless
Bits/(Pixel*Frame)                       : 21.333
Stream size                              : 350 MiB (99%)
Language                                 : English
Encoded date                             : UTC 2019-10-24 09:55:33
Tagged date                              : UTC 2019-11-13 06:32:06
Color primaries                          : BT.601 PAL
Matrix coefficients                      : BT.601
I hadn't considered that possibility until I saw the sample because you said it decodes the video fine when you're using Avisynth 2.6. Someone with more smarts than me will have to explain why that happens, because I don't understand it myself. I assume AvsPmod can display bit depths greater than 8 bit? I haven't had a chance to test that yet as I don't use AvsPmod much myself and I almost always work with 8 bit sources. Depending on your target playback device, you might have to convert it to 8 bit for encoding anyway. You're using mpeg2 encoding again for that one?

Last edited by hello_hello; 13th November 2019 at 23:51.
hello_hello is offline   Reply With Quote
Old 14th November 2019, 02:22   #4  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,084
If it's not the bit depth, it may be because AviSynth+ processes YUV 4:2:2 as planar (YV16) internally, not as YUY2, and that could be screwing with something in the pipeline. The doc page on the Wiki says it uses one of RGB32, RGB24, or YUY2 (owing to the fact it's a 2.5 plugin, not a 2.6 plugin). So no planar YUV.

I wouldn't bother using QTSource unless it's a format libavcodec can't handle, but if you're deadset on it, try setting color=0 or color=1 to force RGB24 or RGB32 output rather than YUY2. Also, raw="v210" may or may not help.

Knowing that it's using 10bit, though, I absolutely would not use plugins that are restricted to 8bit output (like QTSource). Don't dither if you don't have to.
qyot27 is offline   Reply With Quote
Old 14th November 2019, 10:57   #5  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 27
Well, adding color=0 and color=1 both give me a picture with Qtinput, but color=0 output is noticeably darker than color=1 (RGB24, vs RGB32), but is closer to the source color. Here is the info from using Qtinput in avisynth+. As mentioned in another thread in doom9, mode=4 gives me very similar, but not quite identical color. On the source, the whites are a little brighter, but I compared using qtinput with mode=0, color=4 (or color=0, both produce identical output) and straight ffms2 to input the video, and the output looks the same to me. It's a shame Qtinput hasn't been further developed to allow the input of 10bit and greater video bit depth. Perhaps if we all raised a petition we could persuade tateu to develop it a bit more. :-P



Here is the small sample video I'm using (the file will stay up for 30 days before it's deleted.

https://ufile.io/zazzgey7

It's a VHS rip. I was basically trying to clean the grain/noise from the video while preserving the best detail, by running some filters on it in an avisynth script. I know it's always a compromise, remove more grain, lose more detail etc. I've tried the inbuilt filter of QTGMC (EZdenoise), I've tried temporaldegrain, temporaldegrain2 and MCTD. I liked the output of MCTD, but some detail was lost on "VeryHigh" settings, plus it's crazy sloooow, like 1.5 hours to encode a 3.5 minute video. The others I can get faster output. I ended up installing Avisynth+, which was where the input error for Qtinput started, which worked fine in Avisynth 2.6. Nevertheless, mode=0, color=4 seems to allow input now for Qtinput. I would ask, those with more experience in scripting, if you want to try your hand on improving the output from that small sample, what script could people suggest to clean up that grain while still delivering a detailed picture? And doing it in a reasonable time if possible. The VHS player delivers pretty good detail, and almost no scan line on the bottom, so I don't have to crop the video, but it does output a bit more grain in the outputted video than other VHS players I've tried. Anyway, any suggestions would be most welcome, as my experience in this area is limited. Thanks.

Last edited by astronob; 14th November 2019 at 11:15.
astronob is offline   Reply With Quote
Old 14th November 2019, 12:48   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,266
Quote:
Perhaps if we all raised a petition we could persuade tateu to develop it a bit more. :-P
He aint been around since 2013:- https://forum.doom9.org/member.php?u=4847

I did a failed download of your sample, I'll try again when better connection.

Code:
vFN="D:\sheena-easton-machinery-small-sample.mov"
c=LSMASHVideoSource(vFN) 
AudioDubEx(c,LSMASHAudioSource(vFN))
info
Try above, QTSource is rarely used by anybody.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 14th November 2019 at 13:05.
StainlessS is offline   Reply With Quote
Old 14th November 2019, 18:54   #7  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,084
Quote:
Originally Posted by astronob View Post
Well, adding color=0 and color=1 both give me a picture with Qtinput, but color=0 output is noticeably darker than color=1 (RGB24, vs RGB32), but is closer to the source color. Here is the info from using Qtinput in avisynth+. As mentioned in another thread in doom9, mode=4 gives me very similar, but not quite identical color. On the source, the whites are a little brighter, but I compared using qtinput with mode=0, color=4 (or color=0, both produce identical output) and straight ffms2 to input the video, and the output looks the same to me. It's a shame Qtinput hasn't been further developed to allow the input of 10bit and greater video bit depth. Perhaps if we all raised a petition we could persuade tateu to develop it a bit more. :-P
color=4 doesn't exist. QTinput's color= parameter only has values up to 2; clearly, if you use something >2, it just forces it back to 0.

Converting to RGB from a YUV source is going to entail things like full vs. limited range, which QTinput (or Quicktime 7 on Windows, which is itself deprecated, unsupported by Apple, and hasn't gotten security updates in years) is probably not handling, or not handling correctly. There is also the fairly well-known "Quicktime gamma bug" that messes with full vs. limited range when decoding H.264. Who knows, maybe other formats like uncompressed v210 are included in that. And if you're trying to resize up to 720p or something, then the conversion between BT.601 and BT.709 is going to come into play somewhere in this too. There's lots of places subtly wrong color conversions can occur.

And not knowing anything about how QT7 handled >8bit I/O, I can't say whether that's something that has latent color conversion bugs (or they might be considered "features") Apple never fixed before abandoning it.

At least by using FFMS2 or LSMASH, you're not limited to 32bit - both plugins can be used under 64-bit AviSynth+, and you're dealing with the original YUV422P10 content, so any necessary color conversions can be handled by internal filters or external plugins outside the source filter that can be counted on to be correct. There's also the option of using AviSynth+'s multithreading capabilities to speed up the processing filters (FFMS2 and LSMASH use libavcodec's internal multithreading anyway, but being source filters, have to be used in MT_MODE_SERIALIZED, which might cause a bottleneck).
qyot27 is offline   Reply With Quote
Old 15th November 2019, 00:18   #8  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 27
Hi, if people have difficulty with that link, here is an alternative mediafire link.

http://www.mediafire.com/?i13zesa05u3sq10

Here is the strange looking output if I use your script StainlessS. An adjustment to the script to get the correct output would be nice. :-) In addition, if people could suggest a nice script I could try to clean up the grain from the video while preserving as much detail as possible would be appreciated, as my knowledge in these matters is limited. Thanks.

astronob is offline   Reply With Quote
Old 15th November 2019, 01:42   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,266
Maybe try force 10 bit 422 (planar 10 bit equiv to YUY2)

Code:
vFN="D:\sheena-easton-machinery-small-sample.mov"
c=LSMASHVideoSource(vFN,format="YUV422P10")              # or "YUV420P10" (10 bit YV12)
AudioDubEx(c,LSMASHAudioSource(vFN))
info
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 15th November 2019, 02:36   #10  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,084
Update your version of LSMASHSource.dll
(although it doesn't like something about the audio, maybe the fact it's uncompressed? LwLibavAudioSource handles it, but will generate an index)
qyot27 is offline   Reply With Quote
Old 15th November 2019, 04:51   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,266
My version LSmash produced rubbish too, so updated to qyot27 first dll in list, and works fine, no audio probs that I could hear (only checked on headphones).

Try something like this

Code:
# Seems to be Progressive on viewing SeparateFields, ie dont need deinterlacing

vFN="D:\WORK\Sheena Easton machinery small sample.mov"
c=LSMASHVideoSource(vFN) #,format="YUV422P10")              # or "YUV420P10" (10 bit YV12)
a=LSMASHAudioSource(vFN)
#a=LwLibavAudioSource(vFN)                                  # LSMASHAudioSource() seem to work ok for me
AudioDubEx(c,a)
# return info
C1=QTGMC(Preset="Slow", sharpness=1.2).selecteven()         # Req QTGMC v3.363s and smdegrain v3.1.2.104s
C2=McDegrainSharp(frames=3)                                 # 1->3, req McDegrainSharp:- https://forum.doom9.org/showthread.php?p=1737045#post1737045
StackHorizontal(C1,C2)
My preference is the McDegrainSharp one on right [click twice for full size] McDegrainSharp my goto filter for almost every clip.

You can change frames to 1 or 2 if too much noise removed by McDegrainSharp. [but Sheena always had a kinda shiny sheen]

EDIT: Nasty 'glue' marks before/after scene change.

EDIT: QTGMC has some switch to just denoise, and not deinterlace, no idea what it is though [I dont use it that often].

EDIT: Processed as below script available as Sheena.mp4 ~3.5MB @SendSpace in my sig below, available for 30 days [could have benefitted from contrast adjustment]
Code:
vFN="D:\WORK\Sheena Easton machinery small sample.mov"
c=LSMASHVideoSource(vFN)
a=LSMASHAudioSource(vFN)
AudioDubEx(c,a)
McDegrainSharp(frames=3)
Crop(10,0,-14,-0)
# for MeGUI 10 Bit
RT_signalDar2(4,3)
ConvertBits(16)
ConvertToYUV420()
Return last
EDIT: Also uploaded same script as above but without McDegrainSharp, ~10.7MB Sheena_No_McDegrainSharp.mp4 [ie not much diff from 350MB source clip, just compressed non lossless].
EDIT: Also Added Sheena_Contrast.mp4 ~3.7MB, with a bit of Levels as Below
Code:
vFN="D:\WORK\Sheena Easton machinery small sample.mov"
c=LSMASHVideoSource(vFN)
a=LSMASHAudioSource(vFN)
AudioDubEx(c,a)
Crop(10,0,-14,-0)
Levels(128,1.0,1020,64,940,coring=false)
#Histogram(mode="Levels")
#Return last
McDegrainSharp(frames=3)
#Return last
# for MeGUI 10 Bit
RT_signalDar2(4,3)
ConvertBits(16)
ConvertToYUV420()
Return last
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 15th November 2019 at 06:30.
StainlessS is offline   Reply With Quote
Old 15th November 2019, 08:04   #12  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 27
Hi StainlessS,

Please share qyot27's dll so I can update mine too. BTW, I'm running XP, I've tried various versions of the LSMASHsource.dll, but I'm still getting that weird output. Can anyone suggest the right dll to try? Thanks.

Last edited by astronob; 15th November 2019 at 08:18.
astronob is offline   Reply With Quote
Old 15th November 2019, 10:39   #13  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 27
Hey, LSMASHVideoSource, is still giving me rubbish in the output. I tried updating the dll, but no joy. I'm using WinXP 32 bit. Does that dll apply to Win7 and above? If so, is there a XP32 compatible dll I can use? Thanks.
astronob is offline   Reply With Quote
Old 15th November 2019, 15:04   #14  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,996
Why don't you just use ffms2? It's working for me. For Avisynth+ the output is 10 bit. I'm not sure what happens to the extra bits, but it opens as 8 bit with Avisynth 2.6 and looks okay.

The only way I could get LSmash to output something sensible (the last XP compatible version) was to tell it to output 8 bit video. None of the higher bitdepth formats fixed the garbled video.

LSMASHVideoSource("E:\sheena-easton-machinery-small-sample.mov", format="YUV420P8")
hello_hello is offline   Reply With Quote
Old 15th November 2019, 16:19   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,266
Dont know if 10 bit XP LSmash available, my XP one dont work.

Code:
vFN="D:\WORK\Sheena Easton machinery small sample.mov"
#c=LSMASHVideoSource(vFN)
#a=LSMASHAudioSource(vFN)
FFIndex(vFN)
c=FFVideoSource(vFN)
a=FFAudioSource(vFN)
AudioDubEx(c,a)
#return Info
Crop(10,0,-14,-0)
Levels(128,1.0,1020,64,940,coring=false)
#Histogram(mode="Levels")
#Return last
McDegrainSharp(frames=3)
#Return last
# for MeGUI 10 Bit
MeGUI_darX=4       # RT_signalDar2(4,3), preset DAR for MeGUI
MeGUI_darY=3
ConvertBits(16)
ConvertToYUV420()
Return last
EDIT: quot27 version was from post 10. [EDIT: I'm currently on W7]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 15th November 2019 at 16:37.
StainlessS is offline   Reply With Quote
Old 15th November 2019, 23:33   #16  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 27
hello_hello is right, you can get output if you tell LSMASH to output 8bit video as he has done, otherwise nada, but yes, ffms2 also works just fine too.
astronob is offline   Reply With Quote
Old 16th November 2019, 18:02   #17  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 685
@astronob... LWLibavVideoSource for Windows XP will output anything greater than 8bit as 16bit interleaved, which is why you're seeing it that way.
On AVSPmod right click on the preview and choose "Bit Depth" -> "Interleaved yuv420p16". The preview will reload and it's gonna be fine.
Beware that in 16bit interleaved the picture contains the MSB and the LSB (Most significant bit and Less significant bit) interleaved together, so you gotta remember that all your filterchain has to be aware of that and 16bit interleaved compatible as well as your encoder (as it receives a 16bit interleaved output).
DO NOT use filters that expect 8bit planar with 16bit interleaved as that will fuck everything up.

16bit interleaved -> Setting the preview the right way -> Correct planar output

Quote:
Dont know if 10 bit XP LSmash available
Nope, no one ever compiled it. The last XP Compatible version from the wiki is quite old.

Quote:
is there a XP32 compatible dll I can use?
Nope. Your best shot with XP x86 is ffms2 C plugin which is the most updated indexer and it supports planar high bit depth with Avisynth+ (instead of stacked/interleaved).
Please keep in mind that the development of the C version of ffms2 dropped XP compatibility as well, so although it's more updated than LSMASH and it will be fine for many formats, it's still not the very last version and it won't get any updates in the future (unless qyot27 starts loving XP users again and re-introduces XP compatibility making a lot of XP die-hard happy, which is extremely unlikely to happen).
__________________
Broadcast Encoder
Avisynth memes: 1 - 2 - 3
Videotek - Audacity XP

Last edited by FranceBB; 16th November 2019 at 18:11.
FranceBB is online now   Reply With Quote
Old 17th November 2019, 14:30   #18  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 27
When I try to encode a "mov" file capture, captured with the v210 codec, avspmod gives me an error when I use ffms2, I added converttoyv12() for QTGMC, and it's saying "only 8 bit sources allowed". Is it the version of ffms2 I'm using? I'm using version 2.23.1. Would another version be more appropriate?
astronob is offline   Reply With Quote
Old 17th November 2019, 15:58   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,266
Quote:
Originally Posted by StainlessS View Post
Code:
vFN="D:\WORK\Sheena Easton machinery small sample.mov"
#c=LSMASHVideoSource(vFN)
#a=LSMASHAudioSource(vFN)
FFIndex(vFN)
c=FFVideoSource(vFN)
a=FFAudioSource(vFN)
AudioDubEx(c,a)
#return Info
Crop(10,0,-14,-0)
Levels(128,1.0,1020,64,940,coring=false)
#Histogram(mode="Levels")
#Return last
McDegrainSharp(frames=3)
#Return last
# for MeGUI 10 Bit
MeGUI_darX=4       # RT_signalDar2(4,3), preset DAR for MeGUI
MeGUI_darY=3
ConvertBits(16)
ConvertToYUV420()
Return last
Above in blue, whatever bit depth [although I dont know if avsPmod supports it].
EDIT: And QTGMC.3.363s.avsi.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 17th November 2019 at 16:07.
StainlessS is offline   Reply With Quote
Old 17th November 2019, 23:17   #20  |  Link
astronob
Registered User
 
Join Date: Sep 2004
Posts: 27
Adding "convertbits(8)", without the quotation marks, after the importation of the file with ffms2, fixes the display in avspmod and allows the encoder to encode the script. Adding this string to the input line of ffms2 also works colorspace = "YUV420P8" or "YUV422P8", and negates the need to add convertbits(8) after the import line. It also eliminates the need to add converttoyv12(0 before QTGMC, but if I don't add converttoyuy2() if using colorspace="YUV420P8" (but not for colorspace="YUV422P8") at the end of the script, the video is stretched vertically in the preview window, the same height, but half the width. I don't get that at all. In addition, seems I still need to add converttoyuy2() at the end of my script for my chosen encoder, CinemaCraft Encoder, otherwise it won't encode the video. But I didn't have to do it before, I might have added some dll or avs or avsi script to the plugins folder which broke my previously fine working script. However, temporaldegrain2 only works with avisynth+ and so I have to use avisynth+, which has it's benefits, it definitely allows for faster encoding for me than avisynth 2.6, but you have to get the right dependencies and plugins in the plugins folder, otherwise all you get thrown up is one error after another.
astronob is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:46.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.