View Full Version : DGIndex & AviSynth
Cunhambebe
30th August 2006, 13:31
I don't know if this is the right place to post this thread...anyway...
I'm using DGIndex and AviSynth to convert my MPEG2(DVD) videos to Xvid. I'm still learning how to do it with great interest (I'm really amazed with what AviSynth can do). Reading DGIndex manual, I've learned they say to configure YUV>RGB as PC Scale (since what I'm trying to do is not included in one of those cases where TV Scale applies). So, after encoding the video to Xvid, the final result seems a little bit darker than if encoded as TV scale.
My question is the following: Is this normal or I'm missing some configuring option in DGindex and/or any kind of script in AviSynth? Here's what my simple script looks like (it's a simple video - NTSC 23,976 progressive):
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
MPEG2Source("c:\voyage_hubble.d2v")
Lanczos4Resize(640,480)
I was configuring DGIndex for TV Scale, which was wrong according to the manual (I noticed some banding on te final result) but on the other hand videos were not as dark. Anyway, the only problem (if it is a real one) is that choosing PC Scale seems to leave the video a bit darker (banding's gone - everything else is perfect)!
Note: this kind of "dark video" happens with all videos I've already tried until now.
Thanks in advance.
Edit: spelling
unskinnyboy
30th August 2006, 14:50
Known issue. You need to use the ColorMatrix filter to fix this. Search the forum for "colormatrix".
Cunhambebe
30th August 2006, 17:19
Thanks for the input. I'll search for the filter and some more information on its usage. Question: Will I have to use this filter at all times, I mean in every conversion?
Thanks in advance.
Cunhambebe
30th August 2006, 17:37
I've found this thread:
http://forum.doom9.org/showthread.php?s=&threadid=82217
I see the filter may be used for MPEG2 files (m2v)....
Boulder
30th August 2006, 18:39
Just use the info=3 parameter in MPEG2Source and then place the line ColorMatrix(hints=true) right after the MPEG2Source line. ColorMatrix will then be applied if necessary.
Cunhambebe
30th August 2006, 18:48
Thank you very much for the tip.
Just use the info=3 parameter in MPEG2Source
-Got it :)
I have already tried the ColorMatrix filter as it's been suggested but I still don't know how to configure it properly (maybe this is the problem).
My source is NTSC progressive at 23,976, YV12 (m2v), DGIndex's output is also YV12 as well as the output which is Xvid.As far as I know there are no color convertions here (pls correct me if I'm wrong).
-Is you suggestion is going to work in this case???
Here's what my little script looks like:
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\Release\colormatrix.dll")
MPEG2Source("c:\voyage_hubble.d2v")
ColorMatrix(d2v="voyage_hubble.d2v")
Lanczos4Resize(640,480)
I don't see a lot of difference from the other dark result (where the filter was not applied), at least previously playing the script with WMP. Besides, one tip would be using the Luminance Filter in DGindex. I'll try your tip, let's see if it works, thanks a lot.
Cunhambebe
30th August 2006, 19:04
Hi there...
Here's the script, as it's been suggested:
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\Release\colormatrix.dll")
MPEG2Source("c:\viagem_hubble.d2v", info=3)
ColorMatrix(hints=true, interlaced=false)
Lanczos4Resize(640,480)
It seems to work, I would have to encode to see the final result for sure. Anyway, VirtualDubMod shows some portions are jerky. Can anyone please check my script for my progressive NTSC video at 23,976? Thanks in advance.
manono
30th August 2006, 19:14
Hi-
Can anyone please check my script for my progressive NTSC video at 23,976?
There's no way to tell from the script what the framerate is. You can open it in VDubMod and go File->File Information to find the framerate. The only way to get 23.976fps from a 29.97fps DVD using that script would be if you had set DGIndex for Forced Film (Video->Field Operation->Forced Film). Unless the DVD was encoded as 23.976fps progressive originally, that would be the wrong setting.
Cunhambebe
30th August 2006, 19:45
Thanks for taking time to respond manono. I'm sorry because I may not have been clear. When I wrote:
Can anyone please check my script for my progressive NTSC video at 23,976?
...I wanted to show my script for my source which is a progressive video and if this script would work for ColorMatrix since I wrote interlace=false.
So, what do you think? The script seems to work - but I'm not sure. As I have put it before, I should encode the video first to check out the final result and compare it with the other file where ColorMatrix had not been used. Besides, VirtualDubMod shows some portions of the video are jerky. Since I have encoded de m2v myself (it's my own video, my own project), I know it is defiitely progressive at 23,976. Any suggestions for the script? Any suggestions for an interlaced script (that can be used with an interlaced source) and a progressive one (both using Color Matrix)? That'd be great for newbies.
Thanks in advance.
manono
30th August 2006, 21:41
Oh, sorry. Guess I misunderstood. The script looks OK to me, but I'd wait for Boulder to comment. Don't take my word for it, as I don't use it much. I don't think you really need to have Interlaced=False, as that's the default.
Cunhambebe
30th August 2006, 22:53
Thanks for writting manono. Anyway here's my final script :)
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\Release\colormatrix.dll")
MPEG2Source("c:\voyage_hubble.d2v", info=3)
ColorMatrix(hints=true)
Lanczos4Resize(640,480)
After reading the manual.. :) I guess it wouldn't make a lot of difference if I had written the script this way:
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\Release\colormatrix.dll")
MPEG2Source("c:\voyage_hubble.d2v")
ColorMatrix(d2v="voyage_hubble.d2v")
Lanczos4Resize(640,480)
I've got a good eye and I don't see any difference between the file that has been encoded with no ColorMatrix at all and this one, with the filter. Am I doing something wrong? Well, to make things a little worse today, now VDMod demuxes the MP3 file from the video I was testing but refuses to add the same stream that has been demuxed pfffffffff....:angry:
Edit: I guess the best solution for this, besides using ColorMatrix would be configuring the luminance filter in DGindex as neuron2 has pmed me and sugested (thanks so much for this - but I still don't know the correct values for Gamma and Offset - I'm trying 4 and 5, seems to work).
Cunhambebe
31st August 2006, 12:34
I see there are 2 ways to fix this problem (dark image):
1) Using Luminace Filter and/or
2) Using ColorMatrix (that at least around here hasn't shown a lot of difference from files that have been rendered without it).
Using Luminance Filter, gives me 3 options:
1) DGIndex's own Luminance Filter, adjsuting Gamma and Offset (thanks to neuron2 for this tip);
2) DGDecode's Luma YV12, example:
MPEG2Source("project.d2v")
LumaYV12(lumoff=15, lumgain=0.9)
Values above are never arbitraty.
Note: DGDecode’s Luma Function is not related to the Luminance Filter in DGindex.
3) AviSynth's ColorYUV
Examples:
# This will adjust gamma for all channels (although less to y), while making 'y' larger:
ColorYUV(gamma_y=128, gamma_u=256, gamma_v=256, off_y=-16)
# Shows all colors. Frame 0 luma is 16, frame 1 luma is 17 and so on:
ColorYUV(showyuv=true)
# Recovers visibility on "very bad" recordings:
ColorYUV(autogain=true, autowhite=true)
Note:The functionality of LumaYV12() can be achieved using ColorYUV(), which has more features, but LumaYV12() is optimized for speed in performing basic luma adjustment.
Question:
Can I use a script like this one, where both ColorMatrix and one of those 3 options for Luminance are present? Example:
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\Release\colormatrix.dll")
MPEG2Source("c:\hubble_voyage.d2v")
LumaYV12(lumoff=15, lumgain=0.9)
ColorMatrix(d2v="hubble_viagem.d2v")
Lanczos4Resize(640,480)
Thanks in advance.
Boulder
31st August 2006, 14:02
Why don't you post screenshots of the same frame as it is in the original video (only resized down to 640x480) and encoded with and without the ColorMatrix line.
Cunhambebe
31st August 2006, 17:58
Thanks for taking time to respond, Boulder.
In fact I had already thought about this, but since I saw no difference at all between the source and the final result redered as Xvid, I gave it up. Here's the script I used for encoding the file;
LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\Release\colormatrix.dll")
MPEG2Source("c:\voyage_hubble.d2v")
ColorMatrix(d2v="hubble_viagem.d2v")
Lanczos4Resize(640,480)
Please note that here I'm using the colorimetry info directly from the d2v itself, instead of (info=3) and ColorMatrix(hints=true)
I'm at the office now. Please let me get back home and I'll post the pics here :)
Thank you for your help :D
Boulder
31st August 2006, 18:59
but since I saw no difference at all between the source and the final result redered as Xvid, I gave it up.
Hmm, doesn't that show that ColorMatrix is doing its job? :p
Cunhambebe
31st August 2006, 20:03
Hmm, doesn't that show that ColorMatrix is doing its job?
-lol;
-That's a good point, but in fact, you notice the difference "playing" the file. Anyway, I'll upload the picture so that you can take a look.
Thanks for your interest and your help.
Best,
Mark
Boulder
31st August 2006, 21:06
The differences that occur when playing the file are a different issue. I can't say what specifically causes them (probably some colorspace/video renderer thing) but someone can surely tell you.
I'd use ffdshow's filters to adjust brightness or gamma during playback and leave the encode as it is - as close to the source as possible.
Cunhambebe
31st August 2006, 23:14
Thanks again Boulder, you were absolutely right. There's no difference between the source and the Xvid file. Here are the pics:
This one is the source;
http://img167.imageshack.us/img167/4360/snapshothubble3le3.jpg (http://imageshack.us)
This is the Xvid file:
http://img177.imageshack.us/img177/3787/snapshothubble4rs8.jpg (http://imageshack.us)
-I am positively sure that there's a difference, but as you have put it, there may be another issue - playing the file...
-Thanks for your remark on leaving the file as it is...(your opinion and your guidance here are very important - thank you).
One more question please: Shoud I always use ColorMatrix for MPEG2 files, m2v and VOBs (these ones that in fact are multiplexed files)?
Thanks in advance :)
Cunhambebe
1st September 2006, 00:10
Now I know what was happening around here.
I've got an NLE and I used to frameserve the timeline (slideshows, pictures) from there to VDMod (Full Processing Mode) for rendering as Xvid. In fact this NLE works in RGB and in spite of the fact I could frameserve as RGB24, 32 or even YUV, I was frameserving as RGB 24. Of course there was a conversion going on and that's why images looked with more contrast (poor quality). This is one example:
http://img187.imageshack.us/img187/4830/snapshotchurch2fw0.jpg (http://imageshack.us)
Now, rendering correctly, using DGindex, AviSynth and VDMod, using the VOB, MPEG2 or m2v as the source instead of the timeline (where there were pics, and some videos), there were no conversions, it was YUV all the time and that's why the file was a little darker that in fact looked pretty much like the VOB source itself.
http://img258.imageshack.us/img258/2174/snapshotchurch1vs1.jpg (http://imageshack.us)
Besides, before learning AviSynth, in one of my few experiences frameserving VOBs to render as Xvid, I used VFAPI, VDMod at Full Processing Mode and followed an outdated tutorial that said it was better to leave YUV as TV Scale (I 've already reached the author and he corrected to PC Scale :) I guess this contributed to my impression of dark images.
Anyway, I am sure the video showing those planets are a little darker if compared to the original source, but as Boulder have remarked it - The differences that occur when playing the file are a different issue.
The subject "video" is very difficult. I hope this helps other newbies to make things clearer... (Please, there's still a question overthere regarding the usage of ColorMatrix at all times for MPEG2, VOB and m2v conversions)... Hope you can help once again.
Thanks in advance
Boulder
1st September 2006, 05:06
One more question please: Shoud I always use ColorMatrix for MPEG2 files, m2v and VOBs (these ones that in fact are multiplexed files)?
To be on the safe side, yes. Using hints or the d2v parameter in ColorMatrix ensures that it will be applied only when necessary, although Limiter() will be called in any case. If you encode from MPEG2 to XviD/DivX, the default mode is correct. If you encode from MPEG2 to MPEG2, you need to use mode="rec.601->rec.709" if the encoder you use assumes rec.709 coeffs (most, if not all of them do).
Cunhambebe
1st September 2006, 23:36
Boulder, thanks for your help and for taking your time to respond.
...although Limiter() will be called in any case
-I guess I don't need to include this on the script, do I?
...if you encode from MPEG2 to MPEG2, you need to use mode="rec.601->rec.709" if the encoder you use assumes rec.709 coeffs (most, if not all of them do).
-So how will a script like this look like? Like this?
ColorMatrix(clip, mode="Rec.601->Rec.709")
ConvertToRGB() # I guess I won't need this line here ConvertToRgb()... How do I do this? This is for YUV12 > RGB, isn't it (since most MPEG2 encoders, are RGB 709)??? Funny, I thought Cinema Craft Encoder was the only one that could support YUV.
-Thanks so much for this valuable input. I've learned a lot here lately. Thanks again for your help.
Cheers,
Mark
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.