VideoHelp Forum
+ Reply to Thread
Results 1 to 26 of 26
Thread
  1. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Hello and thanks in advance for any help. I've searched about for an answer to my question but couldn't find anything useful, probably because I'm using the wrong terms. I've a stack of DVD's that I'm slowly-but-surely ripping with MakeMKV then cleaning up and shriveling with MeGUI-AviSynth-SMDegrain so as to make them more portable. Things are progressing reasonably well (if slowly) but I occasionally encounter a DVD where the video playback appears as a smaller rectangle in the center of the screen; that is, it doesn't have the usual two black bars (top-bottom or left-right, depending on aspect ratio) but in effect four black bars. My question: is it possible to "stretch" the video, either during the reencoding or remuxing stage, or some other way, so that the video maintains its proper aspect ratio and two of the sides reach the edge of the screen? I've played around a bit with the format specific options in MKVMerge but unsucessfully. Thanks again for your time.
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date: Aug 2000
    Location: Sweden
    Search Comp PM
    Can you post a screenshot? How "big" are the black bars?
    Quote Quote  
  3. Member
    Join Date: Sep 2012
    Location: Australia
    Search Comp PM
    It's 16:9 or some other widescreen aspect ratio encoded to fit the 4:3 aspect ratio by including black bars on the top and bottom. The Australian DVD release of Ben 10: Secret of the Omnitrix was encoded like that, I just did the math and cropped off the necessary amount of bottom and top black borders and then encoded it to 16:9.

    But a screenshot couldn't hurt.
    Last edited by ndjamena; 26th Jun 2014 at 10:43. Reason: - Left out 'top' in 'top and bottom' -
    Quote Quote  
  4. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Originally Posted by ndjamena View Post
    It's 16:9 or some other widescreen aspect ratio encoded to fit the 4:3 aspect ratio by including black bars on the bottom.

    Something like that, I think. It's a 1997 movie and MediaInfo spits out "720*480 (4:3)" but it doesn't display 4:3 and the image isn't distorted in any way. Here's a screenshot:

    Click image for larger version

Name:	Screenshot.png
Views:	31
Size:	605.7 KB
ID:	25932
    Last edited by LouieChuckyMerry; 26th Jun 2014 at 07:09.
    Quote Quote  
  5. Member
    Join Date: Sep 2012
    Location: Australia
    Search Comp PM
    The black bars on the left and right edges are a product of the player, not the video. It looks like the actual video has an aspect ratio of 2:1 or slightly more.
    Last edited by ndjamena; 26th Jun 2014 at 10:44. Reason: - Left out 'left and right edges' clarification - Need a new brain, mkv tagging system has screwed this one up.
    Quote Quote  
  6. Member
    Join Date: Aug 2006
    Location: United States
    Search Comp PM
    I have an old DVD of "Hoosiers" that is formatted like your sample, with hard-coded letterbox bars. In 1997 TVs with a 4:3 aspect ratio were all people had, so all DVDs were 4:3 aspect ratio initially. Widescreen movies on DVD were either cropped to 4:3 or had letter box bars added as an integral part of the picture to make them 4:3.

    As suggested, you will have to crop the leterbox bars to create a aspect ratio 16:9 and re-encode [Edit] Note that you won't be able to entirely remove the letterbox bars unless you also crop a little from the left and right sides of the picture.
    Last edited by usually_quiet; 26th Jun 2014 at 10:50.
    Quote Quote  
  7. Member
    Join Date: Jun 2012
    Location: USA
    Search Comp PM
    A couple of fairly simple choices -- in your "MeGUI-AviSynth-SMDegrain" phase you can have avisynth crop 60 lines off the top and bottom if NTSC (or 72 lines top and bottom for PAL.) Handbrake has an automatic cropping function if you want to end up with an h.264 mkv.

    Your video is a standard 4:3 letterboxed DVD. The side bars are being added during playback.
    Quote Quote  
  8. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Thank you all very much for the elucidation . I'm pretty sure that I could apply the cropping in MeGUI with some effort, but is there any way to avoid this by altering the information that the player is using to display the video this way? Or is this, in effect, what the cropping would do?
    Quote Quote  
  9. Member
    Join Date: Jun 2012
    Location: USA
    Search Comp PM
    Originally Posted by LouieChuckyMerry View Post
    is there any way to avoid this by altering the information that the player is using to display the video this way?
    If your player has a zoom function you can use it. As far as the player is concerned, you're feeding it a 4:3 picture and it's displaying it properly on a 16:9 screen.
    Quote Quote  
  10. Member netmask56's Avatar
    Join Date: Sep 2005
    Location: Sydney, Australia
    Search Comp PM
    I had a DVD release of Carousel that was Cinemascope format within a 4:3 frame. A postage stamp image surrounded by black. I was going to use VirtualDub but ended up using ConvertXtoDVD selecting 16:9 as the project and by selecting pan and scan did it without cutting off the side. I now have a Cinemascope format with in a 16:9 frame that shows correctly on a 16:9 TV with black bars top and bottom. I can post a few screen shots before and after if anyone is interested.
    TheVoiceIsAnotherPerson ~ BeyonWiz DP-P1 and T3 PVR's ~ Popcorn C200 ~ Samsung ES8000 65" LED TV ~ Windows 7 ~ Yamaha RX-A1030 http://www.openwiz.org/wiki/ProjectX
    Quote Quote  
  11. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Originally Posted by smrpix View Post
    If your player has a zoom function you can use it. As far as the player is concerned, you're feeding it a 4:3 picture and it's displaying it properly on a 16:9 screen.
    Thanks for this information, smrpix.

    I've passed the time trying to crop a test clip with MeGUI-AviSynth-SMDegrain but am struggling a bit. I cheated by dropping the test clip in HandBrake to get the cropping numbers (thanks again, smrpix), then searched about to figure out how to modify my script accordingly. I'm able to run the clip and crop it and apply SMDegrain, but the resulting video plays back at the wrong aspect ratio (it's a bit stretched out). Poking around in the HandBrake log it seems that HandBrake is cropping then resizing the display dimensions. Here's the log:

    Code:
      + audio tracks:
        + 1, English (AC3) (5.1 ch) (iso639-2: eng), 48000Hz, 384000bps
      + subtitle tracks:
    Reading chapter markers from file F:\Windows\Tmp\TestKundun-1-chapters.csv
    [09:47:06] 1 job(s) to process
    [09:47:06] starting job
    [09:47:06] sync: expecting 1442 video frames
    [09:47:06] work: only 1 chapter, disabling chapter markers
    [09:47:06] job configuration:
    [09:47:06]  * source
    [09:47:06]    + D:\Temp\TestKundun.mkv
    [09:47:06]    + title 1, chapter(s) 1 to 1
    [09:47:06]    + container: matroska,webm
    [09:47:06]  * destination
    [09:47:06]    + T:\HandBrakeTemp\TestKundun.mp4
    [09:47:06]    + container: MPEG-4 (.mp4 and .m4v)
    [09:47:06]  * video track
    [09:47:06]    + decoder: mpeg2video
    [09:47:06]      + bitrate 9800 kbps
    [09:47:06]    + frame rate: same as source (around 23.976 fps)
    [09:47:06]    + filters
    [09:47:06]      + Framerate Shaper (0:27000000:1126125)
    [09:47:06]        + frame rate: same as source (around 23.976 fps)
    [09:47:06]      + Crop and Scale (718:276:100:104:0:2)
    [09:47:06]        + source: 720 * 480, crop (100/104/0/2): 718 * 276, scale: 718 * 276
    [09:47:06]    + loose anamorphic
    [09:47:06]      + storage dimensions: 718 * 276, mod 2
    [09:47:06]      + pixel aspect ratio: 8 / 9
    [09:47:06]      + display dimensions: 638 * 276
    [09:47:06]    + encoder: H.264 (x264)
    [09:47:06]      + x264 preset: veryfast
    [09:47:06]      + h264 profile: main
    [09:47:06]      + h264 level: 4.0
    [09:47:06]      + quality: 20.00 (RF)
    [09:47:06]  * audio track 1
    [09:47:06]    + decoder: English (AC3) (5.1 ch) (track 1, id 0x1)
    [09:47:06]      + bitrate: 384 kbps, samplerate: 48000 Hz
    [09:47:06]    + mixdown: Dolby Pro Logic II
    [09:47:06]    + encoder: AAC (faac)
    [09:47:06]      + bitrate: 160 kbps, samplerate: 48000 Hz
    [09:47:06] reader: first SCR 7560 id 0x0 DTS -2970
    [09:47:06] encx264: min-keyint: 24, keyint: 240
    [09:47:06] encx264: encoding with stored aspect 8/9
    [09:47:06] encx264: Encoding at constant RF 20.000000
    x264 [warning]: --psnr used with psy on: results will be invalid!
    x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!
    x264 [info]: using SAR=8/9
    x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    x264 [info]: profile Main, level 4.0
    [09:47:06] sync: first pts is 10530
    [09:47:11] reader: done. 1 scr changes
    [09:47:11] work: average encoding speed for job is 326.520691 fps
    [09:47:12] sync: got 1438 frames, 1442 expected
    [09:47:12] render: lost time: 0 (0 frames)
    [09:47:12] render: gained time: 0 (0 frames) (0 not accounted for)
    [09:47:12] mpeg2video-decoder done: 1438 frames, 0 decoder errors, 0 drops
    x264 [info]: frame I:21    Avg QP:16.97  size: 16088  PSNR Mean Y:47.76 U:49.48 V:49.93 Avg:48.21 Global:47.57
    x264 [info]: frame P:697   Avg QP:20.19  size:  4010  PSNR Mean Y:45.66 U:48.37 V:48.68 Avg:46.29 Global:45.08
    x264 [info]: frame B:720   Avg QP:22.01  size:   986  PSNR Mean Y:43.85 U:47.93 V:48.16 Avg:44.80 Global:43.96
    x264 [info]: consecutive B-frames: 21.0% 34.4%  7.1% 37.6%
    x264 [info]: mb I  I16..4: 43.7%  0.0% 56.3%
    x264 [info]: mb P  I16..4: 12.7%  0.0%  2.5%  P16..4: 34.3% 14.7%  7.4%  0.0%  0.0%    skip:28.5%
    x264 [info]: mb B  I16..4:  1.0%  0.0%  0.1%  B16..8: 16.7%  5.0%  0.6%  direct: 8.2%  skip:68.4%  L0:31.1% L1:50.7% BI:18.2%
    x264 [info]: coded y,uvDC,uvAC intra: 33.2% 51.0% 20.0% inter: 13.9% 12.2% 0.2%
    x264 [info]: i16 v,h,dc,p: 55% 23% 14%  8%
    x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 21% 18%  6%  5%  5%  6%  5%  6%
    x264 [info]: i8c dc,h,v,p: 58% 17% 22%  4%
    x264 [info]: Weighted P-Frames: Y:6.5% UV:1.9%
    x264 [info]: SSIM Mean Y:0.9795775 (16.899db)
    x264 [info]: PSNR Mean Y:44.754 U:48.162 V:48.427 Avg:45.546 Global:44.489 kb/s:512.41
    [09:47:13] mux: track 0, 1438 frames, 3841712 bytes, 511.72 kbps, fifo 2048
    [09:47:13] mux: track 1, 2816 frames, 1202869 bytes, 160.22 kbps, fifo 4096
    [09:47:13] libhb: work result = 0
    Encode done!
    HandBrake has exited.
    and here's my functional-but-not-quite-right AviSynth script:

    Code:
    Threads=8
    SetMTMode(5,Threads)
    FFVideoSource("D:\Temp\TestKundun.mkv")
    SetMTMode(2)
    crop(2,112,0,-100)
    SMDegrain(Lsb=True,Chroma=False,Plane=0)
    I could always use HandBrake for the final reencode, but I'd prefer to use MeGUI so that I can apply SMDegrain and use the newest build of x264. Also, I could always remux my reencoded video with the aspect ratio 638*276, as this is what HandBrake uses for its "display dimensions", but I'd rather do it in AviSynth so I can learn something new (and jump up a notch from Not Completely Clueless to Has A Slight Clue ). If this is the wrong place to ask then I apologize and would appreciate being told where to go, ha ha.
    Quote Quote  
  12. Member
    Join Date: Jun 2012
    Location: USA
    Search Comp PM
    Your issue may be that the cropped video is retaining the non-square pixel aspect ratio of the original DVD and your player doesn't know how to handle it. You may want to reset the pixel aspect to 1:1 square and resize the overall image appropriately.
    Quote Quote  
  13. Member fritzi93's Avatar
    Join Date: Nov 2003
    Location: U.S.
    Search Comp PM
    Originally Posted by netmask56 View Post
    I had a DVD release of Carousel that was Cinemascope format within a 4:3 frame. A postage stamp image surrounded by black. I was going to use VirtualDub but ended up using ConvertXtoDVD selecting 16:9 as the project and by selecting pan and scan did it without cutting off the side. I now have a Cinemascope format with in a 16:9 frame that shows correctly on a 16:9 TV with black bars top and bottom. I can post a few screen shots before and after if anyone is interested.
    Yeah, I recall a few early DVDs that were letterboxed 4:3; the first release of Home Alone, for instance. They won't display properly on a 16:9 HDTV.

    Quick fix: Use DVDRB. Options -> AVS Options -> Advanced (Expert) Options -> Convert from LB 4:3 to 16:9 -> Apply to All. Then re-encode it.
    Pull! Bang! Darn!
    Quote Quote  
  14. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Originally Posted by smrpix View Post
    Your issue may be that the cropped video is retaining the non-square pixel aspect ratio of the original DVD and your player doesn't know how to handle it. You may want to reset the pixel aspect to 1:1 square and resize the overall image appropriately.
    Thanks for your patience, smrpix. Where would I reset the pixel aspect to 1:1 and resize the overall image appropriately? In the AviSynth script? If so, would you pretty please help me with the syntax?


    Originally Posted by fritzi93 View Post
    Originally Posted by netmask56 View Post
    I had a DVD release of Carousel that was Cinemascope format within a 4:3 frame. A postage stamp image surrounded by black. I was going to use VirtualDub but ended up using ConvertXtoDVD selecting 16:9 as the project and by selecting pan and scan did it without cutting off the side. I now have a Cinemascope format with in a 16:9 frame that shows correctly on a 16:9 TV with black bars top and bottom. I can post a few screen shots before and after if anyone is interested.
    Yeah, I recall a few early DVDs that were letterboxed 4:3; the first release of Home Alone, for instance. They won't display properly on a 16:9 HDTV.

    Quick fix: Use DVDRB. Options -> AVS Options -> Advanced (Expert) Options -> Convert from LB 4:3 to 16:9 -> Apply to All. Then re-encode it.
    Thank you for the suggestion, netmask56, I'll check it out.
    Last edited by LouieChuckyMerry; 29th Jun 2014 at 04:24.
    Quote Quote  
  15. Member
    Join Date: Jun 2012
    Location: USA
    Search Comp PM
    FFVideoSource("D:\Temp\TestKundun.mkv")
    crop(0,112,0,-100)
    Lanczos4Resize(640,276)
    Last edited by smrpix; 29th Jun 2014 at 10:53.
    Quote Quote  
  16. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Awesome, smrpix, that worked well (why do you suggest Lanczos4Resize over LanczosSharp?). Thank you, I'll add this to my ever expanding bag of tricks (with a bookmark, ha ha, my memory isn't that good). Now I'm trying to wrap my head around something, perhaps you could help (again). Comparing the same frame from the HandBrake reencoded clip and the MeGUI reencoded clip I notice that the MeGUI clip has a wee bit less picture on the top and the HandBrake clip has a wee bit less picture on the right. I reckon this is due to the difference between the HandBrake script using (100/104/0/2) and the MeGUI script using (0,112,0,-100), no big deal (and I can always tweak the numbers in the AviSynth script to match). What I don't understand is why MediaInfo for the HandBrake clip states "718*276 (2.35:1)" but for the MeGUI clip states "640*276 (2.35:1)" when they essentially display the exact same way? Where-what-how are the two clips different when they're apparently not?


    Edit: I've been fooling around with MeGUI and its auto crop feature. It works with DirectShow sources to the extent that the cropping numbers are correct, but it fails to resize properly. For FFVideo sources the cropping numbers and resize are incorrect. However, plugging in the HandBrake cropping numbers and "display dimensions" from the log file results in a properly cropped and resized video. This is a bit of a workaround, splitting a one minute test clip with MKVMerge then running it through HandBrake, but not too annoying given how infrequently I encounter these odd DVDs.
    Last edited by LouieChuckyMerry; 30th Jun 2014 at 03:20. Reason: Information, Information...
    Quote Quote  
  17. Member
    Join Date: Jun 2012
    Location: USA
    Search Comp PM
    Originally Posted by LouieChuckyMerry View Post
    What I don't understand is why MediaInfo for the HandBrake clip states "718*276 (2.35:1)" but for the MeGUI clip states "640*276 (2.35:1)" when they essentially display the exact same way? Where-what-how are the two clips different when they're apparently not?.
    Different pixel aspect ratios. The 718 retains the DV non-square pixels. My suggestion, like the MeGUI, changes it to square pixels because it's more universally compatible.

    Discussing various resize methods can result in a death match I don't care to join. Lanczos4 works well for me in many situations.

    Hope that helps.
    Quote Quote  
  18. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Originally Posted by smrpix View Post
    Different pixel aspect ratios. The 718 retains the DV non-square pixels. My suggestion, like the MeGUI, changes it to square pixels because it's more universally compatible.
    Thank you for the clarification. I understand the gist but full comprehension is down the road a stretch. With your kind assistance I very successfully reencoded the movie last night and it looks great, so thanks again for your help, smrpix , I really appreciate it.


    In case someone bumps into this thread and uses (some of) its information, I accidentally learned something important while playing with the auto crop feature in MeGUI, solving two problems I was prepared to tackle in the future. It seems to that point that I'd been inadvertently "cheating" on my AviSynth scripts. I was using DirectShow to open the videos, saving the .avs file, then editing the script in NotePad to replace DirectShow with FFSource and add SMDegrain. However, using this method roughly one in every seven reencoded videos was either crashing avs4x264mod.exe or seemingly completing successfully only to have the audio become more and more out of sync as the movie progressed. As best as I can figure, this was due to the fact that my script was lacking the video frame rate information at the end of the file path that would have been there if I'd actually been using MeGUI's "File Indexer" option to open the videos instead of "DirectShowSource". For example, the script I posted earlier:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    Threads=8
    SetMTMode(5,Threads)
    FFVideoSource("D:\Temp\TestKundun.mkv")
    SetMTMode(2)
    crop(2,112,0,-100)
    SMDegrain(Lsb=True,Chroma=False,Plane=0)
    should actually be:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    Threads=8
    SetMTMode(5,Threads)
    FFVideoSource("D:\Temp\TestKundun.mkv", fpsnum=24000, fpsden=1001, threads=1)
    SetMTMode(2)
    crop(2,112,0,-100)
    SMDegrain(Lsb=True,Chroma=False,Plane=0)
    However, because I'm using SMDegrain and multithreading (with a modified avs.dll), I need to remove the above bold and italicized "threads=1". So, the final correct script would be:

    Code:
    LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\ffms\ffms2.dll")
    Threads=8
    SetMTMode(5,Threads)
    FFVideoSource("D:\Temp\TestKundun.mkv", fpsnum=24000, fpsden=1001)
    SetMTMode(2)
    crop(2,112,0,-100)
    SMDegrain(Lsb=True,Chroma=False,Plane=0)
    Since discovering this I've rerun several videos successfully (without the cropping, ha ha) that had previously failed for each of the above mentioned reasons, so I'm pretty confident that I'm on the right path. What I don't understand (Obi Wan smrpix, you are my only hope ), is why the script lacking frame rate information would even run (about half the earlier failures ran to completion only to have audio sync issues, the other about half crashed avs4x264mod.exe at various lengths of time into the reencoding), but I reckon I can live with that brain itch for awhile.
    Last edited by LouieChuckyMerry; 30th Jun 2014 at 22:39. Reason: Grammar And Syntax
    Quote Quote  
  19. "fpsnum=24000, fpsden=1001" (or appropriate values) are used in order to tell ffmsindex to convert the frame rate.

    In the above example the output frame rate would be 23.976fps. If the video is already 23.976fps then fpsnum and fpsden should have no effect. MeGUI (Avisynth) expects the video to have a constant frame rate. The frame rate conversion it adds to the script is "just in case" it doesn't. After MeGUI has indexed the video (using ffmsindex) it might pay to check the log file for warnings if you think there's a potential for problems. Sometimes (for one reason or another) MeGUI can't detect the correct frame rate so it defaults to 23.976fps. If that's wrong, the output can be a bit of a mess, but it doesn't happen often. The frame rate conversion stuff is not "required" for a successful encode though.

    "threads=1" tells ffmsindex to decode in single threaded mode. Other filters can still run in MT mode. I've had occasional problems at times when "threads=1" is not used, so I use "threads=1" and the world is always rosy.

    When using MeGUI's AVS Script Creator, there's an option to enable anamorphic encoding. It'll be the difference between resizing to 718*276 or 640*276 etc. At least when using MeGUI for the whole encoding process. Playing around with it and checking the scripts MeGUI creates might be more informative than trying to explain it.

    I never use a MT version of Avisynth myself. I could never get it perfectly stable. Instead, when adding slow filtering I use a single threaded Avisynth and run more than one encode at a time. That keeps the CPU pretty busy without any crashing. I create a script, make a copy, then add Trim to each so they encode half the video, then I run them both simultaneously. I always put Trim on a scene change and "stitchable" needs to be checked in MeGUI's x264 encoder configuration so the encoded video can always be appended. For example this script would encode the first 55477 frames, while the second script would encode the rest.

    FFVideoSource("D:\Temp\TestKundun.mkv", fpsnum=24000, fpsden=1001, threads=1)
    crop(2,112,0,-100)
    SMDegrain(Lsb=True,Chroma=False,Plane=0)
    Trim(0,55476)
    FFVideoSource("D:\Temp\TestKundun.mkv", fpsnum=24000, fpsden=1001, threads=1)
    crop(2,112,0,-100)
    SMDegrain(Lsb=True,Chroma=False,Plane=0)
    Trim(55477,0)
    Or sometimes I split the script into three sections and let the old dual core lend a hand.....
    As long as the same encoder settings are used each time (with "stitchable") there should be no problem appending the encodes with MKVMergeGUI.

    Originally Posted by LouieChuckyMerry View Post
    Edit: I've been fooling around with MeGUI and its auto crop feature. It works with DirectShow sources to the extent that the cropping numbers are correct, but it fails to resize properly. For FFVideo sources the cropping numbers and resize are incorrect. However, plugging in the HandBrake cropping numbers and "display dimensions" from the log file results in a properly cropped and resized video. This is a bit of a workaround, splitting a one minute test clip with MKVMerge then running it through HandBrake, but not too annoying given how infrequently I encounter these odd DVDs.
    Use the File/Open menu to open DVDs (you'd open the first vob file in a set) and let MeGUI do it's file indexing thing (DGIndex). It sounds very much like your cropping and resizing problems are due to not using MeGUI correctly.
    Last edited by hello_hello; 30th Jun 2014 at 23:11.
    Quote Quote  
  20. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Originally Posted by hello_hello View Post
    "fpsnum=24000, fpsden=1001" (or appropriate values) are used in order to tell ffmsindex to convert the frame rate.

    In the above example the output frame rate would be 23.976fps. If the video is already 23.976fps then fpsnum and fpsden should have no effect. MeGUI (Avisynth) expects the video to have a constant frame rate. The frame rate conversion it adds to the script is "just in case" it doesn't. After MeGUI has indexed the video (using ffmsindex) it might pay to check the log file for warnings if you think there's a potential for problems. Sometimes (for one reason or another) MeGUI can't detect the correct frame rate so it defaults to 23.976fps. If that's wrong, the output can be a bit of a mess, but it doesn't happen often. The frame rate conversion stuff is not "required" for a successful encode though.

    "threads=1" tells ffmsindex to decode in single threaded mode. Other filters can still run in MT mode. I've had occasional problems at times when "threads=1" is not used, so I use "threads=1" and the world is always rosy.
    Thank you very very much for taking the time to explain this to me in such a lucid manner, hello_hello, I truly appreciate it . The first time I properly used MeGUI's "File Indexer" option and added the SMDegrain information I had problems until I removed the "threads=1" bit of script. However, since then (after reading your above quote) I've successfully reencoded several videos and applied SMDegrain with a script including "threads=1", so I'm thinking that I fat-fingered some input on that troublesome first attempt. Anyway, now I know better.


    Originally Posted by hello_hello View Post
    When using MeGUI's AVS Script Creator, there's an option to enable anamorphic encoding. It'll be the difference between resizing to 718*276 or 640*276 etc. At least when using MeGUI for the whole encoding process. Playing around with it and checking the scripts MeGUI creates might be more informative than trying to explain it.
    Thanks for that information. While playing with the cropping in MeGUI I noticed that option but didn't fully understand what it was for. I'll play with a test clip of the video that sent me here in the first place as soon as I have the spare time.


    Originally Posted by hello_hello View Post
    I never use a MT version of Avisynth myself. I could never get it perfectly stable. Instead, when adding slow filtering I use a single threaded Avisynth and run more than one encode at a time. That keeps the CPU pretty busy without any crashing. I create a script, make a copy, then add Trim to each so they encode half the video, then I run them both simultaneously. I always put Trim on a scene change and "stitchable" needs to be checked in MeGUI's x264 encoder configuration so the encoded video can always be appended. For example this script would encode the first 55477 frames, while the second script would encode the rest.
    Since stumbling upon the "File Indexer" option I've not had any stability issues with the MT version of AviSynth. This success is only with 480p and 720p video, so perhaps I'll encounter issues when I begin attacking 1080p video. I've actually used your trim trick before, having learned of it while Googling about for for solutions when first sorting out MT AviSynth, and I'll certainly store it away for possible future use. In fact, all my x264 profiles have "Stichable" ticked thanks to you .


    Originally Posted by hello_hello View Post
    Use the File/Open menu to open DVDs (you'd open the first vob file in a set) and let MeGUI do it's file indexing thing (DGIndex). It sounds very much like your cropping and resizing problems are due to not using MeGUI correctly.
    I'm not using the actual DVDs, I'm running them through MakeMKV first because I keep that output for archiving (and I've at least a bit of experience playing with mkvs in MeGUI). I'd have to agree with your assessment that I'm not using MeGUI correctly , but really-and-truly when trying to auto crop the test clip MeGUI improperly cropped it with "DirectShowSource" and "File Indexer". As I typed above, "DirectShowSource" was unable to render the original MPEG video so I had to reencode it to even use that option. I don't remember the specifics, but if you'd like I'd attempt to reproduce the issues. Thanks again for your post.
    Last edited by LouieChuckyMerry; 3rd Jul 2014 at 03:55.
    Quote Quote  
  21. I've had problems with mpeg2 video in MKVs in the past. ffmsindex has been a bit hit and miss with it, possibly more so if it's interlaced. You could try indexing with the Lsmash indexer instead of ffmsindex, but I'd recommend avoiding working with mpeg2 video in MKVs. If you already have MKVs I'd try remuxing them as TS files with TSMuxer and open the TS files for encoding with MeGUI instead (especially if the MKVs are giving you problems). MeGUI should offer to index the TS files with DGIndex (the same indexer it uses for DVD video/vob files) and the chances of problems should be less. It mightn't be an issue any more but if you are having problems......

    If in doubt though, use MeGUI's File/Open menu and let MeGUI offer to index the video. It'll mostly default to the best method. Add the indexing job to the queue and run it.
    If you wanted to, you could rip the DVDs as standard DVD/Vob files using any ripping program capable of doing so, convert the ripped files using MeGUI, then archive the ripped DVD files as MKVs. That's what I do (although I archive DVDs as ISO files rather than MKVs these days).

    The anamorphic encoding option..... the basic gist of it is...... with it disabled you're resizing to square pixels (there's an option in the AVS Profile Configuration to allow "upsizing" which is foolishly.... if you ask me..... disabled by default), but resizing will resize to square pixel dimensions. ie you might resize a 16:9 NTSC DVD to 854x480 etc (forgetting cropping for the moment).
    When anamorphic encoding is enabled the basic idea is to keep the original shape of the pixels..... no resizing..... (although there's one anamorphic option which also lets you resize), so you'd encode the same DVD at 720x480 and it'd be resized to 16:9 on playback, just as the original DVD would be, assuming your hardware player supports anamorphic video is MKV/MP4 files. The media player in my TV doesn't, so I resize to square pixels.
    When you crop, the principle is still the same, but obviously the resulting resolutions would be different as you're removing part of the picture.

    Have you discovered QTGMC yet? I won't go on about it too much and if you've used it for de-interlacing you'll be familiar with it, but even for progressive DVD video (which can generally do with a bit of "cleaning up") it's my default de-noiser.
    I use MDegrain a fair bit myself for HD video which is grainy but otherwise fairly "clean" (yes I'm aware that sounds like a contradiction), but for everything else I tend to use QTGMC. If you haven't tried it, give this a spin on some lower quality DVD video and compare it to SMDegrain:

    (Single Threaded mode, progressive video)
    QTGMC(InputType=1, Preset="medium", EzDenoise=2)

    Raise or lower the EzDenoise value as needed (I generally use between 1 and 2 unless the video is very noisy) or for video with very light noise you can remove it entirely, and if you're not in a hurry try removing the preset option (I think the default Preset is "slower").

    As I said, the above is for progressive video. If the video needs IVTC, I'd run that first (to make the video progressive) then add QTGMC in progressive mode to the script. Something like:

    LoadPlugin("C:\Program Files\MeGUI\tools\avisynth_plugin\TIVTC.dll")
    tfm(order=1).tdecimate()
    QTGMC(InputType=1, EzDenoise=1)

    Of course if the video is purely interlaced, you'd just let QTGMC de-interlace it.
    QTGMC()

    Auto-cropping is never "accurate". I use it as a starting point, then adjust the cropping manually as required to give myself nice clean edges. If the auto-cropping won't work though, there's possibly something wrong. Opening a video via DirectShow then changing the script to ffmsindex and re-opening the video preview would probably be an example of that.
    Last edited by hello_hello; 3rd Jul 2014 at 03:14.
    Quote Quote  
  22. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Originally Posted by hello_hello View Post
    I've had problems with mpeg2 video in MKVs in the past. ffmsindex has been a bit hit and miss with it, possibly more so if it's interlaced. You could try indexing with the Lsmash indexer instead of ffmsindex, but I'd recommend avoiding working with mpeg2 video in MKVs. If you already have MKVs I'd try remuxing them as TS files with TSMuxer and open the TS files for encoding with MeGUI instead (especially if the MKVs are giving you problems). MeGUI should offer to index the TS files with DGIndex (the same indexer it uses for DVD video/vob files) and the chances of problems should be less. It mightn't be an issue any more but if you are having problems......

    If in doubt though, use MeGUI's File/Open menu and let MeGUI offer to index the video. It'll mostly default to the best method. Add the indexing job to the queue and run it.
    Thanks for the information (and your patience ). I've noticed that all input files automatically want to resize (with mod8 and LanczosSharp) but this is added to the script only if there's an actual change in the horizontal and-or vertical number. I remember your preference for Lanczos4 but I'm wondering if resizing is actually necessary; that is, if MeGUI chooses mod8 and one of the numbers changes should I always resize or can I ignore it (or change the mod#) or what's your expert opinion?


    Originally Posted by hello_hello View Post
    If you wanted to, you could rip the DVDs as standard DVD/Vob files using any ripping program capable of doing so, convert the ripped files using MeGUI, then archive the ripped DVD files as MKVs. That's what I do (although I archive DVDs as ISO files rather than MKVs these days).
    What's your method for archiving DVDs as Iso files?



    Originally Posted by hello_hello View Post
    The anamorphic encoding option..... the basic gist of it is...... with it disabled you're resizing to square pixels (there's an option in the AVS Profile Configuration to allow "upsizing" which is foolishly.... if you ask me..... disabled by default)
    You mean the "Clever (TM) anamorphic encoding" option? If so, which of the four options would you suggest? Do you know of an especially lucid article or guide you'd recommend?


    Originally Posted by hello_hello View Post
    ...but resizing will resize to square pixel dimensions. ie you might resize a 16:9 NTSC DVD to 854x480 etc (forgetting cropping for the moment).
    When anamorphic encoding is enabled the basic idea is to keep the original shape of the pixels..... no resizing..... (although there's one anamorphic option which also lets you resize), so you'd encode the same DVD at 720x480 and it'd be resized to 16:9 on playback, just as the original DVD would be, assuming your hardware player supports anamorphic video is MKV/MP4 files. The media player in my TV doesn't, so I resize to square pixels.
    When you crop, the principle is still the same, but obviously the resulting resolutions would be different as you're removing part of the picture.
    I'll reread that multiple times and get back to you, ha ha. Seriously, I get the concept but need to absorb the specifics in order to fully understand what you're trying to explain. I'm a bit slow, but quite tenacious.


    Originally Posted by hello_hello View Post
    Have you discovered QTGMC yet? I won't go on about it too much and if you've used it for de-interlacing you'll be familiar with it, but even for progressive DVD video (which can generally do with a bit of "cleaning up") it's my default de-noiser.
    I use MDegrain a fair bit myself for HD video which is grainy but otherwise fairly "clean" (yes I'm aware that sounds like a contradiction), but for everything else I tend to use QTGMC. If you haven't tried it, give this a spin on some lower quality DVD video and compare it to SMDegrain:

    (Single Threaded mode, progressive video)
    QTGMC(InputType=1, Preset="medium", EzDenoise=2)

    Raise or lower the EzDenoise value as needed (I generally use between 1 and 2 unless the video is very noisy) or for video with very light noise you can remove it entirely, and if you're not in a hurry try removing the preset option (I think the default Preset is "slower").

    As I said, the above is for progressive video. If the video needs IVTC, I'd run that first (to make the video progressive) then add QTGMC in progressive mode to the script. Something like:

    LoadPlugin("C:\Program Files\MeGUI\tools\avisynth_plugin\TIVTC.dll")
    tfm(order=1).tdecimate()
    QTGMC(InputType=1, EzDenoise=1)

    Of course if the video is purely interlaced, you'd just let QTGMC de-interlace it.
    QTGMC()

    I'd actually been using MeGUI for years to convert the audio in Avi-Mp4-Mkv files before I decided that I wanted to play with the video files as well. After a brief odyssey from MeGUI with defaults (too low quality) to VirtualDub-NeatVideo-UtVideo (too time consuming) to HandBrake-RipBot (too low quality) I'm back to MeGUI and AviSynth with filters and, wow, there sure is a lot to learn . I've checked out FFT3DFilter, DeGrainMedian, TemporalDegrain, MCTemporalDegrain, and MDegrain, which lead me to SMDegrain, and I've settled on SMDegrain for it's combination of ease of use (no, really), speed (full CPU usage is possible), and quality, but I'll definitely check out QTGMC when I have some spare time, as it's not possible to know too much, and thanks for the suggestion.


    Originally Posted by hello_hello View Post
    Auto-cropping is never "accurate". I use it as a starting point, then adjust the cropping manually as required to give myself nice clean edges. If the auto-cropping won't work though, there's possibly something wrong. Opening a video via DirectShow then changing the script to ffmsindex and re-opening the video preview would probably be an example of that.
    , and ouch. Now it's time for .
    Quote Quote  
  23. If you open the AVS Script Creator from the Tools menu and click on the Config button next to the drop down list next to "Avisynth profile" you can configure some of the defaults. Uncheck "Resize Filter" under the extra setup tab and MeGUI won't enable resizing by default (I'm pretty sure). You can also select which resizer it uses by default. You'll need to enable "Resize filter" first if it's disabled, then you can change the resizer and disable resizing again. You can set whether MeGUI defaults to mod2/4/8/ or mod16 by default, and you can enable "resizing up", which I think should be enabled by default, but it isn't.

    It's not necessary to resize unless you want to (*see clarification in blue below). If not, just disable resizing and encode "as-is". Very occasionally a width of mod2 might cause playback problems, although it's not overly likely. If you want to be safe, keep the width to mod4 when resizing. The height can be mod2. Generally though, I wouldn't worry about it too much. The mod? setting in the script creator is just a default you can set yourself and change when creating each script.

    I use DVDShrink for archiving DVDs as ISOs. If you set the default output size to something large in DVDShrink's options (ie DVD9 or greater) there's no need to worry about it trying to re-encode/shrink the video. I rip DVDs with it too, but for some newer copy protections it requires AnyDVD to do the decrypting in the background.

    The anamorphic encoding option is pretty easy...... first a quick explanation of the mod? thing......
    Traditionally encoders and decoders needed video with a width and height evenly divisible by 16 (mod16). For h264 that's no longer the case, although it might still useful for Xvid encoding. MeGUI lets you select your level of mod? paranoia, and when using anamorphic encoding will help you stick to it.

    Two of the anamorphic options automatically adjust the cropping to achieve the selected mod. So for example if you have mod8 selected and you crop 2 pixels from each side of a 720 wide video, the "overcrop" anamorphic option will probably change it to 4 pixels each side 720 - 4 - 4 = 712 (mod8). The "undercrop" anamorphic option does the opposite (reduces the cropping if need be). The same applies to the height.

    "Crop mod4 horizontally" does what it says. It'll only output a mod4 width, so whatever cropping you apply to the sides, it'll be adjusted by a couple of pixels if need be to make the output width mod4. The height can be mod2 so it doesn't change the top or bottom cropping. If you're going to be a little paranoid when using anamorphic encoding, "Crop mod4 horizontally" would probably be the method to use.

    The "encode non-mod16" option is probably a little deceptively named. It's the anamorphic option that doesn't adjust the cropping at all and lets you encode using any mod. The video is encoded "as-is" after cropping and it can be mod16, despite the name.

    None of the previously mentioned anamorphic options resize the video at all resizing is disabled). If anything, they just fiddle with the cropping to output the desired mod. The "resize to selected mod" option does allow you to resize. Generally when using anamorphic encoding the idea is not to resize though, but with the "resize to selected mod option", you can.

    If the input video is anamorphic (ie all DVD video and a small amount of HD video) then you must either use one of the anamorphic options (which gets MeGUI to set the correct display aspect ratio) or if you don't enable anamorphic encoding you must resize. If you don't do one or the other, the encoded video won't display correctly.

    If the input video has square pixels (the resolution and aspect ratio are the same) ie 1280/720=1.7777777 (16:9), then you can encode "as-is" without using anamorphic encoding or resizing, although you can still resize if you want to.


    I hope that helps.....
    Last edited by hello_hello; 15th Jul 2014 at 14:46.
    Quote Quote  
  24. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Originally Posted by hello_hello View Post
    If you open the AVS Script Creator from the Tools menu and click on the Config button next to the drop down list next to "Avisynth profile" you can configure some of the defaults. Uncheck "Resize Filter" under the extra setup tab and MeGUI won't enable resizing by default (I'm pretty sure). You can also select which resizer it uses by default. You'll need to enable "Resize filter" first if it's disabled, then you can change the resizer and disable resizing again. You can set whether MeGUI defaults to mod2/4/8/ or mod16 by default, and you can enable "resizing up", which I think should be enabled by default, but it isn't.

    It's not necessary to resize unless you want to (*see clarification in blue below). If not, just disable resizing and encode "as-is". Very occasionally a width of mod2 might cause playback problems, although it's not overly likely. If you want to be safe, keep the width to mod4 when resizing. The height can be mod2. Generally though, I wouldn't worry about it too much. The mod? setting in the script creator is just a default you can set yourself and change when creating each script....

    ...The anamorphic encoding option is pretty easy...... first a quick explanation of the mod? thing......
    Traditionally encoders and decoders needed video with a width and height evenly divisible by 16 (mod16). For h264 that's no longer the case, although it might still useful for Xvid encoding. MeGUI lets you select your level of mod? paranoia, and when using anamorphic encoding will help you stick to it.

    Two of the anamorphic options automatically adjust the cropping to achieve the selected mod. So for example if you have mod8 selected and you crop 2 pixels from each side of a 720 wide video, the "overcrop" anamorphic option will probably change it to 4 pixels each side 720 - 4 - 4 = 712 (mod8). The "undercrop" anamorphic option does the opposite (reduces the cropping if need be). The same applies to the height.

    "Crop mod4 horizontally" does what it says. It'll only output a mod4 width, so whatever cropping you apply to the sides, it'll be adjusted by a couple of pixels if need be to make the output width mod4. The height can be mod2 so it doesn't change the top or bottom cropping. If you're going to be a little paranoid when using anamorphic encoding, "Crop mod4 horizontally" would probably be the method to use.

    The "encode non-mod16" option is probably a little deceptively named. It's the anamorphic option that doesn't adjust the cropping at all and lets you encode using any mod. The video is encoded "as-is" after cropping and it can be mod16, despite the name.

    None of the previously mentioned anamorphic options resize the video at all resizing is disabled). If anything, they just fiddle with the cropping to output the desired mod. The "resize to selected mod" option does allow you to resize. Generally when using anamorphic encoding the idea is not to resize though, but with the "resize to selected mod option", you can.

    If the input video is anamorphic (ie all DVD video and a small amount of HD video) then you must either use one of the anamorphic options (which gets MeGUI to set the correct display aspect ratio) or if you don't enable anamorphic encoding you must resize. If you don't do one or the other, the encoded video won't display correctly.

    If the input video has square pixels (the resolution and aspect ratio are the same) ie 1280/720=1.7777777 (16:9), then you can encode "as-is" without using anamorphic encoding or resizing, although you can still resize if you want to.
    Thanks again for your patience (I swear there isn't enough time in a day), and I'm embarrassed to admit that I never noticed that (very small, very flush, ha ha) "Config" button. Thanks for making me aware of it. And thanks for your lucid explanations of "the mod? thing" and the anamorphic thing. I feel much less clueless . I've taken your advice and enabled "Upsizing allowed", with mod4 selected, and I've enabled "Clever (TM) anamorphic encoding", with "Crop mod4 horizontally" selected. Also, I've kept the "Resize Filter" ticked but changed it to "Lanczos4 (Sharp)". Since then I've had zero issues with encoding or playback, simply letting MeGUI add its "# Set DAR in encoder to 13 : 9. The following line is for automatic signalling..." information to the beginning of the script then weaving my SMDegrain (I still haven't had time to check out QTGMC ) script into the "LoadPlugin..." and "FFVideoSource..." information.


    Originally Posted by hello_hello View Post
    I use DVDShrink for archiving DVDs as ISOs. If you set the default output size to something large in DVDShrink's options (ie DVD9 or greater) there's no need to worry about it trying to re-encode/shrink the video. I rip DVDs with it too, but for some newer copy protections it requires AnyDVD to do the decrypting in the background.
    When I purchased my very first laptop seemingly a lifetime ago (and was even more clueless), a friend bartered the use her credit card to purchase the original SlySoft suite (AnyDVD, CloneDVD, CloneDVD mobile, and CloneCD) for a bit of home remodeling work. Little did I know that I've a touch of prescience, and I'll definitely check out DVDShrink (when I have time, ha ha). Thank you.


    Originally Posted by hello_hello View Post
    I hope that helps.....
    Above and beyond the call of duty, good sir-madam
    Quote Quote  
  25. I'd forgotten about this thread. I was looking through the previous few posts to refresh my memory, and for the record, I generally use Spline36 resizing, not Lanczos4. If memory serves me correctly they're very similar though. There's no right or wrong.... I just thought I'd mention it.

    Also.... I don't seem to have explained the "acceptable anamorphic aspect error" option, also hidden away in the AVS Profile configuration. It's set to 1% by default. I think the idea is to allow you to crop a few pixels while still outputting nice 4:3 or 16:9 aspect ratios (where applicable), by fudging the aspect ratio a tiny bit. For example if you open a 16:9 DVD, set the Input DAR in the script creator to 16:9, with anamorphic encoding enabled the DAR in the script should also be 16:9. If you crop just a couple of pixels with the "acceptable anamorphic aspect error" option set to 1%, it'll probably remain 16:9 in the script. With the option set to 0% it won't, or the DAR added to the script will probably be more accurate.
    Personally I think the "acceptable anamorphic aspect error" should be 0% be default. The user should need to give MeGUI permission to fudge the aspect ratio before it does, even though it doesn't fudge much.

    Speaking of aspect ratios..... for 4:3 DVDs selecting either "ITU 4:3 NTSC" or "ITU 4:3 PAL" as the Input DAR in the script creator would be correct 99.99% of the time. For 16:9 DVDs, mostly just selecting 16:9 as the Input DAR would be correct (no ITU). If a 16:9 DVD has a substantail amount of black each side which needs cropping (8 pixels or more) an "ITU 16:9" DAR would probably be correct.
    By default, MeGUI will select an appropriate ITU aspect ratio, but you can change that in it's options. The difference between using an "ITU" and "non-ITU" DAR isn't huge, but there is a difference (about 2.5%).
    Quote Quote  
  26. Member LouieChuckyMerry's Avatar
    Join Date: Jun 2010
    Location: Singapore
    Search Comp PM
    Originally Posted by hello_hello View Post
    I'd forgotten about this thread. I was looking through the previous few posts to refresh my memory, and for the record, I generally use Spline36 resizing, not Lanczos4. If memory serves me correctly they're very similar though. There's no right or wrong.... I just thought I'd mention it.
    Thanks for the update.


    Originally Posted by hello_hello View Post
    Also.... I don't seem to have explained the "acceptable anamorphic aspect error" option, also hidden away in the AVS Profile configuration. It's set to 1% by default. I think the idea is to allow you to crop a few pixels while still outputting nice 4:3 or 16:9 aspect ratios (where applicable), by fudging the aspect ratio a tiny bit. For example if you open a 16:9 DVD, set the Input DAR in the script creator to 16:9, with anamorphic encoding enabled the DAR in the script should also be 16:9. If you crop just a couple of pixels with the "acceptable anamorphic aspect error" option set to 1%, it'll probably remain 16:9 in the script. With the option set to 0% it won't, or the DAR added to the script will probably be more accurate.
    Personally I think the "acceptable anamorphic aspect error" should be 0% be default. The user should need to give MeGUI permission to fudge the aspect ratio before it does, even though it doesn't fudge much.

    Speaking of aspect ratios..... for 4:3 DVDs selecting either "ITU 4:3 NTSC" or "ITU 4:3 PAL" as the Input DAR in the script creator would be correct 99.99% of the time. For 16:9 DVDs, mostly just selecting 16:9 as the Input DAR would be correct (no ITU). If a 16:9 DVD has a substantail amount of black each side which needs cropping (8 pixels or more) an "ITU 16:9" DAR would probably be correct.
    By default, MeGUI will select an appropriate ITU aspect ratio, but you can change that in it's options. The difference between using an "ITU" and "non-ITU" DAR isn't huge, but there is a difference (about 2.5%).
    Thanks for the explanation, I've set the "Acceptable Anamorphic Aspect Error" to "0%", as errors at any percent are unacceptable . Thanks again for all your kind help, and I'll probably be back eventually .
    Quote Quote