VideoHelp Forum




+ Reply to Thread
Results 1 to 21 of 21
  1. Hello!

    I recently started digitalizing some very old VHS-C tapes and i can't figure how to proceed.

    I captured them with Virtualdub and encoded with logarith (YV12). Since they are quite old, i had to crop all the tapes to remove some of the noise on the sides and mostly bottom.
    My next step was to crop them a bit more to meet mod16 and i also deinterlaced them (i'm not sure if i did this wrong with deinterlacing already because i also want to use some filters later to remove some of the noise, if so i still have a backup without deinterlacing) and now my problem is, some movies are left with a 704x352 resolution (16:9ish) while others are 716x476 (4:3ish) and i need to merge them on the same video.

    My guess is to add blackbars until i make them 720x480 (NTSC) which was the original capture resolution?, but i have no clue how to do that. I'm using avisynth and i know it has the function addborders() but i just can't figure how the function works and how to do the math to calculate the size of the bars.

    Any help on this would be really appreciated!.

    Thanks from a newbe :P
    Last edited by quetzalin; 29th Aug 2015 at 15:52.
    Quote Quote  
  2. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    You are making a HUGE mess out of that.
    Quote Quote  
  3. Something i didn't mention, the reason about the 704x352 on some tapes (the 16:9ish ones) is because they were recorded with letterbox.
    Quote Quote  
  4. Originally Posted by quetzalin View Post
    but i just can't figure how the function works and how to do the math to calculate the size of the bars.
    Didn't you learn addition and subtraction in about the second grade? Anyway, take the 704x352 one as an example. To make it 720x480, the AddBorders command to add equal amounts of black all around would be:

    AddBorders(8,64,8,64)

    http://avisynth.nl/index.php/AddBorders

    If it's for DVD eventually and you AddBorders that way and don't resize, make sure to encode for 4:3. If you want a 16:9 DVD the process is different.

    And I agree with hech54 that you're not doing this in the best way.
    Quote Quote  
  5. 704x480 is valid for DVD and is likely to be the portion of the frame that contains the 4:3 or 16:9 picture (ITU pixel aspect ratio) in an analog capture. So you want something like:

    Code:
    v1 = AviSource("file1.avi").AddBorders(0, 64,0,64) # 704x352 source to 704x480
    v2 = AviSource("file2.avi").Crop(6,0,-6,-0).AddBorders(0,0,0,4) # 716x476 source to 704x480
    v1++v2 # append v2 to v1
    I added 4 to the bottom of the 476 line tall video rather 2 at the top and 2 at the bottom for slightly cleaner encoding.
    Quote Quote  
  6. Originally Posted by manono View Post
    Originally Posted by quetzalin View Post
    but i just can't figure how the function works and how to do the math to calculate the size of the bars.
    Didn't you learn addition and subtraction in about the second grade? Anyway, take the 704x352 one as an example. To make it 720x480, the AddBorders command to add equal amounts of black all around would be:

    AddBorders(8,64,8,64)

    http://avisynth.nl/index.php/AddBorders

    If it's for DVD eventually and you AddBorders that way and don't resize, make sure to encode for 4:3. If you want a 16:9 DVD the process is different.

    And I agree with hech54 that you're not doing this in the best way.
    Originally Posted by jagabo View Post
    704x480 is valid for DVD and is likely to be the portion of the frame that contains the 4:3 or 16:9 picture (ITU pixel aspect ratio) in an analog capture. So you want something like:

    Code:
    v1 = AviSource("file1.avi").AddBorders(0, 64,0,64) # 704x352 source to 704x480
    v2 = AviSource("file2.avi").Crop(6,0,-6,-0).AddBorders(0,0,0,4) # 716x476 source to 704x480
    v1++v2 # append v2 to v1
    I added 4 to the bottom of the 476 line tall video rather 2 at the top and 2 at the bottom for slightly cleaner encoding.
    Oh ok... it was that simple, for some reason i thought i had to play with resizing aswell. I feel stupid now

    And i want to do this the best way, so if the process im doing is a mess, then what would be the best to do?.

    The capture part with virtualdub and using a lossless codec (logarith) must be right.
    About cropping the overscan, after some investigating, i think i found a much better way to do this and will help me with having all the videos with the same resolution and not bothering with the blackbars at all. After i have the tapes captured and untouched, i open each of them on virtualdub and apply a resize filter where i define the same resolution my video originally had (720x480 in my case) and then i crop the overscan and other bad things on the image. This way, i still will have a 720x480 video with already black bars.

    After this, i can just apply some filters to fix the image as much as i can (like remove some noise). And finally deinterlace and convert to h264 since i want them to be played on a computer/home cinema.

    I hope this is more about right

    Now i will just have to capture the tapes again... /cry
    Quote Quote  
  7. If you're using AviSynth at all, then all the filtering should be done in AviSynth - cropping, resizing, denoising, everything.

    You're removing the black and then adding it back? That can be done in a single step with the Letterbox filter which just covers what's there with black. I always do similar things myself, if only to get 'fresh' and real black for the videos:

    http://avisynth.nl/index.php/Letterbox

    To cover the top and bottom 64 rows of pixels with black, and the left and right 8 columns:

    Letterbox(64,64,8,8)

    If your source is really interlaced, then for DVD it's not often a good idea to deinterlace it, especially not with an inferior VDub deinterlacer. If your videos are film sourced, then you IVTC with a good AviSynth IVTC filter such at TIVTC:

    http://avisynth.nl/index.php/TIVTC

    If you're not sure which you have, post a 10 second sample here.

    After i have the tapes captured and untouched, i open each of them on virtualdub and apply a resize filter where i define the same resolution my video originally had (720x480 in my case) and then i crop the overscan and other bad things on the image. This way, i still will have a 720x480 video with already black bars.
    I didn't understand any of that. If you capped it at 720x480, why resize (and in VDub?) to 720x480? How, after cropping (the overscan?) will you still have a 720x480 image? And if you're resizing to 720x480 after doing the cropping, and if your video is still interlaced, you've just wrecked it beyond redemption.

    If for DVD, you don't really need to deinterlace, but you have to be very careful about filtering interlaced video and do it correctly. If you want it progressive for some other format, you might want to deinterlace it (or IVTC it) first. And if it's really interlaced, you might want to consider bobbing it to keep the smoothness of interlaced video.
    Quote Quote  
  8. VHS-C tapes are probably interlaced camcorder video. That should be smart-bob deinterlaced before filtering. QTGMC() is usually best (but slow) for this type of video. Yadif(mode=1) may be adequate. QTGMC() also has a noise reduction filter built in so you could try that: QTGMC(EZDenoise=2.0) -- the bigger the value the more noise reduction you get.

    I haven't used DVDs in years -- I prefer to use media players that can play MKV, MP4, AVI, etc. media files. But if you need interlaced video for DVD you can re-interlace after filtering. A complete script might look like:


    Code:
    AviSource("filename.avi")
    Crop(...) # remove borders, use mod2 cropping for interlaced YUY2 or RGB, mod4 with interlaced YV12
    ConvertToYV12(interlaced=true) # if necessary
    QTGMC(preset="fast", EZDenoise=2.0)
    # add other filters here if necessary
    AddBorders(...) # back to 720x480
    AssumeTFF()
    SeprarateFields()
    SelectEvery(4,0,3)
    Weave()
    Quote Quote  
  9. Given the video will eventually be re-encoded using a h264 encoder (I assume the desired file type will be MKV or MP4), there's no need to worry about mod16. There's probably no need to make them all the same resolution either. You can if you prefer, but there's probably no need.

    Are you setting the correct aspect ratio in the encoder setup when re-encoding? I'm not sure I understand how you're determining the resizing to use after cropping either. You can't remove part of the image by cropping (even if it's just black bars), resize back to the same resolution and have it display the same way unless you set the correct aspect ratio.

    720x480 isn't 4:3 but it's resized on playback to display with a 4:3 aspect ratio. For your video, instead of resizing back to 720x480 after cropping, I'd probably resize to square pixel dimensions. Something like 640x480. Not that you need to resize to exactly 4:3 dimensions, but if you want them all the same I'd crop the crud first, adjust the cropping a bit if need be so the remaining picture has a 4:3 aspect ratio, then resize to a 4:3 dimension (such as 640x480).

    I'd de-interlace with QTGMC first, but if it was me, I'd do something like this (just making up cropping numbers for the example)

    AviSource("filename.avi")
    QTGMC()
    Crop(14, 2 -12,-4)
    Spline36Resize(640,480)

    Maybe have a play with this calculator. Select NTSC 4:3 as the source video, apply whatever cropping is required and the calculator will help you work out the most accurate resizing. It defaults to mod16 resizing but you can change that if need be. If you don't want to resize to square pixels you can ignore the resizing section. Instead use the numbers displayed for the "matroska aspect ratio flag" to set the correct aspect ratio when encoding.
    (It's an exe, but it's safe) Yoda's Resize Calculator

    Alternatively, given you're using Avisynth, you could use a different GUI such as MeGUI. It's script creator has a similar calculator built in for displaying the aspect error when resizing to square pixels. If you're not resizing to square pixels, MeGUI's anamorphic encoding option will set the correct aspect ratio for you.
    Quote Quote  
  10. About the resizing/crop thing, i was just going to follow a guide i found here.




    But, using the avisynth letterbox filter seems more clean (but slightly messy since i need to test and error the values, not all the tapes are the same), i will probably do that (i also had in mind to "refresh" the blackbars on the videos which were recorded with letterbox).

    The reason to deinterlace is because i want a mp4/mkv h264 video. I'm going to use yadif:

    Code:
    Load_Stdcall_Plugin("C:\Users\MMedia\Desktop\tools\avisynth_plugin\yadif.dll")
    Yadif(order=1, mode=1) # The reason about order=1 is because im trusting MeGUI here to analyse if it is TFF or BFF, (i know this can be done manually just playing the video, but i don't know how to and i could upload a video sample but it is not worth it, i have several different videos)
    I also heard about QTMF() and have been doing some tests with it, so far, this is what works better for me:

    Code:
    QTGMC(Preset="Slower", NoiseProcess=1, NoiseRestore=0.0, Sigma=4.0)
    So to resume, this is how my script looks like so far:

    Code:
    AviSource("filename.avi")
    Letterbox(x,x,x,x)
    Load_Stdcall_Plugin("C:\Users\MMedia\Desktop\tools\avisynth_plugin\yadif.dll")
    Yadif(order=1, mode=1)
    QTGMC(Preset="Slower", NoiseProcess=1, NoiseRestore=0.0, Sigma=4.0)
    Quote Quote  
  11. Both Yadif (as you're using it) and QTGMC are bobbers. You use one or the other, but not both in the same script.
    Quote Quote  
  12. That script bob deinterlaced twice. Once with Yadif, then again with QTGMC. That will give you 4x the frame rate, not 2x. Use one or the other. Or if you want to use QTGMC just for cleanup add InputType=1 so that it doesn't double the frame rate.
    Quote Quote  
  13. Okay, after running my script for the first time, i noticed i'm getting double the framerate, i guess it is because yadiff mode=1 so adding a SeprarateFields() at the end should be enough ?

    What about AssumeTFF(), SelectEvery(4,0,3) and Weave()?, should they be used at all?.

    Thanks again
    Quote Quote  
  14. Just remove Yadif from your script.
    Quote Quote  
  15. Originally Posted by quetzalin View Post
    Okay, after running my script for the first time, i noticed i'm getting double the framerate, i guess it is because yadiff mode=1 so adding a SeprarateFields() at the end should be enough ?
    If the video is interlaced, double the frame rate is a good thing. Each frame is unique and motion will be smoother. If the output is going to be h264 that should be fine. Support for frame rates up to 60fps or more at 720p is fairly common these days. If your playback device supports level 3.2 or higher, you should be fine. https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels

    If you're using Yadif and you don't want double the frame rate, don't use mode 1, but motion won't be as smooth.

    ie Yadif(order=1)

    Don't use Yadif and QTGMC together (if QTGMC is also de-interlacing).
    If you use QTGMC for that, by default it outputs double frame rate. The easiest way to get the original frame rate output is to tell Avisynth to delete every second frame. One again though, motion won't be as smooth.

    QTGMC()
    SelectEven()

    Originally Posted by quetzalin View Post
    What about AssumeTFF(), SelectEvery(4,0,3) and Weave()?, should they be used at all?.
    I assume that part was jagabo's suggestion for re-interlacing the video if you're re-encoding to create a compliant DVD video disc. If you're encoding with x264 to create MP4/MKV files, I don't see the point.

    Sometimes when de-interlacing you might need to specify the field order before the de-interlacing (top field first or bottom field first) but usually only if the de-interlacing results in motion jumping backwards and forwards. If motion is normal, you shouldn't need to.
    In the case of Yadif it has it's own parameter for specifying the field order if need be, so once again AssumeTFF() shouldn't be needed. For Yadif, order=0 means bottom field first, order=1 means top field first, and order=-1 means a varying field order. Just use whatever MeGUI decided when it analysed the video unless the deinterlacing produces unexpected results (jerky motion).
    Quote Quote  
  16. First, good for you for choosing QTGMC to deinterlace. With modern processors, there is really no reason to go with a smaller footprint deinterlacer.

    Second, QTGMC has a multi-thread build that when properly optimized for you system speeds things up dramatically, especially for SD video. I get 90+ frames per second for SD video on my i7-3770K. Truly screaming fast and that is at a slow setting. http://avisynth.nl/index.php/QTGMC#Multi-Threaded_Usage
    Quote Quote  
  17. Thanks all a lot for the help.

    After playing with filters a couple of days and doing some tests, i had to keep AssumeTFF() before QTGMC() (and removed Yadif as you all suggested). The reason about keeping AssumeTFF() is because without it, when the camera moves a bit fast on the encoded video it produces a dizzy effect.

    I uploaded an example of one of my videos here and this is my script at the moment (also i switched back to EZDenoise):

    Code:
    SetMemoryMax(700)
    SetMTMode(3, 6)
    AviSource("example.avi")
    SetMTMode(2)
    AssumeTFF()
    QTGMC(Preset="Slower", EdiThreads=1, EZDenoise=2.5, NoisePreset="Slow")
    If there is any other filter you think i could add, please tell me
    Quote Quote  
  18. Your white levels are completely blown out and mostly can't be recovered. Your blacks are all greys. You can do something like this:

    Tweak(Bright=-40,Cont=1.05,Coring=False)###Adjust to suit your tastes

    but you can't get back a lot of the lost detail. Frame 365. Left=original. Right=filtered.
    Image Attached Thumbnails Click image for larger version

Name:	SideBySide.jpg
Views:	239
Size:	140.6 KB
ID:	33465  

    Quote Quote  
  19. Yeah thats a problem on the VHS tapes i already noticed, some parts are very dark while others are too bright. I could record them separately with different brightness and contrast values but thats gonna be a loooot of work.
    Quote Quote  
  20. Originally Posted by quetzalin View Post
    Yeah thats a problem on the VHS tapes i already noticed...
    Hehe, I go through them scene-by-scene and frame-by-frame, fixing what has to be fixed. I don't suppose most people are willing to go that far. I guess you'll have to choose a 'happy medium' and be done with it.

    However, before doing the 'real' capture, most who care about these kinds of things will make some short sample captures and fine-tune the Levels/Brightness/Contrast/Saturation so nothing gets ruined beyond fixing as in your sample.
    Quote Quote  
  21. Originally Posted by quetzalin View Post
    Yeah thats a problem on the VHS tapes i already noticed, some parts are very dark while others are too bright. I could record them separately with different brightness and contrast values but thats gonna be a loooot of work.
    During capture your primary concern should be that your levels are "legal" 16-235 so you aren't losing any information that's actually on the tape. Once captured you can go in and try to make it look good.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!