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.
+ Reply to Thread
Results 1 to 23 of 23
Can you post a screenshot? How "big" are the black bars?
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 09:43. Reason: - Left out 'top' in 'top and 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:
Last edited by LouieChuckyMerry; 26th Jun 2014 at 06:09.
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 09:44. Reason: - Left out 'left and right edges' clarification - Need a new brain, mkv tagging system has screwed this one up.
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 09:50.
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.
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?
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
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:
+ 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.
Threads=8 SetMTMode(5,Threads) FFVideoSource("D:\Temp\TestKundun.mkv") SetMTMode(2) crop(2,112,0,-100) SMDegrain(Lsb=True,Chroma=False,Plane=0)
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.
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!
AviSynth script? If so, would you pretty please help me with the syntax?
Last edited by LouieChuckyMerry; 29th Jun 2014 at 03:24.
Last edited by smrpix; 29th Jun 2014 at 09:53.
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 02:20. Reason: Information, Information...
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.
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:
LoadPlugin("F:\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)
LoadPlugin("F:\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)
LoadPlugin("F:\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)
Last edited by LouieChuckyMerry; 30th Jun 2014 at 21:39. Reason: Grammar And Syntax
"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)
Trim(0,55476)FFVideoSource("D:\Temp\TestKundun.mkv", fpsnum=24000, fpsden=1001, threads=1)
As long as the same encoder settings are used each time (with "stitchable") there should be no problem appending the encodes with MKVMergeGUI.
Last edited by hello_hello; 30th Jun 2014 at 22:11.
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 02:55.
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:
Of course if the video is purely interlaced, you'd just let QTGMC de-interlace it.
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 02:14.
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.
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 13:46.