Help - Search - Members - Calendar
Full Version: Removing black bars and other issues
Hydrogenaudio Forums > Digital Audio/Video > General A/V
music_man_mpc
I am new to encoding video. Learning how has been on my to-do for at least 3 years now, but the complexity of it all, especially when compared to audio, has scared me away time and time again. I don't like sub-optimal results for things like this so I wasn't willing to do any encoding what-so-ever until I throuoghly understood the beast (video encoding, that is). Anyway here I am after nearly 24 straight hours of research and twiddling, finally encoding my first test video into XviD! However I have noticed something odd, despite the fact that I am using near default settings I am getting ~1 I-frame for every 20 frames encoded! Thats 15X as many as I should be getting blink.gif . My settings are as follows:

Default B-Frames (2 offset=1, ratio=1.5)
Adaptive Quantization
Qpel
Trellis
Motion Search Precision = 6 Ultra high
Chroma motion
Turbo
VHQ=4 (It is going to take an hour for this 5 minute video, but I don't really care how long it takes my comp can multitask well enough smile.gif)
GMC

For the test clip I am encoding I selected ~5min with VirtualDubMod and then divided the exact time of the clip by the full time of the movie so I could get a ratio to set Target Filesize (I multiplied the result by the filesize of a two disc encode 1433600 IIRC) and then did the same for the audio size. Thus, hopefully, producing a clip fairly close to the same way it would have been produced if I encoded the entire movie.

Also I want to remove the black bars from the top and bottom of the screen, but at this point have absolutely no idea as to how I should go about doing this any suggestions? Oh and when I have done that I would like to produce an anamorphic widescreen video, I am using Matroska as my container.

Thanks in advance for your help
-Tyler

edit: ARGH! It seems that the vorbis audio stream and the origonal AC3 too, are ~2 seconds shorter then the video inside of the VOB file. Not only that but my test file was out of sync mad.gif . Why is the audio shorter than the video and how do I fix the sync issue?
Ollie
Im not sure about the I-Frames thing personally, but those XVID settings are a bit weird i must say. What matrix are you using, custom or mpeg? What resolution are you compressing in? What was the movie's compressability at that resolution?

For those settings, i would personally turn off GMC, Adaptive Quantisation, Turbo, and drop the VHQ to 1 or 2. AQ is for saving bitrate on 'unvisible' areas, doesnt always work like that but. With turbo on, i doubt there would be any real quality gains from using VHQ=4 and you would gain some speed by dropping to VHQ=1 and disabling turbo. GMC is basicly worthless, it has been said by the devels of XVID and not worth the speed loss.

Did the original movie have black bars? You would destroy the aspect ratio if so trying to remove the black bars. If the movie doesnt have black bars, but your encodes do, set the anamorphic flag in the MKV container when you mux it. You wont see a difference in Media Player Classic unless you disable its inbuilt mkv splitter and use another because of an issue MPC's MKV splitter.

How did you encode your audio?
music_man_mpc
First of all I would like to thank you for your reply, it seems like I have been waiting forever.
QUOTE(Ollie @ Dec 12 2004, 09:20 PM)
Im not sure about the I-Frames thing personally, but those XVID settings are a bit weird i must say. What matrix are you using, custom or mpeg? What resolution are you compressing in? What was the movie's compressability at that resolution?
*

Actually I used the H.263 matrix, I was intending to test both matrices along with many of the other options, but I wanted a better understanding of some of this stuff first. I am compressing in the native resolution of the input video, as far as I know. As far as custom matrices go, I looked at several threads about them on doom9 . . . perhaps there is something to them, but it looks to me almost as if people are creating them arbitrarily or based on this numerical rating (I'm not sure what this number was but I saw it next to test encodes of different matrices on a couple of threads) scale which, as most of us here at HA.org know only too well, says nothing about subjective quality.

QUOTE(Ollie @ Dec 12 2004, 09:20 PM)
For those settings, i would personally turn off GMC, Adaptive Quantisation, Turbo, and drop the VHQ to 1 or 2. AQ is for saving bitrate on 'unvisible' areas, doesnt always work like that but. With turbo on, i doubt there would be any real quality gains from using VHQ=4 and you would gain some speed by dropping to VHQ=1 and disabling turbo. GMC is basicly worthless, it has been said by the devels of XVID and not worth the speed loss.
*

As I understand it turbo enables some speed optimizations which may effect the successfulness of the Motion Prediction but shouldn't if the optimizations have been implemented properly; is this inaccurate? I would like to test the effectiveness of AQ, GMC and higher levels of VHQ. There does not seem to be much of a consensus as to whether these settings help or not.

QUOTE(Ollie @ Dec 12 2004, 09:20 PM)
Did the original movie have black bars? You would destroy the aspect ratio if so trying to remove the black bars. If the movie doesnt have black bars, but your encodes do, set the anamorphic flag in the MKV container when you mux it. You wont see a difference in Media Player Classic unless you disable its inbuilt mkv splitter and use another because of an issue MPC's MKV splitter.

How did you encode your audio?
*

Yes, the original movie does have black bars but couldn't the effect on aspect ratio due to removing them be compensated for? In the FAQs it says all the aspect ratio stuff is for advanced users only, but it should just be a matter of simple ratio and proportion, shouldn't it? How do I set the anamorphic flag in the MKV container? Currently I am using VirtualDubMod to create my Matroska files. I encoded my audio by merging all the VOBs ripped from the source DVD to one large VOB, with DV-Tool, then I loaded the one huge VOB in VirtualDubMod and then went to Streams --> Stream List to bring up the AC3 stream (which, interestingly enough is 2 seconds shorter than the video stream O_o) and then hit Demux to extract the audio stream to a 5.1 channel .ac3 file. I then used foobar2000's diskwriter plugin (16 bit fixed point PCM) with the "Downmix 5.1 to Stereo" DSP plugin to create a large 2-channel wav file, which I subsequently encoded using oggenc2 with libvorbis1.1 at -q 4. Then I go back to Stream List, disable the embedded AC3 stream and add the external Ogg Vorbis file.
music_man_mpc
I figured out how to fix the audio sync problem from fooling around in VirtualDubMod. I am currently encoding another 5min test file, this time with Ollie's recommendations for settings: no GMC, no Adaptive Quantisation, no Turbo, and only a VHQ of 1. It's encoding ~15% faster, not as big a difference as I would have thought, I'm still getting the strange issue with I-frames to one for every 25 frames instead of one for every 300 frames. Tomorrow I will try enambling the doptions I disabled this time, one at a time to see what difference they each make in terms of speed and quality.

I had better get to bed now, 42 hours is a long time to stay up. wacko.gif
Ollie
QUOTE(music_man_mpc @ Dec 13 2004, 04:26 PM)
Actually I used the H.263 matrix, I was intending to test both matrices along with many of the other options, but I wanted a better understanding of some of this stuff first.

Yes, matrix are a bit confusing..

Nutshell version, h263 is a 'softer' matrix made for 1 cd encodes mostly. Mpeg matrix is a 'sharper' matrix and you can see the difference. It also means you need more bitrate. The encode size has to be bigger, or the resolution has to be smaller.
QUOTE(music_man_mpc @ Dec 13 2004, 04:26 PM)
I am compressing in the native resolution of the input video, as far as I know.

Ok, you are a bit offbase here. You have to 'crop' any black bars in your encode, and resize to a 'mod 16' resolution, otherwise XVID wont work properly. Look up Gordian Knot for this, and use the latest beta. There are very good guides on Doom9 for this, just make sure you get the latest beta of Gordian Knot.
QUOTE(music_man_mpc @ Dec 13 2004, 04:26 PM)
As far as custom matrices go, I looked at several threads about them on doom9 . . . perhaps there is something to them, but it looks to me almost as if people are creating them arbitrarily or based on this numerical rating (I'm not sure what this number was but I saw it next to test encodes of different matrices on a couple of threads) scale which, as most of us here at HA.org know only too well, says nothing about subjective quality.


Some of the matrix are made on a system sort of like the psy models in our audio encoders. Thats where the Human Visual System name comes from (i think, someone correct me if im wrong). In Doom9's codec comparison he used HVS Best. Others that are very good are SixOfNine and SixOfNine-HVS (i use this one). You can get a matrix pack here for later when you feel comfortable with them.
QUOTE(music_man_mpc @ Dec 13 2004, 04:26 PM)
As I understand it turbo enables some speed optimizations which may effect the successfulness of the Motion Prediction but shouldn't if the optimizations have been implemented properly; is this inaccurate?  I would like to test the effectiveness of AQ, GMC and higher levels of VHQ.  There does not seem to be much of a consensus as to whether these settings help or not.

What turbo does is, it reduces the accuracy of QuaterPixel and the B-Frames (B-Vops). If you used no B-Frames or Qpel, you wouldnt see a difference i believe. AQ definately has its place, but it has been known to have some problems and not worth it if your doing a 2 cd encode. Atucally, someone made an excelent FAQ for these questions which can explain them better then me, here is the link.
QUOTE(music_man_mpc @ Dec 13 2004, 04:26 PM)
Yes, the original movie does have black bars but couldn't the effect on aspect ratio due to removing them be compensated for?  In the FAQs it says all the aspect ratio stuff is for advanced users only, but it should just be a matter of simple ratio and proportion, shouldn't it?  How do I set the anamorphic flag in the MKV container?  Currently I am using VirtualDubMod to create my Matroska files.

Ok, problem here. Dont use VDubMod to create your MKV files because it uses an outdated method. Use this. This program also allows you to set aspect ratios. It also allows you to put in chapters if you want.
QUOTE(music_man_mpc @ Dec 13 2004, 04:26 PM)
I encoded my audio by merging all the VOBs ripped from the source DVD to one large VOB, with DV-Tool, then I loaded the one huge VOB in VirtualDubMod and then went to Streams --> Stream List to bring up the AC3 stream (which, interestingly enough is 2 seconds shorter than the video stream O_o) and then hit Demux to extract the audio stream to a 5.1 channel .ac3 file.

You cant use XVID this way. Because all mpeg-4 encoders must have the black borders completely cropped, and the resolution resized to a 'mod 16' (which means multiple of 16) number. Look at Doom9's guides for how to use DGDecode/DGIndex (aka dvd2avi, which is an older version) to prepare the files for encoding and use in Gordain Knot.
QUOTE(music_man_mpc @ Dec 13 2004, 04:26 PM)
I then used foobar2000's diskwriter plugin (16 bit fixed point PCM) with the "Downmix 5.1 to Stereo" DSP plugin to create a large 2-channel wav file, which I subsequently encoded using oggenc2 with libvorbis1.1 at -q 4.  Then I go back to Stream List, disable the embedded AC3 stream and add the external Ogg Vorbis file.

Curious, why not just go straight from the AC3 file to oggenc? Depends on your setup, but i like using BeSweet to encode my audio (comes with GKnot, just update the libvorbis file), or Foobar2000 with the dynamics compressor because i hate extremely quite sound.

Oh, and dont download the codec pack. If you got XVID from keopi you dont need the pack because i doubt you would want to use the other codecs.
smok3
the usual procedure i use is:

1 rip
2 make dvd2avi project and extract ac3 files (or decode)
3 open dvd2avi project in gknot and generate avisynth file
(i always do a 1:1 pixel AR encodes - becouse i wanna be compatible with my standalone elta)
- meantime audio is encoding if i choose my final format to be mp3
4 open that avisynth (which is allready scaled, croped, and so on..) in vdub(mod)
4b encode to xvid (using the settings i think that are fancy at that moment)
5 mux audio and video

(it is bacially gknot manual method as opposed to automatism that is possible in gknot)

-----------------

now if you wanna use anamorfic aspect ratios there are some calculators to be found on doom9.org which will come handy if you want to calculate new AR based on amount of cropping applied (original dvd is 'only' either 4:3 or 16:9 (most) - every other aspect is produced using black borders).

notes: personally i almost always use mod32 to be most compatible (but mod16 should work in most situations today)

edit: and yeah, get gknot (which includes avisynth) to gain some speed over your procedure.
ChristianHJW
QUOTE(Ollie @ Dec 14 2004, 09:11 AM)
QUOTE(music_man_mpc @ Dec 13 2004, 04:26 PM)
Yes, the original movie does have black bars but couldn't the effect on aspect ratio due to removing them be compensated for?  In the FAQs it says all the aspect ratio stuff is for advanced users only, but it should just be a matter of simple ratio and proportion, shouldn't it?  How do I set the anamorphic flag in the MKV container?  Currently I am using VirtualDubMod to create my Matroska files.

Ok, problem here. Dont use VDubMod to create your MKV files because it uses an outdated method. Use this. This program also allows you to set aspect ratios. It also allows you to put in chapters if you want.


I can only support this. MKV files created with VirtualdubMod are 100% spec compliant, but its not the recommended way anymore. mkvmerge.exe / mmg.exe or AlexNoe's avi-mux GUI ( never mind the name wink.gif ) are the much better way to produce MKV files these days ...

Christian
matroska project admin
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.