Log in

View Full Version : How to fix Telecined DVD


Pages : [1] 2

MysteryX
12th January 2015, 03:13
I have ripped a DVD with MakeMKV to preserve the original data, and am now attempting to convert it with AviSynth.

However, the videos are showing interlacing artifacts during fast movements
http://s16.postimg.org/bphxlwl29/Interlacing.jpg (http://postimg.org/image/bphxlwl29/)

What is the best way to solve this problem?

As of right now, I'm first converting the video to AVI with
FFMPEG -i "source" -vcodec utvideo -an "destination"

Does this video conversion interfere with the de-interlacing process? What should I do then?

MysteryX
12th January 2015, 04:34
Interestingly enough, the source file has interlacing artifacts when playing in MPC-HC but plays well in Windows Media Player!? Why is that?

The AVI conversion, however, causes Windows Media Player to also show interlacing artifacts.

MysteryX
12th January 2015, 05:02
I'm giving TempGaussMC a try but can't get it to run. For Repair, RSharpen and RemoveGrain, the only version that loads is the "S" version. For Repair.dll or RepairSSE2.dll, it says "Unable to load Repair.dll".

And now, I'm still getting "Unable to load DenoiseSharpen.dll"

I'm using AviSynth 2.6 MT

What do I need to do to get it running?

And is there a better alternative that has less dependencies?

PluginPath = "Encoder\"
AviSource("test.avi", audio=false, pixel_type="YV12")
Import(PluginPath+"TempGaussMC_beta2.avsi")
LoadPlugin(PluginPath+"nnedi2.dll")
LoadPlugin(PluginPath+"masktools2.dll")
LoadPlugin(PluginPath+"mvtools2.dll")
LoadPlugin(PluginPath+"RepairS.dll")
LoadPlugin(PluginPath+"RSharpenS.dll")
LoadPlugin(PluginPath+"RemoveGrainS.dll")
LoadPlugin(PluginPath+"DenoiseSharpen.dll")
TempGaussMC_beta2(EdiMode="NNEDI2")
LoadPlugin(PluginPath+"nnedi3.dll")
nnedi3_rpow2 (2)
nnedi3_rpow2 (2)
Spline36Resize(960, 720)
ConvertToRGB32()

bilditup1
12th January 2015, 06:02
I'm giving TempGaussMC a try but can't get it to run. For Repair, RSharpen and RemoveGrain, the only version that loads is the "S" version. For Repair.dll or RepairSSE2.dll, it says "Unable to load Repair.dll".


I'm no expert, but try using RgTools.dll instead. It's a modern rewrite of Kassandro's originals all in one DLL. Has worked pretty well for me so far.

See here (http://avisynth.nl/index.php/RgTools) and here (http://forum.doom9.org/showthread.php?p=1655989#post1655989).

Might be a silly question, but do you know if your source is actually interlaced, or film that's been telecined? Have you tried TIVTC already?

bilditup1
12th January 2015, 06:07
As for more modern IVTC, with lots of specifics for quirks of anime, have you seen this?
http://forum.doom9.org/showthread.php?t=170364

colours
12th January 2015, 13:14
Join Date: Apr 2014
Posts: 145

You're not new here, you should know the drill: post an unprocessed sample of your source.

Simply going by your script, the immediately obvious possible improvements are that you should use nnedi3_rpow2(rfactor=4,fwidth=960,fheight=720,cshift="spline36resize") instead of nnedi3_rpow2(2).nnedi3_rpow2(2).Spline36Resize(960,720) and that converting to RGB is pointless if you're going to encode it in a YCbCr format.

LemMotlow
12th January 2015, 14:11
I have ripped a DVD with MakeMKV to preserve the original data, and am now attempting to convert it with AviSynth.I didn't know one could "rip" DVD with MakeMKV. Rip has a specific meaning. Re-encoding isn't ripping. Re-encoding does not preserve the original DVD data.

However, the videos are showing interlacing artifacts during fast movements

What is the best way to solve this problem?They're de-interlace artifacts. From your image, the video is likely telecined, not interlaced.

I'm giving TempGaussMC a try but can't get it to run. For Repair, RSharpen and RemoveGrain, the only version that loads is the "S" version. For Repair.dll or RepairSSE2.dll, it says "Unable to load Repair.dll".

And now, I'm still getting "Unable to load DenoiseSharpen.dll"

I'm using AviSynth 2.6 MT

What do I need to do to get it running?

And is there a better alternative that has less dependencies?No. Try yadif. Yadif is used by some media players to deinterlace during play.

Why are you using TempGaussMC with AVisynth 2.6 MT? Without special settings in MT for many older filters, that could be the source of your problem. You also have support dll's all over the place. People do that sometimes, but you do have to go through hoops to keep everything straight. TempGaussMC is OK, but try the newer QTGMC. Get the download package http://forum.doom9.org/showthread.php?t=156028 and follow instructions in the help files for loading the dll's and other stuff. If your source video is telecined, no deinterlacer will work properly. Try TIVTC.

Why are you running nnedi3 twice?

Why resize to 960x720 (4:3)? What do you want for output? There is no such thing as 960x720 for any HD format, unless you are pillarboxing that image inside a 1280x720 frame for BluRay/AVCHD -- most HD formats are 16:9. If you inverse-telecine a film source, the resulting frame rate is usually 23.976. Is the final video for PC playback only?

Why are you converting to RGB32?

Either you left out some information, or I'm missing something.

HD formats, encoding, parameter limits, etc.: http://forum.doom9.org/showthread.php?t=154533

wonkey_monkey
12th January 2015, 14:49
I didn't know one could "rip" DVD with MakeMKV. Rip has a specific meaning. Re-encoding isn't ripping. Re-encoding does not preserve the original DVD data.

MakeMKV (http://www.makemkv.com/) is a somewhat ambiguously-named DVD/Bluray ripper. It rips to an MKV container, but doesn't re-encode video.

cihub
12th January 2015, 15:57
Interestingly enough, the source file has interlacing artifacts when playing in MPC-HC but plays well in Windows Media Player!? Why is that?

The AVI conversion, however, causes Windows Media Player to also show interlacing artifacts.

Most likely they use different set of filters: MPC has an ability to use not installed filters, while WMP uses only installed DirectShow filters.

IMO you'll spare yourself a great deal of time if you will simply use QTGMC, and if you want maximum quality, use this: qtgmc(preset="placebo", sourcematch=3, sharpness=0, tr2=3, lossless=2, noiseprocess=1, noisepreset="slow").selecteven(). To speed things up a bit you might add chromamotion=false. Although, depending on source all may need to do is to add this after loading clip: TFM(pp=0). Still, it'd be better to rip it properly, with DGIndex and then load d2v's:
d2v="VTS_01_1.d2v"
MPEG2Source(d2v=d2v, cpu=0, idct=5)
ColorMatrix(d2v=d2v, interlaced=true)
TFM(d2v=d2v, pp=0)

LemMotlow
12th January 2015, 17:38
MakeMKV (http://www.makemkv.com/) is a somewhat ambiguously-named DVD/Bluray ripper. It rips to an MKV container, but doesn't re-encode video.Hmm, interesting point but who wants MPEG in an mkv container? If it works, it works. Seems like the long way around.

LemMotlow
12th January 2015, 17:42
Most likely they use different set of filters: MPC has an ability to use not installed filters, while WMP uses only installed DirectShow filters.

IMO you'll spare yourself a great deal of time if you will simply use QTGMC, and if you want maximum quality, use this: qtgmc(preset="placebo", sourcematch=3, sharpness=0, tr2=3, lossless=2, noiseprocess=1, noisepreset="slow").selecteven(). To speed things up a bit you might add chromamotion=false. Although, depending on source all may need to do is to add this after loading clip: TFM(pp=0). Still, it'd be better to rip it properly, with DGIndex and then load d2v's:
d2v="VTS_01_1.d2v"
MPEG2Source(d2v=d2v, cpu=0, idct=5)
ColorMatrix(d2v=d2v, interlaced=true)
TFM(d2v=d2v, pp=0)Interesting point about WMP, but I never see interlace or telecine problems in MPC unless there's something weird about the source. Maybe an unsuitable render setting in MPC ? ?

Thanks for details on the QTGMC and DGIndex parameters. Will save those and try 'em in my own work.

MysteryX
12th January 2015, 20:47
You're not new here, you should know the drill: post an unprocessed sample of your source.
I'll post a sample later

Why are you running nnedi3 twice?
I'm auto-generating this script. Based on the preset, I either run NNEDI3+EEDI3, EEDI3+NNEDI3 or NNEDI3+NNEDI3. Is there an output or performance difference between calling nnedi3_rpow2(2) twice and calling nnedi3_rpow2(4)?

Why resize to 960x720 (4:3)? What do you want for output? There is no such thing as 960x720 for any HD format, unless you are pillarboxing that image inside a 1280x720 frame for BluRay/AVCHD -- most HD formats are 16:9. If you inverse-telecine a film source, the resulting frame rate is usually 23.976. Is the final video for PC playback only?
For 288p VCDs, I found upscaling to 720p to provide the best results. For DVDs, I might upscale it to 1080p. I still have to test what works best to improve the source quality.

[/QUOTE]Why are you converting to RGB32?[/QUOTE]
ConvertToRGB32 is when I want to preview in Windows Media Player, as it won't work otherwise, but for the actual encoding I remove it.

Interesting point about WMP, but I never see interlace or telecine problems in MPC unless there's something weird about the source. Maybe an unsuitable render setting in MPC ?
MPC is always playing fine, there's most likely something wrong with the video source so that's why I want to fix the source.

Hmm, interesting point but who wants MPEG in an mkv container? If it works, it works. Seems like the long way around.
You lose quality every time you re-encode content. Doing it this way allows to store the content of the DVD while preserving the exact source quality. However, x264 compresses data twice better than DVDs so it's still recommended to re-encode it. I'd way the best way to encode a DVD is to take the exact source data, process it via AviSynth to upscale it, and instead of compressing to get a file size twice smaller, upscale it and get better image quality in the same file size. And best of all: after processing the video, you can muxe the original audio right back in to get optimized and re-encoded video with unaltered audio.

IMO you'll spare yourself a great deal of time if you will simply use QTGMC
I'm giving it a try, with the modded MT package, but am getting 2 errors:
Cannot load SSE2Tools.dll
yadiff.dll is not an AviSynth 2.6 or 2.5 plugin

MysteryX
12th January 2015, 20:55
I tried the DLLs in the modded MT package, as well as this experimental 2.6 package, and get the 2 same errors in both cases.
http://forum.doom9.org/showpost.php?p=1568142&postcount=1126

Reel.Deel
12th January 2015, 22:23
I tried the DLLs in the modded MT package, as well as this experimental 2.6 package, and get the 2 same errors in both cases.
http://forum.doom9.org/showpost.php?p=1568142&postcount=1126

That experimental 2.6 package is not compatible with the latest AviSynth 2.6 (Alpha 4/5, AviSynth MT, AviSynth+), best advice is to forget that package even exists!

I'm giving it a try, with the modded MT package, but am getting 2 errors:
Cannot load SSE2Tools.dll

SSETools is only a necessary evil if you're want YUY2 support with QTGMC. More than likely you're processing YV12 so it's not needed. If for some reason you do need YUY2 support then SSE2Tools.dll requires the MSVCR71.DLL runtime. If you don't know what I'm talking about then just use the static SSEToolsS.dll which does not require any dependencies.


yadiff.dll is not an AviSynth 2.6 or 2.5 plugin

Yadif is not a regular AviSynth plugin, it's a C plugin meaning that it cannot be auto-loaded and it has to loaded with LoadCPlugin("yadif.dll") (http://avisynth.nl/index.php/Plugins#LoadCPlugin)

MysteryX
12th January 2015, 22:35
Thanks. I removed SSE2Tools and can now load yadif.dll. I instaled the modded MT package.

Now I'm getting this error: Cache: Filter returned invalid response to CACHE_GETCHILD_CACHE_MODE. 97579152

I'm using AviSynth 2.6 MT but haven't yet activated MT for this test.

Here's a source video
https://www.spiritualselftransformation.com/misc/GeeDVD.mkv

Reel.Deel
12th January 2015, 22:46
I tried the DLLs in the modded MT package, as well as this experimental 2.6 package
http://forum.doom9.org/showpost.php?p=1568142&postcount=1126

I instaled the modded MT package.

Now I'm getting this error: Cache: Filter returned invalid response to CACHE_GETCHILD_CACHE_MODE. 97579152

I'm using AviSynth 2.6 MT but haven't yet activated MT for this test.

I repeat, that experimental 2.6 package is not compatible with the latest AviSynth 2.6 (Alpha 4/5, AviSynth MT, AviSynth+), best advice is to forget that package even exists!

MysteryX
12th January 2015, 23:28
I have the MT package, not the 2.6 package
http://forum.doom9.org/showthread.php?t=156028

"Modded Plugins Package
Same as above, but these plugins contain threading fixes that can improve stability under MT."

I could give the regular ones a try, although they may have problems with MT?

With the regular ones, on top of getting the same cache error, I also get Unable to load RepairSSE2.dll and RemoveGrainSSE2.dll

MysteryX
12th January 2015, 23:45
OK it works if I instead use AviSynth 2.5.8 MT, so the issue is with 2.6 incompatibility.

However, the images is then VERY shaky so this isn't the solution.

Reel.Deel
12th January 2015, 23:48
Ok, the MT package should be mostly compatible AviSynth 2.6 but don't use the MaskTools2 from any of those packages. Also be aware that some of those plugins included are outdated.
Please read this post for full information: http://forum.doom9.org/showpost.php?p=1699950&postcount=1857

MysteryX
13th January 2015, 00:07
Now if I want to use TIVTC, it appears I cannot do it on an AviSource?

Do I have to open it with MPEG2Source, and use DGIndex.exe on the source video? That's a completely different work-flow! And if that's required, can DGIndex.exe generate the d2v file from the command prompt without requiring graphical interface?

Reel.Deel
13th January 2015, 00:32
TIVTC does not care what method you use to load your video, but if you do use DGMPGDec, TFM can optionally use the "d2v" file. Since you finally uploaded a source (which you should of done from the start) I can see that's is telecined, meaning you do not have to deinterlace, only IVTC (except some of the overlayed graphics are truly interlaced, but that's a different story). Since this is an actual MPEG2 file why not just use DGMPGDec from the get-go? It's certainty more straight forward than converting to an AVI file. Anyways here's the DGMPGDec quick start guide (http://neuron2.net/dgmpgdec/QuickStart.html) and the documentation for DGIndex (http://neuron2.net/dgmpgdec/DGIndexManual.html) and DGDecode (http://neuron2.net/dgmpgdec/DGDecodeManual.html), it should have everything you need to know.

MysteryX
13th January 2015, 02:12
DGIndex doesn't work with MKV DVD files so I'll stick to the AVI conversion. I'm doing it that way to avoid all the complications of opening and supporting various file types.

In the TIVTC documentation page, it lists several ways of using it and all are using a D2V file.
http://avisynth.nl/index.php/TIVTC

How can I use it without the D2V file and how do I know which syntax is the right one to use?

MysteryX
13th January 2015, 02:17
Ah, got it.

LoadPlugin(PluginPath+"TIVTC.dll")
tfm()

This works and remove the telecine effects. No other dependencies required, I like that.

Do I need any of the other options? What is specifying a D2V file good for?

Edit: tfm does remove the telecine... but generates a considerable amount of noise! Is there a way to reduce that? I supposed it should be called first before applying any other filters (denoise, resize, etc)?

MysteryX
13th January 2015, 02:43
This is my script so far. I'm running a test encode to see what the 1080p output looks like.

SetMTMode(3,4)
PluginPath = "Encoder\"
AviSource("Job1_Input.avi", audio=false, pixel_type="YV12")
SetMTMode(2)
LoadPlugin(PluginPath+"TIVTC.dll")
tfm()
Crop(0, 2, -0, -0)
LoadPlugin(PluginPath+"FFT3DFilter.dll")
fft3dfilter(sigma=3, bt=5, bw=48, bh=48, ow=24, oh=24, ncpu=8)
LoadPlugin(PluginPath+"nnedi3.dll")
nnedi3_rpow2 (2)
nnedi3_rpow2 (2)
Spline36Resize(1448, 1080, 0, 4, -0, -0)
fft3dfilter(bt=-1, sharpen=0.1, ncpu=8)
Distributor()

Reel.Deel
13th January 2015, 03:07
It's been a while since I've used Avisynth MT but if I remenber correctly TIVTC does not play nice in MT mode. Only use mode 2 after TFM() and TDecimate().

PluginPath = "Encoder\"
LoadPlugin(PluginPath+"TIVTC.dll")
LoadPlugin(PluginPath+"FFT3DFilter.dll")
LoadPlugin(PluginPath+"nnedi3.dll")

SetMTMode(3,4) # you can also try mode 5
AviSource("Job1_Input.avi", audio=false, pixel_type="YV12")
tfm()
TDecimate()
SetMTMode(2)
Crop(0, 2, -0, -0, align=true) # good practice
fft3dfilter(sigma=3, bt=5, bw=48, bh=48, ow=24, oh=24,ncpu=8)
nnedi3_rpow2 (4)
Spline36Resize(1448, 1080, 0, 4, -0, -0)
fft3dfilter(bt=-1, sharpen=0.1, ncpu=8)
Distributor()

MysteryX
13th January 2015, 03:36
Here are the results of the first encode with quality 20. Source file is 166MB, output is 241MB so next time I'll lower the quality.

Before (in Windows Media Player)
http://s1.postimg.org/6ntyppcrf/Gee_Before.jpg (http://postimg.org/image/6ntyppcrf/)

After (in MPC-HC with madVR and SVP disabled)
http://s16.postimg.org/h9kmmvk41/Gee_After.jpg (http://postimg.org/image/h9kmmvk41/)

First, the colors have changed so I supposed I have to add ColorMatrix(mode="Rec.601->Rec.709") ?

Second, although the faces look better, there is extra noise being inserted, especially in the yellow ceiling!

It seems something is right and something is wrong with this test.

LemMotlow
13th January 2015, 19:04
DGIndex doesn't work with MKV DVD files so I'll stick to the AVI conversion. I'm doing it that way to avoid all the complications of opening and supporting various file types.There's no such thing a "MKV DVD" file. It's either a DVD or it's an MKV with MPEG2 inside of it.

In the TIVTC documentation page, it lists several ways of using it and all are using a D2V file.That's correct. You're going though an extra step making an MKV wrapper. DGIndex reads MPEG2 directly and by specifying "save project" it creates a smaller d2v file (which is an index) for reading with DGIndex in Avisynth, and audio is in an AC3 file.

How can I use it without the D2V file and how do I know which syntax is the right one to use?You need the d2v file for DGIndex to work.
MPEG2Source("drive"\path to d2v\filename.d2v")
You don't always need those extra DGIndex parameters. Follow that immediately with your TIVTC code.

Your TFM() all by itself makes a 29.97fps file with duplicate frames in this pattern, starting with frame 1 of your sample:

A A B C D D E F F G H I I J K L L M N O O P Q Q

and so on. Every 11 frames has 3 duplicate frames in an uneven pattern. This looks like PAL-NTSC conversion on the DVD with odd combo of duplicate and telecined frames. Horizontal camera pans have bad stutter and other problems.

Your MKV looks like it's re-encoded IMO. Maybe the DVD just looks that raw to begin with, but there are compression artifacts all over the place and the bitrate is too low for fast action video, which is why you see all that noise. It's possible that your mkv software ain't reading that DVD correctly.

If you want to make BluRay/AVCHD with the 1440x1080 29.97p output file be advised that 1440x1080p @ 29.97 is not valid. It has to be interlaced 29.97 NTSC/25 PAL or film speed 23.976/24 fps progressive. Or maybe you just want PC playback? http://forum.doom9.org/showthread.php?t=154533

If you want an unprocessed sample from MPEG2, use DGIndex to cut a sample and use "Demux video". It will make an m2v sample file an an AC3 file with the audio to match it. We have no idea how you used mkvmerge or makemkv or whatever to make that sample file, but it looks kinda screwed up.

:)

MysteryX
13th January 2015, 20:30
There's no such thing a "MKV DVD" file. It's either a DVD or it's an MKV with MPEG2 inside of it.
Either way, DGIndex cannot open it.

That's correct. You're going though an extra step making an MKV wrapper. DGIndex reads MPEG2 directly and by specifying "save project" it creates a smaller d2v file (which is an index) for reading with DGIndex in Avisynth, and audio is in an AC3 file.
The DVD has 35 tracks and that's the only way I know to split them up in individual files while preserving the original data.

You need the d2v file for DGIndex to work.
Doesn't DGIndex CREATE that d2v file?

Your TFM() all by itself makes a 29.97fps file with duplicate frames in this pattern, starting with frame 1 of your sample:

A A B C D D E F F G H I I J K L L M N O O P Q Q

and so on. Every 11 frames has 3 duplicate frames in an uneven pattern. This looks like PAL-NTSC conversion on the DVD with odd combo of duplicate and telecined frames. Horizontal camera pans have bad stutter and other problems.
Ok. So the source is definitely screwed up. How can that be fixed?

Your MKV looks like it's re-encoded IMO. Maybe the DVD just looks that raw to begin with, but there are compression artifacts all over the place and the bitrate is too low for fast action video, which is why you see all that noise. It's possible that your mkv software ain't reading that DVD correctly.
Playing the DVD in MPC-HC gives the exact same output, so that's the way it is on the DVD and MakeMKV doesn't alter it.

If you want to make BluRay/AVCHD with the 1440x1080 29.97p output file be advised that 1440x1080p @ 29.97 is not valid. It has to be interlaced 29.97 NTSC/25 PAL or film speed 23.976/24 fps progressive. Or maybe you just want PC playback?
Why the heck would I want to encode it on a Blueray? My laptop doesn't have a Blueray drive, even less a Blueray writer, to begin with. I'm moving it *out* of DVD, not *onto* DVD/Blueray. I can just plug the TV via HDMI.

The weird thing is: how does Windows Media Player do to play that file properly? Since WMP can play it fine, I thought perhaps Microsoft Expression Encoder 4 would read it in the same way and re-encode it fine, but Expression Encoder shows very bad artifacts.

LemMotlow
13th January 2015, 21:12
Hmm, don't have to be ornery. Gotta ask some questions to help figure out what's going on.

I understand your source to be a DVD. Correct me if I'm wrong there. Regardless of the number of tracks, a DVD is a bunch of VOB files. Something free like DVD2MPG can make that a single big MPEG or let you make several MPG's from the various tracks. DGIndex can read the VOB's right off the DVD or can read the MPG or MPG's directly. It will make a d2v project file and a separate AC3 audio file, which you can join later or join in VirtualDub during Avisynth's run or other software when you process or encode. Avisynth is used to read the d2v project files and let do your Avisynth processing.

I don't know how you're testing your denoisers or other filters, but you don't have to test the whole video at once. You can pick shorter segments, run your tests, then act accordingly.

As you say, if the original video plays with lots of noisy junk, then so be it. It's in the original, so all you can do is clean it up.

Reason I asked if you wanted "standard" formats is because 1440x1080 is regulation format for 4:3 HD. If you want PC playback, you can be loose with the standards and go with mkv or whatever.

Will see what I can come up with for the noise, but that weird frame structure isn't uncommon for imports. At least it's not from India, or you'd really up a tree. I'm not too great at out-figuring what some labs do with these frame rate conversions, maybe others can suggest a fix for the frame dupes. The IVTC doesn't play too bad on MPC-BE.

There's no way anyone would suggest using Microsoft's encoders for anything. Lordy, it's real crap. Don't expect much from it. Plenty of better encoders around, and free.

MysteryX
13th January 2015, 21:34
I understand your source to be a DVD. Correct me if I'm wrong there. Regardless of the number of tracks, a DVD is a bunch of VOB files. Something free like DVD2MPG can make that a single big MPEG or let you make several MPG's from the various tracks.
A big MPEG file isn't useful as I would then have to manually find the exact right frame where to split each video. As for DVD2MPG, it is a capture program that re-encodes the videos. I could use Handbrake which would be simpler. However, whenever you re-encode, you lose quality -- except if you're enhancing the video before re-encoding. I'd rather work with unaltered source to avoid an extra unnecessary conversion.

Reason I asked if you wanted "standard" formats is because 1440x1080 is regulation format for 4:3 HD. If you want PC playback, you can be loose with the standards and go with mkv or whatever.
I can't stick to standards without re-encoding audios. With VCDs, I could process and enhance the video and then merge it back with the MP2 audio of the source file with FFMPEG and it's perfect. At least in MKV. I can also merge it back into a MP4 container with MP2 audio but Windows Media Player cannot play those files. So unless I want to re-encode the audio which I don't want to, I have to forget about standards. I just want it to be YouTube-friendly if I want to upload some.

There's no way anyone would suggest using Microsoft's encoders for anything. Lordy, it's real crap. Don't expect much from it. Plenty of better encoders around, and free.
Before making the decision to dive into the AviSynth rabbit-hole, Microsoft Expression Encoder 4 was actually the best encoder I found that
1. Is stable and reads all formats properly
2. Doesn't distort pixel aspect ratio
3. Has graphical interface that allows me to easily define right crop settings
4. Has more advanced resize filters (Lanczos and Supersampling)

I tried at least a dozen others and always ran into problems. Microsoft doesn't support it anymore as they moved on to instead provide cloud video processing services for servers.

Now, with AviSynth + FFMPEG + x264, I found a better alternative, but it is so complex to process each video that I ended up writing my own software to simplify and automate the process.

MysteryX
13th January 2015, 21:53
Since this DVD really is screwed up, and I actually don't even know where it came from(!), and it doesn't seem easy to fix, I'll just forget about it for now.

I'm building presets for re-encoding SD videos, and since this DVD is a non-standard exception, that won't be useful in determining the best preset.

Now I'm instead making tests with another DVD that plays fine to begin with.

Still I'm wondering. How does Windows Media Player do to play that video properly, and is it possible to achieve the same result within AviSynth? WMP seems to provide better output than IVTC.

LemMotlow
13th January 2015, 22:20
A big MPEG file isn't useful as I would then have to manually find the exact right frame where to split each video.What does frame rate have to do with cutting edits? It's GOP structure that affects cutting. Use the proper editor for the way your video is encoded.

As for DVD2MPG, it is a capture program that re-encodes the videos. I could use Handbrake which would be simpler. However, whenever you re-encode, you lose quality -- except if you're enhancing the video before re-encoding. I'd rather work with unaltered source to avoid an extra unnecessary conversion.Incorrect. VOB2MPG is not a capture program. It re-wraps the MPEG container from VOB to MPG. The video itself is unaltered. You couldn't capture anything with it if you tried, and it has no encoder.

BTW, according to MediaInfo your mkv audio is already the correct audio rate and is Dolby AC3, which is perfectly valid. If you want AVC/h264 video, AC3 would be re-encoded. You don't have to use AVC to get hi-def -- MPEG2 for HD is also valid, is definitely part of the standards, gets high HD bitrates, and handles interlacing and telecine better than h264 anyway. Commercial BluRays are either MPEG2 or AVC/h264.

If you resize you have to re-encode, no matter what format you're playing with.

MysteryX
13th January 2015, 22:39
Incorrect. VOB2MPG is not a capture program. It re-wraps the MPEG container from VOB to MPG. The video itself is unaltered. You couldn't capture anything with it if you tried, and it has no encoder.
He mentioned DVD2MPG. I'll give VOB2MPG a try and see if it works better than MakeMKV.

BTW, according to MediaInfo your mkv audio is already the correct audio rate and is Dolby AC3, which is perfectly valid. If you want AVC/h264 video, AC3 would be re-encoded. You don't have to use AVC to get hi-def -- MPEG2 for HD is also valid, is definitely part of the standards, gets high HD bitrates, and handles interlacing and telecine better than h264 anyway. Commercial BluRays are either MPEG2 or AVC/h264.
I haven't tried muxing the audio back in for DVDs, but I tried for VCDs and it failed. The command I used was
FFMPEG -i "VideoFile.mp4" -i "OriginalFile.mpg" -acodec copy -vcodec copy "Destination.mp4"

At least for PAL VCDs, the MP4 file would play fine in MPC-HC but fail to play in Windows Media Player. If I instead put "copy destination.mkv", then it works in both players. Perhaps it would be different for DVDs but I'd rather process all files the same way.

If you resize you have to re-encode, no matter what format you're playing with.
Yes I have to re-encode, but only the video. I can then muxe the original audio right back in.

MysteryX
13th January 2015, 22:44
The other DVD I'm trying, looking at the metadata, is Interlaced. However, it renders well.

Does interlacing cause problems only on some videos? When using FFMPEG to convert to AVI, does it apply de-interlacing? (it does appear to deblock during conversion)

I'm not seeing a need for a deinterlacing filter right now, and am wondering when it is required.

creaothceann
13th January 2015, 22:49
Interestingly enough, the source file has interlacing artifacts when playing in MPC-HC but plays well in Windows Media Player!?

The AVI conversion, however, causes Windows Media Player to also show interlacing artifacts.

You have some plugin in your playback filter chain (try loading the video in GraphEdit (http://www.videohelp.com/tools/GraphEdit) to see these chains) that automatically deinterlaces videos.

I'm giving TempGaussMC a try but can't get it to run. [...] And is there a better alternative that has less dependencies?

Try QTGMC (it has lots of presets and parameters, I also often use FPSDivisor=2).

ConvertToRGB32 is when I want to preview in Windows Media Player, as it won't work otherwise
Just use AvsPmod (editor+viewer) or VirtualDub for viewing.

Now if I want to use TIVTC, it appears I cannot do it on an AviSource?

AVISource simply loads the data from an AVI file; it's not doing something special. TIVTC doesn't care how the data is loaded.

DGIndex doesn't work with MKV DVD files so I'll stick to the AVI conversion. I'm doing it that way to avoid all the complications of opening and supporting various file types.

DGIndex accesses the VOBs directly, skipping the AVI conversion step. You also get the audio in its original format (AC3).

Either way, DGIndex cannot open it.
It opens the files on the DVD directly...

The DVD has 35 tracks and that's the only way I know to split them up in individual files while preserving the original data.
Load DGIndex and select the individual VOB files (some may need to be grouped). Save the project and it'll create D2V and AC3 files for each group without re-encoding.

A big MPEG file isn't useful as I would then have to manually find the exact right frame where to split each video.
That's actually quite easy in AvsPmod - I scroll through the video and use the F11 key to insert the current frame in a comment, then build Trim() commands from that. You also need to load the AC3 files though.

As for DVD2MPG, it is a capture program that re-encodes the videos.
Maybe he meant VOB2MPG (http://www.videohelp.com/tools/VOB2MPG)?

I'm building presets for re-encoding SD videos, and since this DVD is a non-standard exception, that won't be useful in determining the best preset.
Most DVDs have some oddities, depending on who did the transfer.

MysteryX
13th January 2015, 23:04
I just gave VOB2MPG a try. It only views 5 chapters while there are 10 tracks on the DVD. It doesn't split it up properly.

I'll stick with programmer's rule #1: if it's not broken, don't fix it. I'll stick to MakeMKV for now.

wonkey_monkey
13th January 2015, 23:48
To convert MakeMKV's MKVs to VOBs for processing with DGIndex, use:

ffmpeg -i input_file.mkv -acodec copy -vcodec copy output_file.vob

LemMotlow
14th January 2015, 00:09
Got the resizing clean, but that lateral motion is still z mess (it's even a bit choppy with the original mkv, too). A lot of noise and artifacts are gone (mostly), could play with gamma and color balance some more which changes in every shot. Plays OK in MPC-HC, MPC-BE, WMP, looks wishy-washy as usual in VLC. Lack of fine textures sure shows that it's upscaled SD.

Wish I could figure out what those Kamikaze encoders did to get the NTSC frame rate.

[EDIT] Used a new script and removed the earlier sample. New sample and script in post #41.

MysteryX
14th January 2015, 00:23
To convert MakeMKV's MKVs to VOBs for processing with DGIndex, use:

ffmpeg -i input_file.mkv -acodec copy -vcodec copy output_file.vob
Would converting from MKV to VOB to open with MPEG2Source provide any other benefit than avoiding to convert to AVI?

And is it possible with DGIndex to generate the D2V file from the command-line?

Going this route might be useful for hour-long DVDs that would generate a very large AVI file, but for all short clips, the AVI conversion happens within 5-10 seconds so there's no need to do it any other way. Unless it provides extra benefits.

The most important aspect is that the workflow can be automated. Which means it can be done either from the command-line or through code. I cannot automate anything that uses graphical interface.

Got the resizing clean, but that lateral motion is still z mess (it's even a bit choppy with the original mkv, too). A lot of noise and artifacts are gone (mostly), could play with gamma and color balance some more which changes in every shot. Plays OK in MPC-HC, MPC-BE, WMP, looks wishy-washy as usual in VLC. Lack of fine textures sure shows that it's upscaled SD.
Can you post your script?

LemMotlow
14th January 2015, 04:47
Can you post your script?Traveling with my laptop now. Can clean up my messy script in the a.m. and post.

LemMotlow
15th January 2015, 00:28
The script I used is a quickie. Could stand tweaking. I'm posting the script as two steps. You can run it in one step, but it'll be slow as hell. Used two steps so I could tweak the results of step 1 without running the whole thing over and over. I used Avisynth 2.5.8. You can use 2.6 if you want, but you'll have to configure thread and memory settings, something I have no patience for. Lota of older filters won't run in 2.6 without a hassle over MT settings.

I rewrote the old script script and removed the link to the earlier 1080p. To open the mkv I used DirectShowSource("blah blah path to mkv\file-957456978.mkv",seekzero=true). Yeah, I know, but it worked. likely it's why media players that use DirectShow play your mkv more correctly. DS doesn't see that video as interlaced or anything else. So you won't need TFM() and the original motion is intact, such as it is -- but you still see dupe frames in the crazy pattern. Remove the dupes, you get something weird like 11.2 fps, etc.

Pixelation and mosquito noise on motion looks like decoding errors and low bitrate artifacts in the original. Takes heavy filtering to clean up that junk. Even then, the artifacts will never look totally clean.

I didn't use ColorMatrix. The original is BT601, but it's oversaturated with "hot" red. Using BT601->BT709 at the end made reds turn bleeding purple and looked really lurid. The original color looks odd anyway: blown out brights and crushed darks. Likely it started as HD and was downsized for DVD. And a weird job of it, too.

The old 1080p linked in post #38 is removed. New sample with the attached script: SDtoMKV_1080p_test.mkv at https://www.mediafire.com/?24vkhhkwfjnljri, 75MB.

Text file with script and notations attached. http://forum.doom9.org/attachment.php?attachmentid=14581&d=1421277964

Asmodian
15th January 2015, 03:02
I used Avisynth 2.5.8. You can use 2.6 if you want, but you'll have to configure thread and memory settings, something I have no patience for. Lota of older filters won't run in 2.6 without a hassle over MT settings.

What!? Avisynth 2.6 isn't any different than 2.5.8 (except the bug fixes, new color spaces, etc.). You do not have to use MT with Avisynth 2.6, in fact MT is still a separate unofficial build of Avisynth 2.6. Simply don't use an MT build of 2.6 since you aren't using an MT build of 2.5.8. Even with the MT builds you can simply leave out the SetMTMode() and everything should run as normal.

2.5.8_MT isn't any better when it comes to finding settings that allow it to run multi-threaded without crashing is it?

LemMotlow
15th January 2015, 03:54
Sorry, I use NO version of Avisynth 2.6, 2.6MT, 2.5.8MT, or MT anything.

When I ran the above script with Avisynth 2.6 dll, QTGMC crashed.
When I substituted MCTD in the script posted above and ran with Avisynth 2.6, Avisynth crashed.

Back to Avisynth 2.5.8.
QTGMC worked.
MCTD worked.
Everything worked.
Kept 2.5.8 where it had been.
This comes up every few weeks or so, and I try it again.
2.5.8 is still there. Works.

Reel.Deel
15th January 2015, 04:21
@LemMotlow

I find that really hard to believe. I've used 2.6 for about 3+ years now and never had your problem with either QTGMC or MCTD. It seems the majority of people use 2.6 (http://forum.doom9.org/showthread.php?t=168478), so I'm sure someone would of posted something about this problem by now...


Edit:
How many people is "majority of people"? You have numbers? How many states and countries did you check?

No need to get defensive, anyways it seems you missed the link to the poll I posted: Which Avisynth version are you using? (http://forum.doom9.org/showthread.php?t=168478)

Out of 98 people. 81.64% are using AviSynth 2.6 (MT included), while only 13.27% are still using 2.58. Those numbers alone should be conclusive. Anyways this is OT so I'll stop.

Edit 2:
I took a look at your script in post #41 and was shocked to see that you're still using the really really really old MVTools v1.11.4.5, and MaskTools v1.5.6, why? I also saw this, so just for reference, aWarpSharp2(depth=20, chroma=6) is faster and has better memory efficiency than MergeChroma(awarpsharp2(depth=20)). The following would also help, change mergechroma(clean.aWarpSharp(depth=20.0, thresh=0.75, blurlevel=2, cm=1)) to aWarpSharp2(thresh=192, blur=2, type=0, depth=20, chroma=6). Lastly, if I where to take a wild guess why 2.6 doesn't work for you I would say that you're probably using the mt_masktools-26.dll that is no longer compatible with the latest AviSynth 2.6 (Alpha 4/5, RC1, MT, AviSynth+), try updating to this version (https://github.com/tp7/masktools/releases). Also read this post here: http://forum.doom9.org/showpost.php?p=1699950&postcount=1857

LemMotlow
15th January 2015, 04:27
No, I saw that poll. How many other polls have you tracked in other forums? Any count on how many Avisynth users don't respond to polls? How many don't visit this forum? Make a deal with you. I won't mention it again. I'll just say I used "Avisynth" (LOL!) and let others wade through it on their own. Seriously. Better yet, why mention Avisynth? If you throw an avs script out there, it should be obvious I guess.

Not taking offense at all. Hope it doesn't sound that way.

MysteryX
15th January 2015, 05:04
Wow that's a complicated script! For the software I'm writing, I want to keep it as simple as possible.

Why not use AviSynth+?

DGIndex can be used from the command-line
http://neuron2.net/dgmpgdec/DGIndexManual.html#AppendixB

Do I really have to define options such as iDCT and Field Operation? What's the simplest way of calling it so that it works with any video DGIndex supports?

Also I'm confused as to what dithering is for. When upscaling SD to HD, do I need to apply dithering of any kind? If so, why?

MysteryX
15th January 2015, 05:18
You're using DirectShowSource which most people don't recommend, but what's the problem with it?

In it's doc, it says
"DirectShow video decoders are not required to support frame-accurate seeking. In most cases seeking will work, but on some it might not."

For encoding the file, seeking is not required. If I'm only processing the video and then muxe the audio back in at the end, will the result be perfect or can I get audio and video out of sync?

Asmodian
15th January 2015, 09:16
No, I saw that poll. How many other polls have you tracked in other forums? Any count on how many Avisynth users don't respond to polls? How many don't visit this forum? Make a deal with you. I won't mention it again. I'll just say I used "Avisynth" (LOL!) and let others wade through it on their own. Seriously. Better yet, why mention Avisynth? If you throw an avs script out there, it should be obvious I guess.

Not taking offense at all. Hope it doesn't sound that way.

There are a lot of bug fixes in 2.6 even if you don't want any of the new features, most users should use 2.6. I was only trying to keep miss-information from spreading about 2.6 v.s. 2.5.8. No special thread or memory setting tuning is needed or would help using 2.6 compared to 2.5.8. Thread settings are only applicable to MT versions anyway.

Please continue to mention the version you use as if you post a script, it is much more helpful if we know what you are using. :)

Asmodian
15th January 2015, 10:15
DGIndex can be used from the command-line
http://neuron2.net/dgmpgdec/DGIndexManual.html#AppendixB

Do I really have to define options such as iDCT and Field Operation? What's the simplest way of calling it so that it works with any video DGIndex supports?

Also I'm confused as to what dithering is for. When upscaling SD to HD, do I need to apply dithering of any kind? If so, why?

You can use the defaults but there is no way to call DGIndex "optimally" for every video it supports.

Dithering keeps more high bit depth information than rounding down to a lower bit depth but it increases the noise level. You want to apply it to avoid banding. To need dithering when upscaling SD to HD you would need to use high bit depth resizing (like dither_resize16 (http://forum.doom9.org/showthread.php?p=1386559#post1386559)).

You're using DirectShowSource which most people don't recommend, but what's the problem with it?

In it's doc, it says
"DirectShow video decoders are not required to support frame-accurate seeking. In most cases seeking will work, but on some it might not."

For encoding the file, seeking is not required. If I'm only processing the video and then muxe the audio back in at the end, will the result be perfect or can I get audio and video out of sync?

Filters can request frames out of order too which can sometimes generate odd results with DSS.

Generally DirectShowSource might work but no one can say for sure it will be OK. Other options are preferred for reliability.

LemMotlow
15th January 2015, 15:29
Thank-you to all who took a look at the script, the results, and the original mkv, and made comments. The way different functions interpret that mkv with differenet results each time is a mystery to me. DirectShowSource is an oldie and has been criticized for framing inaccuracies (sometimes). I tried DSS at the last minute, as I haven't used it in a while. It output a non-interlaced, non-telecined video. I played with all its options. Some options did odd things, and just by itself using all defaults it skipped frames. Setting seekzero=true gave me a complete video with no combing and nothing missing, including the duped frames. I tried everything from FFMS2 to LSMASH (they all gave me blurred frames or decoding garbage). In a media player, the frames look the way they do after DSS.

How that DVD was put together (we don't have a piece of the original VOB's) is anyone's guess, so any speculation about its original encoding would be nice to see because I just can't figure it out. It plays in media players with choppy lateral motion and compression artifacts, but no combing. IS it really progressive video encoded as interlaced? I can't tell.

I used filters that help smooth out the pixelation on motion and stabilize it. There must be more options in QTGMC I could use. One oddity, though: the default denoiser at faster QTGMC options is FFT3dFilter. If dfttest or MotionMC was specified, frames were dropped. I used HQdering to help clean edge ringing in some shots, but when I left it out many frames were blurred. Before any denoising was applied there was incredible mosquito noise and compression artifacts, and decoding errors during motion (you still see some if it in the final video).

Dithering: there seems to be very little real chroma data in the mkv, and little fine detail. All denoisers produced banding and block noise in solid color areas, so I applied dithering and noise masking with fine grain to smooth it out. Yes, @Reel.Deel, as you say the old v1 MVDegrain routine by 2BDecided is old hat. But now and then I find it works better on some troublesome video, a little better than the update I made with v2 of the same tools (on some videos, like this one). I don't know why, but that's why I used it.

I don't always use dither functions. Sometimes dithered rescaling can produce posterizing and clay face effects. It depends on the source. There's some of it here, but it's also in the source and looked worse without dithering. I tried NNEDI3 resizing, but it refused to make nice with this source and I got tired of playing with parameters. Like everything else, some filters work well with a source, others don't work as expected. I hesitated to use QTGMC for denoising in the first place, but it cured some ills so I kept it in and kept looking for optimum values including some noise retention and the rest of it. The more complicated it got, the worse were the results.

Hope I'm not the only one who decided to dive into this oddball source. But IMO it looks better as-is on a good player. I saw no benefit from upsizing. The original just doesn't seem to have enough data for SD to HD, which is often the case.

Avisynth 2.6: I'll be rebuilding my XP machines and Win7 build, so a clean start might solve problems with 2.6. Registries in those machines have been thru the mill for a while. Eventually I likely won't have a choice anyway.