Quantcast Avisynth script for QTGMC, encode x264 - no video after deinterlace? - digitalFAQ Forum
Go Back    Forum > Digital Video > Video Project Help > Capture, Record, Transfer

Reply
 
LinkBack Thread Tools
  #1  
09-12-2015, 08:47 AM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
Hi,

Due to the inactivity in another of my post, I'm starting a new one. Please don't get me wrong by doing so. If you don't agree with this, please admin, remove my post.

This being said, here are my goals and actual issues.

I got everything setup. I captured videos from 8mm tapes from camcorder using virtualdub and lagarith.

Now I'm into avisynth and QTGMC.

I would like good video playback on a computer (I will probably keep unprocessed files as archive, in case I would like TV playback someday). From readings and your suggestions..

From other post...
Quote:
For the deinterlacing, it seems like you're saying you put the script into VirtualDub and created an AVI output using Fast Recompress, then encoded that using x264. You don't need to do that; you can feed the Avisynth script straight into x264.

x264 + MP3 is a weird combination. x264 + AAC would be the typical configuration, and AAC is a more efficient audio compressor.
I concluded X264 and AAC would be a good way to go, done in my Avisynth script along with QTGMC. (Unless you recommend something else!)

Is that possible? To sum up, I'd like to take my "uncompressed" Lagarith captured avi file and get to the desired result, in 1 operation done in a script.

Though, actually before getting there I have 2 issues:

1-I get green screen/no video but sound after going through qtgmc in virtualdub (with avisynth script). What might be the issue?

Here is the script

AVISource("01.avi")
crop(10,0,-6,-6).AddBorders(8,2,8,4)
AssumeTFF()
QTGMC()

In VirtualDub, I use fast recompress for video, and direct stream copy for audio.

2-Concerning sound, I only get sound from 1 channel (sound coming out from one speaker only). How can I duplicate mono sound to both channels at the same time?

Thanks in advance

PS: Here is the original post: Workflow to save time, better quality + ghosting in video?
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
09-12-2015, 09:10 AM
vivan vivan is offline
Free Member
 
Join Date: Aug 2015
Posts: 7
Thanked 1 Time in 1 Post
Do you see video in the virtualdub after opening that script?
Reply With Quote
  #3  
09-12-2015, 09:21 AM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
If I open the captured file directly (no script), everything is fine, and it is smooth as butter. When I open the script in VirtualDub, I can see the video too, the framerate is very slow, but eveything is ok (I think it is normal to be slow because of QTGMC).

Though, after fast recompress, I get nothing but sound.
Reply With Quote
  #4  
09-12-2015, 09:56 AM
vivan vivan is offline
Free Member
 
Join Date: Aug 2015
Posts: 7
Thanked 1 Time in 1 Post
If you see picture in virtualdub - then your script is working without any issues.
Probably you're saving uncompressed video and having issues with that. Or you're selecting Lagarith for compression? Or you're trying to use x264vfw?

Anyway, to encode with x264 you will have to use either x264 itself (it's a video encoder, it can't encode audio - you'll need to encode it separately) or ffmpeg (it can do anything) or any GUI that uses them (like MeGUI). Probably MeGUI route will be easier if you're not into using command-line tools.

As for audio - if audio will be processed using avisynth - it has GetChannel filter (it will turn 1 channel into mono).
ffmpeg (if you'll use it for encoding audio) also can manipulate audio.
Reply With Quote
  #5  
09-12-2015, 10:13 AM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
I capture directly from camcorder using lagarith, which gives me an interlaced avi (about 50Gb)

Then I import this avi file using the script mentionned previously in Vdub. After fast recompress, this is where I get no video in any media player or green screen in VDub.

I don't mind adding a separate step to use x264 if this is the way to proceed usually. I'll study this later as I want to rule out the issue I have first.

Thanks again!
Reply With Quote
  #6  
09-12-2015, 10:41 AM
vivan vivan is offline
Free Member
 
Join Date: Aug 2015
Posts: 7
Thanked 1 Time in 1 Post
When you're processing video it doesn't matter how it was encoded before processing - virtualdub (and any other tool) gets uncompressed video from avisynth. It's not modifying original file, or trying to use same codec or anything - it knows nothing about it.

"Fast recompress" simply tells virtualdub to not perform any colorspace conversion (in other modes it converts video into RGB which is terrible idea). It doesn't affect encoding (compression) settings (except direct stream copy mode, which should result in uncompressed video).

For saving result it will use selected codec (in video->compression). By default it uses it's own "uncompressed" codec. It's kinda very broken, as you can see. If you select Lagarith there (for example) it should work fine.
Reply With Quote
  #7  
09-12-2015, 11:05 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,448
Thanked 1,075 Times in 895 Posts
Isn't your input video YUY2? For most popular formats, h264 is encoded as YV12.

To use one audio channel and convert to mono in both channels:

Code:
vid=AVISource("01.avi")
monoaud=vid.GetChannel(1) # <--- channel 1 = left, channel 2 =right
newaudio=mergechannels(monoaud,monoaud)
AudioDub(vid,newaudio)

crop(10,0,-6,-6).AddBorders(8,2,8,4)
ConvertToYV12(interlaced=true)
AssumeTFF()
QTGMC()
return last  # <--- this line must be included as last in the script
Why are you leaving this video deinterlaced? Deinterlaced = double the full-frame playback rate, double the number of frames, and file size increase (about 2X for the same colorspace).

PC media players deinterlace on the fly the same way your TV does, except for VLC. By default VLC doesn't deinterlace. Go into VLC "Tools" -> "Preferences" -> "Video" and turn it on permanently. Set deinterlacing to "Automatic", set "Mode" to Bob or yadif. If the video isn't interlaced, this setting does nothing.

Last edited by sanlyn; 09-12-2015 at 11:27 AM.
Reply With Quote
  #8  
09-12-2015, 11:52 AM
vivan vivan is offline
Free Member
 
Join Date: Aug 2015
Posts: 7
Thanked 1 Time in 1 Post
Quote:
Originally Posted by sanlyn View Post
Deinterlaced = double the full-frame playback rate, double the number of frames, and file size increase (about 2X for the same colorspace).
In interlaced video fields are less correlated than normal frames in progressive video. Keeping all that aliasing is a nightmare for video encoder.

It's not number of frames that is increased (fields in interlaced video are basically normal progressive frames), it's a vertical resolution.
Effective deinterlacer works like this:
1) Separate fields
2) Double vertical resolution of each field (bob), using highest quality upscaler (nnedi)
3) Copy details from surrounding frames
In fact it's a so-called super resolution filter (filter that increases resolution using information from several frames).
So, while resolution was increased consecutive frames now share same details - which really helps video encoder.

In fact when using effective video encoder (x264) deinterlaced video is even better compressible than interlaced.

Quote:
Originally Posted by sanlyn View Post
PC media players deinterlace on the fly the same way your TV does, except for VLC. By default VLC doesn't deinterlace. Go into VLC "Tools" -> "Preferences" -> "Video" and turn it on permanently. Bob or yadif are the popular method choices. If the video isn't interlaced, this setting does nothing.
Yeah, they do. Compared to QTGMC their quality is ranging from terrible (yadif) to bad (TVs, HW/DXVA deinterlacing). Even for TV playback deinterlacing is a good idea.
Reply With Quote
  #9  
09-12-2015, 01:05 PM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
Quote:
For saving result it will use selected codec (in video->compression). By default it uses it's own "uncompressed" codec. It's kinda very broken, as you can see. If you select Lagarith there (for example) it should work fine.
I'm doing the test atm. I missed that! So am I wrong if I say that I could have simply capture using uncompressed video, and the process the captured file using the avisynth script and choose Lagarith for video compression?

Quote:
Isn't your input video YUY2? For most popular formats, h264 is encoded as YV12.
I'm not really aware of what is good (popular) and what is not. So thanks for this advice!

Thanks for the sript Sanlyn! Quick question though, Could I choose YV12 in the Lagarith options instead of integrating the conversion in the script?

Quote:
Why are you leaving this video deinterlaced? Deinterlaced = double the full-frame playback rate, double the number of frames, and file size increase (about 2X for the same colorspace).
Quote:
Yeah, they do. Compared to QTGMC their quality is ranging from terrible (yadif) to bad (TVs, HW/DXVA deinterlacing). Even for TV playback deinterlacing is a good idea.
I'm on Vivian's side on this. I tried interlaced video on pc software but results were not very good (unless you suggest me of a good deinterlaceing software ). I think QTGMC quality is much better. As for the file size, after going through qtgmc, the file goes from 50Gb to 500Mb roughly (if I did nothing wrong) so personally, I don't have an issue with that.

As said, I'm testing something on a file now. I'll let you know about the output!

Thanks for the support
Reply With Quote
  #10  
09-12-2015, 01:52 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,448
Thanked 1,075 Times in 895 Posts
If you don't know what color system you're using to capture, you should take the time to look up info about that -- or at least know how you've set up your capture.

The colorspace you use when capturing and processing VHS and the colorspace used when encoding don't have to be the same. VHS is captured to YUY2 because that colorspace is more "like" the YPbPr matrix used to store VHS data, so the captured luma and chroma data more faithfully resembles the original tape. Eventually encoding goes into YV12 for most popular formats (DVD, BluRay, AVCHD, mp4, mkv, etc.). You can convert colorspaces when needed, but I'd let Avisynth do it -- most NLE's crap it up.

By default VirtualDub outputs uncompressed RGB when "full processing mode" is turned on, regardless of the color used in the input and regardless of whether or not you're running VirtualDub filters on the video. To set your own compression and colorspace, enable "full processing mode", check that "Color depth..." and "Compression..." are what you want, then enable "fast recompress". That's the safest way to get exactly what you want.

Your 50GB input went down to a tiny 500mb output file? I won't even guess how you're compressing that, but from what I've seen of the captures so far a low bitrate and long_GOP encodes will look worse than the tape.

You can still use QTGMC for cleanup, and those captures really need cleanup, but the results should be re-interlaced. This is how it's done in Avisynth:
Code:
QTGMC()
.... some processing ....
.... whatever ....
AssumeTFF().SeparateFields().SelectEvery(4,0,3).Weave()
Deinterlacing isn't the only way to clean up video. There are other ways to do it. QTGMC at default settings is heavy-duty cleaning and often over-filters. In your earlier captures I had to tone down the filtering somewhat, because the results were showing posterization ("clay face" effects), hard gradients along shadow edges, and block noise in backgrounds and large areas that are supposed to be smooth, like walls.

A lot of people like to run Avisynth and encode in the same step. I never do it. 85% of the time something goes screwy and I have to do it all over again. And if you include things like memory swapping during the process, things slow down anyway.
Reply With Quote
  #11  
09-12-2015, 02:13 PM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 8,477
Thanked 1,392 Times in 1,224 Posts
Deinterlacing is almost NEVER a way to clean up video, period. Deinterlace != cleaning!

The best QTGMC use is with tweaks to the switches.

The beauty of uncompressed and lossless is that you do NOT have to process in one go. I rarely process video with a single pass. Some of the more advanced filters hate each other, and too much will simply crash Avisynth (not to mentioned Avisynth + VirtualDub). In my earlier days, I had video encode for 2 days, hit 99%, and then the project crashed -- and I had to start over.

I've not overly anal about colorspaces, but you do need to pay attention to what's going on. Sometimes a change may be harmful, thus needs to be avoided.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
  #12  
09-12-2015, 02:42 PM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
Hi again,

I'm not really picky, but just want a nice video in the end.I did a quick test, and I'm happy with the result using my original script, but with using LAGARITH for video compression this time. I totally missed (forgot) the option before saving as avi.

I knew about the colorspace conversion virtualDub does (uses RGB) and that it has to be avoided, from readings. For the other colorspaces, I know the names but don't know the major differences between them nor which one are used for popular encoding.

I admit 50Gb to 500Mb is quite strange as results. I must have done something wrong.

I will follow your guide and work my files in steps. It's just sometimes I had comments like : You didn't have to do this, you could have done this in the same script" so that's why I asked if it was possible. But I understand the point that you better handle less in a few steps, than trying to do all at once.

I will now try the script sanlyn posted.

Oh and btw, I have new capture material as already mentioned in other post. The ATI capture card gives better results out of the box so lot less tweaking is necessary (well, it'S relative but for me I find it quite good!)

-- merged --

Script tested, output file is pretty good for me. I have a less than 5gb size for 5 mins of video, which sounds a little more normal at this stage.

In Vdub, after some searching, I saw that there are different settings for the capture card. I noticed they were not set to default when I did my initial capture. Attached are the real default settings.

Is eveything good? Is there a thing I could change to have better result out of the box?

There are drop down lists for other options. Here they are:

COMB FILTER
Filter:
  • 3D
  • 2D
Threshold:
  • Adlj.Line
  • Non Adj. Line
  • Adj.Frame
  • Motion
NOISE REDUCTION FILTER
Method:
  • None
  • Adaptive
  • Light
  • Medium
  • Strong
Threshold:
  • Luma Coring
  • Adaptive cross Chroma
  • Adaptive cross Luma
VOLUME
Level: 1 to 255

I set everything to default, except Shapening in the Video Proc Amp tab that I brought back to zero (default was 200)

Let me know what you think.

Thanks again!


Attached Images
File Type: jpg Ati Settings.JPG (74.6 KB, 12 downloads)
Reply With Quote
  #13  
09-13-2015, 07:49 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 8,477
Thanked 1,392 Times in 1,224 Posts
NR during capture is never suggested. Do that in post-capture processing, be it VirtualDub, Avisynth, or something else.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
  #14  
09-13-2015, 09:05 AM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
Alright, will do that.

Thanks for the tip!
Reply With Quote
  #15  
09-14-2015, 07:04 PM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
HI,

I think I'm to the point of encoding. I found x264vfw to use with Vdub.

Do you suggest another software to encode? I know you talked about MeGui. Is there a preferable one?

Also, audio needs to be processed separately. Can I do that in VirtualDub too? From quick research, VDub cannot encode AAC but only decode.

Is there a good software where I could put my avi file, and encode to h264 + AAC directly?

Thanks in advance!
Reply With Quote
  #16  
09-15-2015, 05:41 PM
Goldwingfahrer's Avatar
Goldwingfahrer Goldwingfahrer is offline
Remembered
 
Join Date: Aug 2013
Location: Switzerland
Posts: 453
Thanked 75 Times in 70 Posts
Quote:
Is there a good software where I could put my avi file, and encode to h264 + AAC directly?
Yes, of course. If I have called, nevertheless, already here.... Hybrid from the developer Selur.

he is to be found in the English Doom9 and also in German doom9 or directly on his web page.

I am present since the first version from Hybrid already.

http://www.selur.de/

2 weeks ago I have shown the first steps in Hybrid here in the forum in a small MP4.

It is not quite light Hybrid, but if I can work with 60 + with it.... also young brains are able to do it also.


Quote:
I found x264vfw to use with Vdub.
Yes, I also know....... no good idea AVC + AAC is however to be provided in an AVI-Kontainer.
Question sometimes user sanlyn
Reply With Quote
  #17  
09-16-2015, 11:12 AM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
Thanks for the info.

I'll have a look at Hybrid. Seems like a good software!

I'll let you know if I run into issues or have some questions.

Thanks again!
Reply With Quote
  #18  
09-16-2015, 12:09 PM
Goldwingfahrer's Avatar
Goldwingfahrer Goldwingfahrer is offline
Remembered
 
Join Date: Aug 2013
Location: Switzerland
Posts: 453
Thanked 75 Times in 70 Posts
Quote:
I'll let you know if I run into issues or have some questions.
It is much better if you user Selur asks, he is able in English.
On his web page an unterforum is for questions.
I am only one user from Hybrid.

Mine ask I put in the German forum or in the German Doom9 forum.
http://movie2digital.net/index.php?t...-vp9/&pageNo=2


http://forum.gleitz.info/showthread....t=hybrid+selur
Reply With Quote
  #19  
09-16-2015, 01:06 PM
mo418 mo418 is offline
Free Member
 
Join Date: May 2015
Posts: 37
Thanked 0 Times in 0 Posts
Thanks again, good to know. Really appreciated!

Regards
Reply With Quote
Reply




Tags
avisynth, lagarith, qtgmc, x264

Similar Threads
Thread Thread Starter Forum Replies Last Post
VCR simulator script, Avisynth fake VHS look! jmac698 Restore, Filter, Improve Quality 1 02-12-2018 06:17 AM
How to deinterlace MP4 video + batch processing? segen77 Restore, Filter, Improve Quality 3 02-13-2014 11:43 AM
Will a TV always deinterlace video? premiumcapture Restore, Filter, Improve Quality 6 12-27-2013 11:06 AM
Deinterlace NES gameplay video with VirtualDub filters? DV vs Huffyuv for games? JLegnon Project Planning, Workflows 15 05-29-2012 09:40 PM
QTGMC How-to: Help deinterlacing with Avisynth Joekster Restore, Filter, Improve Quality 1 12-22-2011 04:27 PM

Thread Tools



 
All times are GMT -5. The time now is 01:49 AM