VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 28 of 28
Thread
  1. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    I have a DVD that plays awfully on TV from players, the edges have combs. The situation is a bit better in VLC player, but still not perfect. I decrypted the DVD with DVDDecrypter, and imported the DVD library to Vegas, and was experimenting with rendering it though Frameserver doing a QTGMC deinterlace. At the moment I am checking the outcome with AvsPmod.

    The problem is, after applying QTGMC, there are still combs at certain places. You can see it on the photo below, I marked the problematic fields:

    The script is:

    Code:
    AviSource("C:\Users\Documents\video.avi")
    ConvertToYV12()
    AssumeTFF()
    QTGMC(Preset="Slower",FPSDivisor=2)
    Image
    [Attachment 51326 - Click to enlarge]


    In case I use the following script, the combs disappear from the places marked, but the image of course becomes very very blurry:

    Code:
    AviSource("C:\Users\Documents\video.avi")
    ConvertToYV12()
    AssumeTFF()
    BilinearResize(310,240)
    QTGMC(Preset="Slower",FPSDivisor=2)
    Spline64Resize(720,480)

    Image
    [Attachment 51327 - Click to enlarge]



    Any ideas to improve this?

    I wonder if this results from an improper install of OTGMC? I read that I need the "NNEDI3" plugin for it, but the most recent one comes in various versions, I did not know which one to choose, so I chose the one that came in the W7 directory. My system is Win7 anyway, with Intel core i5 CPU. Maybe I should have chosen a different version of the plugin? Or maybe I chose the wrong version from another plugin? I have avisynth 2.6 32 bit installed, and I added the latest from all the required plugins listed in the QTGMC Wiki.

    Here is the original video attached, too. This is an mpg2 file. I did not know how to cut the decrypted vob, so I used a software to export the mpeg2 stream from it unchanged, at least this is what the software reported willing to do. But it seems to me it is the unmodified stream that was saved, indeed.
    Image Attached Files
    Quote Quote  
  2. Those are dot crawl artifacts, not interlace combing. There are ways to reduce them:

    http://avisynth.nl/index.php/External_filters#Rainbow_.26_Dot_Crawl_Removal

    But they look a little unusual. I'll take a closer look later today.
    Quote Quote  
  3. You don't deinterlace it, you IVTC it:

    MPEG2Source("Video.d2v")
    TFM().TDecimate()


    That cross-hatching has nothing to do with interlacing and is in your source. You don't need Vegas for anything.
    Quote Quote  
  4. Yes, I was going to mention that earlier. The video should not be deinterlaced (QTGMC) but rather inverse telecined. Here's what I came up with:

    Code:
    Mpeg2Source("video.d2v", CPU2="ooooxx", Info=3) 
    Crop(8,0,-8,-0, align=true)
    CheckMate(thr=10, max=20, tthr2=0)
    SeparateFields()
    VInverse()
    Weave()
    TFM(d2v="video.d2v") 
    TDecimate()
    Santiag()
    aWarpSharp2(depth=10)
    Adding a strong, motion compensated, temporal noise filter like TemporalDegrain2() will remove most of the remaining dot crawl. But it will take much longer to filter.
    Image Attached Files
    Last edited by jagabo; 3rd Jan 2020 at 21:29.
    Quote Quote  
  5. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    Thanks a lot! This looks good. I will test this myself with your script. But I don't understand, what is this .d2v? Do I need to open the file in DVD2AVI, and export in .d2v, and load that with the script?


    What software did you use to convert? I am surprised the mkv is only 433kbps, but the quality is still very good.
    Last edited by Bencuri; 3rd Jan 2020 at 22:16.
    Quote Quote  
  6. Originally Posted by Bencuri View Post
    But I don't understand, what is this .d2v?
    Get the DGMPGDec package and read the docs. They'll explain everything. And it includes everything you'll need to open the video. If you're missing any of the filters, you can find them at the AviSynth site.

    You open DGIndex and then open the VOBs, all at once. You save the project and it gives you the audio and the D2V project file. You use the DGDecode.dll and MPEG2Source to open the script in VDub. Again, it's explained in the docs. Once you get it open then add in the other filters. Check them out in VDub and make sure everything is okay. DVD2AVI is way too old and hasn't been used in probably more than a decade.

    What you use to encode depends on what you want to do. I use RipBot264, which opens AviSynth scripts, and make MP4s. Or HC-Enc if you're making another DVD. You might want to resize as well, if converting to a different format. And there are many other encoders.
    Last edited by manono; 3rd Jan 2020 at 22:57.
    Quote Quote  
  7. Originally Posted by Bencuri View Post
    What software did you use to convert?
    x264 cli:

    Code:
    x264 --preset=slow --tune=animation --crf=18 --keyint=50 --sar=8:9 --colormatrix=smpte170m --stitchable --output "output.mkv" "input.avs"
    Quote Quote  
  8. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    But would this script work in case I would open a .avi with it? So that I replace every video.d2v in it to my video.avi? Or those particular plugins only work with the d2v extension? I know I need avisource then, not mpegsource.
    Quote Quote  
  9. Originally Posted by Bencuri View Post
    But would this script work in case I would open a .avi with it? So that I replace every video.d2v in it to my video.avi?
    AviSource("filename.avi"). You may need to add AssumeTFF() right after it.

    Originally Posted by Bencuri View Post
    Or those particular plugins only work with the d2v extension? I know I need avisource then, not mpegsource.
    You don't need DgMpgDec if you don't use Mpeg2Source(). Nothing else in the script uses DgMpgDec. Note that I used the de-ringing filter in Mpeg2Source(). Without it you'll have a little more DCT ringing noise.
    Quote Quote  
  10. On the other hand, if the source is a DVD - as yours is - then you should almost certainly be using MPEG2Source.
    Quote Quote  
  11. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    I had to break this project, but recently I returned to it and tried to convert the videos according to your directions using the code jagabo suggested above. The outcome is in the attached file. The results are good, but there are a few oddities that I would like to solve if possible.

    One is that when I play the file from USB drive on TV, the image is almost always streched to widecreen, thus sharpness is lost and the shapes become odd as usual. Is it possible to save a tag or something like that in the code that forces the TV to leave this in 4:3? When I play back from USB drive, the TV doesn't let me modify the image properties. If there is no tag like that, is it possible to make avisynth turn the video into 16:9 by adding letterboxes to the sides?

    The other problem is, that when I watch the video from the media player or right on the PC, the aspect ratio is fine, however, the shapes are still improper. Everything looks a bit elongated vertically. I guess this is because the resulting file is 704x480. How to overcome this problem?

    And finally, just something I do not understand about the last filer: aWarpSharp2(depth=10). In my case, the source, that is attached to the first post as well, is interlaced. aWarpSharp2 manual says only progressive input is accepted. Are you sure no separating of fields is needed before using this plugin?

    Here is jagabos's code again that I used:

    Code:
    Mpeg2Source("video.d2v", CPU2="ooooxx", Info=3) 
    Crop(8,0,-8,-0, align=true)
    CheckMate(thr=10, max=20, tthr2=0)
    SeparateFields()
    VInverse()
    Weave()
    TFM(d2v="video.d2v") 
    TDecimate()
    Santiag()
    aWarpSharp2(depth=10)
    And the outcome I produced attached.
    Image Attached Files
    Quote Quote  
  12. The 4:3 DAR flag is already set in your M2V file. If your TV plays it as 16:9 it's the TV's fault. Some workarounds you can try: resize the video to a 4:3 frame size like 640x480 -- e.g. Spline36Resize(640,480). Try a different codec or container. Does your TV play the h.264 MKV file I uploaded? Does it play MP4 files?

    The character is sligtly stretched in your source video. Is the character supposed to be perfectly round? You can always crop/resize to adjust for that.

    After TFM your video is no longer interlaced. So aWarpSharp2 has no problems with it.
    Quote Quote  
  13. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    In the meantime, I experimented with adding letterbox to the video with AddBorder in avisynth. It makes the image kind of okay. Cannot test the mkv, because the TV doesn't recognise that format. However it plays the 4:3 mp4 fine.

    The octopus in the resulting video is a bit elongated, though. I would modify that a bit. So you mean if I add different values to the Crop command in your script, I could improve that, for example by cropping some px from the top and bottom? In case of choosing resizing as solution instead, you mean using one of those resize methods like Spline...or others and simply resizing it to the desired value?

    I have exported the video in interlaced, now I see it was a mistake for the reasons you mention.
    Last edited by Bencuri; 24th Jan 2020 at 10:31.
    Quote Quote  
  14. I wouldn't use MPEG 2. It's much less efficient (quality per bitrate) than h.264. I'd recommend h.264 in MP4 since your TV can play that. See if your TV plays the attached video, with the correct 4:3 aspect ratio (still with the slightly too tall character, we can deal with that later). It's the video from the MKV file I posted along with the AC3 audio from your original MPG file. It might be necessary to convert the audio to ACC (some devices don't support AC3 in MP4).
    Image Attached Files
    Quote Quote  
  15. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    Your file has very good quality, but my TV stretches it. What it doesn't stretch are the mp4s made by Sony Vegas. I attached them here. However when using this software the output has bad quality of course due to the artifacts.

    By the way, I noticed how the image shapes will be correct on TV. The source pixel aspect ratio is 1,0926 (PAL DV), but in case I export it in 1,0000 it will be fine. The image is only elongated in case I leave it on the original value. Among the attached files, "otest" is 1,0926 (PAL DV), "otest2" is in 1,0000.
    Image Attached Files
    Quote Quote  
  16. So my MP4 file is stretched to 16:9 just like my earlier MKV file?

    I'll grant the character is more circular in otest2.mp4. But the source video you provided is NTSC 720x480 29.97 fps 4:3 DAR. Why would the sampling aspect ratio be 1.0926? That's for PAL video, 704x576 25 fps 4:3 DAR.
    Quote Quote  
  17. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    Yes, your test.mp4 appears stretched to 16:9.

    What resulted in the confusion here is that one of the DVDs from this series is PAL. Recently I was working on that, and in the rush, I forgot to open the NTSC project in Vegas, so I just test rendered from the PAL version. But the essence is the same in both cases: the TV stretches the video to 16;9 in case it is left in 704 x 480 or 576. The project needs to be rendered in FullHD so that the TV leaves the video in 4:3.

    Now regarding shapes elongation: no matter what the resolution is, FullHD or DVD, in case the video from the rendered project is left in the DVD pixel aspect ratio value, the shapes will appear elongated on TV. That is, the mpegs I created with running your script and rendering from the NTSC source with HCEnc, those mpegs appear with elongated shapes on TV, too. I know this from that when you play the rendered files from a mediaplayer on TV, the fact that the mediaplayer is the source makes the TV respect the 4:3 aspect ratio, but still, the shapes are elongated, in case the display option on TV is set to 'original'. However in that case, the TV allows for image format adjustment, and you can select a display option that compensates it. This option is not available when you play the files directly from USB drive plugged into the TV. Moreover when playing back on PC, the shapes are also elongated, in case the videos are in DVD pixel aspect ratio. So I think this should be rendered in FullHD with 1,0000 pixel aspect ratio, or in 704x480 or 576 with an appropriate letterbox (in this case you can leave the original pixel aspect ratio). In case of the NTSC version, I experimented with AddBorder and found by adding about 88px as border on both sides makes the video appear kind of okay, in case you render the file as 16:9. In this file the image is 704px wide, and the extra is meant over that.

    So what I would be interested in: how to tell the x264 cli to render the stuff with 1,0000 pixel aspect ratio? ...Or HCEnc. Though, seeing what the TV does I think it would be better starting over and render the stuff again in FullHD mp4, omitting HCEnc. That would only be useful in case I would play the videos back from DVD disc from the player, not directly from USB.
    Last edited by Bencuri; 25th Jan 2020 at 16:38.
    Quote Quote  
  18. Originally Posted by Bencuri View Post
    The project needs to be rendered in FullHD so that the TV leaves the video in 4:3.
    No it doesn't. Just resize the final version to 640x480 or whatever 1.33:1 ratio you like.

    Is your defective television going to stretch that as well? Are you sure you have the aspect ratio settings correctly configured for the television? Have you tried fooling around with them?
    Quote Quote  
  19. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    You can tweak the display settings on TV except for the case when you plug a USB drive into it and play the files from that. The TV won't allow you modify those settings in that case, only color settigs. I have two TVs, this is the same on both. You can also set 4:3 display in the setup, but it will be omitted as well in case of USB playback. I would like to show these cartoons to kids in my family, everyone have panel TV but no media player. In case they would have, all this would not be an issue, but as they don't have, I have to tweak the files instead.

    I might render in 640x480, but in that case quality will degrade, won't it? I would like the image to be as sharp as possible.
    Quote Quote  
  20. Originally Posted by Bencuri View Post
    I would like the image to be as sharp as possible.
    Even if everyone's fat?

    Me, I have no problem at all enjoying videos resized to 640x480 from 704x480. If 640x480 isn't stretched (and it probably will be stretched), then I'd resize in a heartbeat. Otherwise you might wind up resizing to 640x480 and then using the AddBorders command to turn it into a 'widescreen' video. Something like:

    Spline36Resize(640,480)
    AddBorders(108,0,106,0)
    Last edited by manono; 25th Jan 2020 at 20:56.
    Quote Quote  
  21. Originally Posted by Bencuri View Post
    I might render in 640x480, but in that case quality will degrade, won't it? I would like the image to be as sharp as possible.
    Not really. The analog source didn't even have 640 pixels of resolution horizontally.

    Here's what I came up with:

    Code:
    Mpeg2Source("video.d2v", CPU2="ooooxx", Info=3) 
    Crop(8,0,-8,-0, align=true)
    ColorMatrix(mode="rec.601->rec.709")
    SeparateFields()
    VInverse()
    Weave()
    TFM(d2v="video.d2v") 
    TDecimate()
    Spline36Resize(400,360)
    Santiag()
    TemporalDegrain2() # omit this if the processing is too slow for you
    MergeChroma(aWarpSharp2(depth=5), aWarpSharp(depth=15))
    
    # upscale and correct aspect ratio
    
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=800, fheight=720)
    aWarpSharp2(depth=10)
    Sharpen(0.5)
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1488, fheight=1080)
    aWarpSharp2(depth=5)
    Sharpen(0.3)
    ChromaShiftSP(x=-1, y=1)
    AddBorders(216,0,216,0)
    This ignores the SAR of the source and makes the octopus very round.
    Image Attached Files
    Last edited by jagabo; 25th Jan 2020 at 20:40.
    Quote Quote  
  22. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    Thank you! I am away but will go home soon and check this on TV.
    Quote Quote  
  23. Here's another variation:

    Code:
    Mpeg2Source("video.d2v", CPU2="ooooxx", Info=3) 
    Crop(8,0,-8,-0, align=true)
    ColorMatrix(mode="rec.601->rec.709")
    SeparateFields()
    VInverse()
    Weave()
    TFM(d2v="video.d2v") 
    TDecimate()
    Santiag()
    MergeChroma(aWarpSharp2(depth=5), aWarpSharp(depth=15))
    dehalo_alpha(rx=3.0, ry=2.0)
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=800, fheight=720)
    aWarpSharp2(depth=10)
    Sharpen(0.5)
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1488, fheight=1080)
    aWarpSharp2(depth=5)
    Sharpen(0.3)
    ChromaShiftSP(x=-1, y=1)
    AddBorders(216,0,216,0)
    It doesn't remove all the dot crawl artifacts but it's fast, less distorted, sharper, and has less pronounced halos.
    Image Attached Files
    Quote Quote  
  24. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    I have just tested the last one: dehalo.mkv on TV and WOW the quality is amazingly superb! I never wondered it can be improved that much from this source. Moreover this way the TV doesn't stretch it, and the shapes are fine, no elongations. Thanks a lot!

    Did you use the same commands that you added here earlier to convert?

    Code:
    x264 --preset=slow --tune=animation --crf=18 --keyint=50 --sar=8:9 --colormatrix=smpte170m --stitchable --output "output.mkv" "input.avs"

    And about the avisynth script: do you add both upscaling command at the same time, or I pick either one, leave that in the script and omit the other:

    Code:
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=800, fheight=720)
    aWarpSharp2(depth=10)
    Sharpen(0.5)
    Code:
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1488, fheight=1080)
    aWarpSharp2(depth=5)
    Sharpen(0.3)
    Quote Quote  
  25. Originally Posted by Bencuri View Post
    Did you use the same commands that you added here earlier to convert?

    Code:
    x264 --preset=slow --tune=animation --crf=18 --keyint=50 --sar=8:9 --colormatrix=smpte170m --stitchable --output "output.mkv" "input.avs"
    No. I used something like:

    Code:
    x264 --preset="slow" --tune="animation" --crf=20 --ref 4 --bframes 3 --keyint=50 --sar=1:1 --colormatrix=bt709 --output "output.mkv" "input.avs"
    Originally Posted by Bencuri View Post
    And about the avisynth script: do you add both upscaling command at the same time, or I pick either one, leave that in the script and omit the other
    I used both. The idea is to upscale partially, sharpen, then upscale the rest of the way and sharpen again. That gives sharper and smoother edges than a single upscale to the final size.
    Quote Quote  
  26. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    Well, I managed to complete the steps and make a file similar to yours. Here is it attached. Now my only questions are: would it have any use converting with the 10-bit depth variant of the encoder in case of this source? And would it make sense to raise encoding bitrate to ensure the best possible display quality on TV, or it won't look better than the default bitrate I got?
    Image Attached Files
    Quote Quote  
  27. That type of animation doesn't have much in the way of gradients so 10 bit encoding probably won't make much difference. CRF 20 is a moderate quality level for 1080p video. But you will be able to see small differences, say with CRF 15, if you look at still frames with a magnifier. I suggest you try it and see if you think it's worth the extra bits. Adding a temporal NR filter (like I did in earlier scripts with TD2) after Santiag will reduce a lot of the remaining edge artifacts -- if you can stand the extra encoding time.
    Quote Quote  
  28. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    Unfortunately I couldn't load the newest version of TemporalDegrain2 with the script, but I managed to complete it with the 2.1.2 version, and I do see the difference. A bit better image overally. I will consider using it later depending on how much time I can devote to this. I only have Intel HD4000 GPU, so it is not lightning fast. Not that seriously long conversion time though, either.

    All in all, many thanks for the help, now this level of quality will surely be suitable for enjoying from the HDTV screen!
    Quote Quote  



Similar Threads