Log in

View Full Version : Encoding 1440 x 1080 16:9 rectangular pixel xvid files


nig103
10th August 2006, 09:42
hey all,

I'm after a bit of help if possible. I'm converting some HD captures that are 16:9 - 1440 x 1080 to xvid.

Now, I've done a fair bit of reading and understand that the pixels in my source video aren't square. I'd like to keep the 1080 lines though if possible, but don't want to resize to 1920 x 1080 as seems a waste of space and encoding is sooo slow...

my questions are..

Is there any point specifiying in the Xvid encoder that the pixels are non-square? (From what I've read, xvid doesn't seem to support it too well)

Is it best to just encode at 1440 x 1080 (with 1:1 square pixels) and use zoomplayer or ffdshow to resize on playback?

Do other codecs support non-square pixels better than xvid?

Just wondering how everyone else encodes this sort of video to the lovely xvid codec.

Thanks

:)

mod
10th August 2006, 09:57
Hi.
From what I've read, xvid doesn't seem to support it too well
Where did you read it? I make all my encodes (xvid_encraw) with custom PAR and they work fine.

Blue_MiSfit
11th August 2006, 21:01
Roger that. It may have been a bit flaky when they first implimented it, but I think that was on the decoder side. I know for a fact that if you set the PAR in XviD, and then mux to MKV it will correctly apply the AR if you playback using media player classic. Not sure about other players offhand.

Sounds like you're working with HDV :)

~MiSfit

SeeMoreDigital
11th August 2006, 21:21
Indeed...

If you are able to, encode to XviD at 1440x1080 pixels (ie: the same as your source) and add an aspect ratio signalling value of 4:3.

If however you end up having to use "mod 16" pixel resolutions, then you could try 1440x1088 and add an aspect ratio signalling value of 227:169


Cheers

nig103
14th August 2006, 04:29
Thanks all for the replies...

Have been using Gordion Knot to encode these captures, and specifiying in the Xvid options the aspect ratio...
Was using Xvid 1.0.3 with no luck, then tried 1.1.0 last night and still no luck...

I'm just using video-redo or projectx to sync the audio (gotta get a new antenna...)
DGIndex to create a project, (version included with G_knot, think it's 1.4.3 (or 1.4.6, can't remember))
Will edit the .avs files myself as don't want to resize or undot etc... Originals are 1440 x 1088, so I do crop 8 pixels to make it 1440 x 1080, Doing this as the 8 pixels or bottom line are just black anyway, and am thinking it is better to have 1080 as one day I may burn to HD or blu-ray where 1080 will be a standard???
Then just set the PAR in the first and second pass Xvid options and get gknot to feed .avs's to vdub for encoding...

Using FFdshow as decoder on playback. (tried uninstalling ffdshow, re-installing xvid, but xvid playback decoder runs jumpy on my system, 1440 x 1080 clip, cpu maxing out, cannot play back properly... have a fast machine, 3.0gig athlon64)

Which xvid decoder does everyone use for playback?

Do you think it will work encoding through G_knot and just setting the option in the xvid encoding options?

Also, seemoredigital suggests to set to 4:3, would it be 4:3 or 16:9? When I set it to 16:9 manually in Zoomplayer it looks right...

Last one, mux to mkv? blue_misfit suggested this, is .mkv an mpeg-4 compliant container? I think I need to do some more reading on this...

Thanks for the help! Thanks to all the info on this site, I'm very close to having a procedure for what to do with HD footage!!! Guess it's history repeating itself, Used to backup DVD's to divx/xvid as dvd burners and media were too expensive. Now need to archive this HD stuff somewhere until HD or blu-ray is affordable!!

Zero1
17th August 2006, 00:16
Originals are 1440 x 1088, so I do crop 8 pixels to make it 1440 x 1080, Doing this as the 8 pixels or bottom line are just black anyway, and am thinking it is better to have 1080 as one day I may burn to HD or blu-ray where 1080 will be a standard???I would suggest 1088 as it is mod 16. You will find that most, if not all broadcasts are actually 1088 pixels (I believe that's actually specified in a standard). Also regarding Bluray and HD-DVD, these are also almost certainly going to be using 1088 as it offers mod16 for progressive, and more to the point, mod32 for interlaced (I'm not sure on the plans for 1080p HD-DVD/Bluray, if any; kind of been out of the loop).


Then just set the PAR in the first and second pass Xvid options and get gknot to feed .avs's to vdub for encoding...If you aren't a CLI-phobe, I would check out the XviD CLI (encraw), there is a thread where it's being updated and tested. It means you can encode MPEG-4 ASP without the hacks needed for VfW. In other words the streams you produce with the XviD CLI will be spec compliant, but strictly speaking, the ones produced using the VfW aren't.


Using FFdshow as decoder on playback. (tried uninstalling ffdshow, re-installing xvid, but xvid playback decoder runs jumpy on my system, 1440 x 1080 clip, cpu maxing out, cannot play back properly... have a fast machine, 3.0gig athlon64)

Which xvid decoder does everyone use for playback?
I use FFDShow also, but I am almost able to play 1080p H.264 on my A64 3400, so it sounds like there might be something amiss with your setup.


Do you think it will work encoding through G_knot and just setting the option in the xvid encoding options?

Also, seemoredigital suggests to set to 4:3, would it be 4:3 or 16:9? When I set it to 16:9 manually in Zoomplayer it looks right...
Possibly, if you are muxing using MP4box, you are able to set the SAR at the time of muxing (and if there is a SAR already, you can change it). Also we should clarify some things. 16:9 is the DAR (Display Aspect Ratio), basically the shape of the frame. For MPEG-4 ASP (DivX and XviD) and H.264, aspect ratios are specified as a SAR (Sample Aspect Ratio). SAR to put it simply is the stretch factor for the horizontal resolution. For example we should set the SAR to 4:3, that means that 4/3=1.333333 etc. 1.33r x 1440 = 1920. If you set the SAR as 16:9, that would be 16/9 = 1.77r, and 1.77r x 1440 = 2560.

The other thing is that if the encode is 1088 pixels with 8 black lines, then 4:3 would probably still be Ok. I think SeeMoreDigital's 227:169 only really applies for if the encode used all 1088 lines, but I guess that it's probably a matter of opinion.

Last one, mux to mkv? blue_misfit suggested this, is .mkv an mpeg-4 compliant container? I think I need to do some more reading on this...
Yes and no. Yes MKV is capable of storing native MPEG-4 ASP and H.264 (though in case it has any bearing for you, I heard that VLC does not seem to like native ASP in MKV). No because it's a public domain container. It is not affiliated with MPEG in any way, or in the specs. It is compatible in the real world for the most part, but MPEG only recognise .ts and .MP4 as valid containers for MPEG-4 ASP and H.264 (certainly H.264, but not sure if ASP is specified in MPEG-2 TS). If you are encoding stuff with the intention of playing it in the future, say on hardware players or something, there is a greater chance with MP4. Even though it's not specified as a requirement for Bluray or HD-DVD, it is a hell of a lot more likely to be supported than MKV.

Blue_MiSfit
17th August 2006, 01:11
True. The only reason I use MKV over MP4 is that you can put ANYTHING in it. If I need SAP compatibility, I can always remux :) I also personally like mkvmergeGUI a lot more than YAMB.

All personal preference :)

~MiSfit

Zero1
17th August 2006, 10:06
True. The only reason I use MKV over MP4 is that you can put ANYTHING in it. If I need SAP compatibility, I can always remux :) I also personally like mkvmergeGUI a lot more than YAMB.

All personal preference :)

~MiSfit
This is true, and in contrast to you, I prefer MP4box's CLI over mkvmerge's. Each to their own as they say.

Nearly all my encodes are just basic H.264 + AAC (and a lot of other people I know). So the question is not "Why MP4?" but "Why not MP4?" I appreciate the flexibility of MKV; I used it a few times for storing demuxed DVB streams until MP4box supported it as such. For basic streams I don't require any of the fancy features MKV offers so I use MP4 what with it being spec. It's nothing detrimental to MKV though; it's awesome that a bunch of guys can design and document a high spec container like MKV; but for basic usage it just isn't for me.

JnZ
18th August 2006, 09:17
hey all,
Is it best to just encode at 1440 x 1080 (with 1:1 square pixels) and use zoomplayer or ffdshow to resize on playback?

Do other codecs support non-square pixels better than xvid?

Just wondering how everyone else encodes this sort of video to the lovely xvid codec....

I do some this things many times.
I prefer converts anamorphs 1280x1080->720p with square pixels.
I think, that there is no big quality diff. betwen anamorph and square encodes (a least at 720p displays). But needed biterate is very different.

1440x1080 puts what? 720p too? I don't know.
J.

nig103
23rd August 2006, 09:16
Thanks again for the replies, has cleared alot of things up...

I've now created some sucessfull clips using MKVmerge.

The clips were encoded with G_Knot, Xvid 1.1 (vfw)
I've also started playing with xvid_encraw, using megui last night.

So my new questions are...

Is the only aspect ratio flags you can set in Xvid - PAR (Pixel Aspect Ratio) and DAR (Display aspect ratio), and then there's a flag in the container file SAR (Source aspect ratio)?

In xvid vfw encoder options, it looks like you can only set PAR or DAR, is it correct to say that only one of these will be able to be set in the codec and SAR will be able to be set in the Container?
If so, for resizing on playback, which is best to set?

The successfull clips I've created were done so with MKVMerge, and specifying a 16:9 aspect ratio when muxing... Is MKVMerge specifying the SAR or DAR here? Zero1 and seemoredigital suggested to set 4:3 SAR here when muxing with MP4Box, (which makes perfect sense, 1440 x 1.33), Is it better to mux with MP4box to properly set a 4:3 SAR to the 1440 x 1088 encode.

If using Megui and Xvid Encraw, how would one set the DAR or PAR in the video file? I couldn't find any options for aspect ratio's in the xvid settings in megui... Would you have to modify the syntax of the command here?

With the g_knot created 16:9 (when muxed with mkvmerge) media player classic seems to resize to 1920 x 1088 so it's at least resizing the right way... Are the main advantages of using xvid encraw, more efficient use of the codec, and creating mpeg-4 compliant streams?

Last one, on resolution. to encode mod 8 - 1440 x 1080 or mod16 - 1440 x 1088. Zero1 says that 1088 is a mod16 res, (is this how many pixels will be in a block for YV12 to store luminance and chroma settings?), Anyway, is it just inefficient for the codec to use mod8 resolutions instead of mod16?

I'd like to use 1920 x 1080 as when playing back on a 1080i or crt monitor at say 1920 x 1440 and with 16:9 flags set, at least it will only be doing horizontal resizing. 1920 x 1080 = 16/9. Whereas with 1088, surely it has to do vertical resizing also? Is this really an issue, or is resizing on playback so good these days that it's not worth worrying about?

Thanks, I'm sure these questions have been answered a thousand times... I just get lost in the forums sometimes looking for the right info...

Thanks again!!

foxyshadis
23rd August 2006, 17:26
MeGUI sets the DAR in the container, not in the codec. Really, SAR/PAR is a way to go mad, far easier to just stick with DAR all the time. (Which is what mkv and mp4 do.) Setting it in the container makes it easier to mess with but unfortunately harder to remux to others properly.

And xvid, x264, and most other codecs have ways to maximize the efficiency of non-mod16 res, whereas some fill it with a black matte (more a way to minimize it, heh).

No time to answer more. ;_;

SeeMoreDigital
23rd August 2006, 21:15
Personally speaking, I prefer to embed the "Aspect Ratio Signalling" within the MPEG-4 stream and not within the container ;)

mod
24th August 2006, 09:10
Personally speaking, I prefer to embed the "Aspect Ratio Signalling" within the MPEG-4 stream and not within the container ;)
Agree 100%, IMO the AR belongs to the content, not to the container.

nig103
30th August 2006, 03:16
Thanks for the replies all...

Sounds like setting it in the codec is the way to go, however, I just can't get it happening. I have it resizing my 1440 x 1080 clips correctly by setting the AR in the mkv container, but still can't get it working by setting the AR in the codec....

I'm not sure what piece of the puzzle I'm missing... But I've created xvid files using Gknot and Megui/xvid encraw and then am setting the AR with Mpeg4 Modifier... None of the clips I set the aspect ratio on work though!! Can't work out why...

Have tried using Nic's Xvid decoder and FFDShow (which both pick up the AR when set in the mkv container), but they just won't pick it up when I set it in the codec...

The clips I've created in Gknot (some I've left as 1:1 and some I've set the aspect in the xvid codec), the ones that I've set the aspect in xvid via gknot, when opened in mpeg4 modifier show the correct AR I've set... Same deal with the megui clips I've set the AR in with Mpeg4 Modifier, when opened in MPEG4Mod again they show the correct AR. So it looks like it's set properly in the xvid encodes. But the player/decoder just won't pick it up??

Am using Media Player Classic, have also tried Zoomplayer, no go.....

Sure it's something basic on the decoder/player side of things that I'm missing... Any ideas?

Thanks again

SeeMoreDigital
30th August 2006, 09:07
What MPEG-4 direct-show video decoder filter are you using to playback your MPEG-4 sources with AR signalling?

Unlike MPEG-2 decoder filters, not all MPEG-4 decoder filters offer "anamorphic" playback as standard...

nig103
31st August 2006, 03:35
Thanks SeeMoreDigital

I finally worked it out last night... Was just extra decoder stuff (overlay mixer or somethin) running in conjunction with nic's xvid filter in media player classic... Tried it on another PC and bang! it worked!! Unzipped MPC again over the version I was using and I'm away!!!

4:3 and 227:169 PAR's works now!! Woohoo!!

last question from me to finally put this to bed...

Option 1 - 1440 x 1080 with 4:3 PAR resizes to 1920 x 1080 - 16/9 AR (mod8 res) (cropping 8 pixels which are black anyway)

Option 2 - 1440 x 1088 with 227:169 PAR resizes to 1934 x 1088 - very very close to 16/9 AR (mod16 res)

Option 3 - 1440 x 1088 with 4:3 PAR resizes to 1920 x 1088 - 1.764 AR slight aspect ratio error (mod16 res)

These are my options I think for how I'll encode these 1440 x 1088 clips...

What would everyone recommend? I'd like to go with option 1 or option 3 as when viewed on my CRT monitor, I can view at 1920 x 1440 so the only resizing being done is the PAR stretching to 1920 x 1080 or 1088, Therefore it will only be resizing horizontally and not vertically??

I think to go with a mod16 res and preserve to the initial clip perfectly, then Option 2 is the best.... But this will require extra resizing? Specifically vertical resizing on playback??

Maybe I'm being a bit stupid here in that there's probably not much difference in all the methods as resizing is so good anyway...

My clips are usually 1 hour TV shows, so they're about 40-48 minutes without ads and I only want to get 2 episodes per DVD... So I have 2200mb to throw at each one... Given that this is a decent bitrate for Xvid, do you think the mod8 res would be OK, or would there still be great advantages to using a mod16 res...

Thanks again, it's taken me longer to work this out than it should've as I've only got an internet connection at work these days... buggure!! This site and all its users are a massive help though!!

Cheers