Log in

View Full Version : How to make anamorphic Xvid


Koppel
29th March 2008, 10:23
My source is anamorphic PAL *.mpg file. Media Player Classic shows its properties like this:

http://www.priits.com/Koppel/original_properties.png

Note the line: "Video: MPEG2 Video 720x576 (16:9) 25.00fps 8000Kbps"

I want Xvid to do the same, write the aspect ratio in the file info, so I can compress the video in its native resolution.
Until now I have been unsuccessful doing so.

http://www.priits.com/Koppel/xvid_aspect.png

Doesn't work with changing the Pixel Aspect Ratio nor Display Aspect ratio to 16:9.

Version of Xvid: 1.1.3-28062007
Copression with VirtualDubMod ver. 1.5.10.2 (build 2540)

Blue_MiSfit
29th March 2008, 20:52
You need to set the aspect ratio when muxing. This is easy to do with MKVToolnix (if you are muxing to MKV), but it should be equally easy with AviMuxGUI, though I havent used it in awhile, so don't quote me on it.

Setting it in Xvid doesn't seem to do much :) I forget the reason...

~MiSfit

talen9
30th March 2008, 00:28
Hmmm ... i'm not actually sure about this, 'cause I usually use XviD through GordianKnot ... but if I *correctly* set the DAR or PAR in the very same XviD configuration dialog that Koppel posted, my AVI files have the correct anamorphic signaling.

Maybe GordianKnot passes the PAR/DAR information to VDubMod for the muxing part of the process? :confused:

Ranguvar
30th March 2008, 01:33
The problem is just that most players (at least on Windows) ithat signaling in an AVI.

Try Media Player Classic and VLC. IIRC one or both of them did it correctly. Or use MP4 or MKV.

Lenny_Nero
30th March 2008, 02:54
Again, I have no problems doing so with the Xvid config. options, but as said it does help to get the right DAR, PAR settings. Before I started to do this I would always get results like 1.354:1, but setting 4:3 sorts the same encode with only that changed.

I use MPC and FFDshow as the player.

martino
30th March 2008, 03:13
The problem is just that most players (at least on Windows) ithat signaling in an AVI.

Try Media Player Classic and VLC. IIRC one or both of them did it correctly. Or use MP4 or MKV.
I think that is incorrect. Isn't the signalling supposed to be handled by DirectShow, and from what I read DirectShow does not read the signalling in AVI files, therefore it cannot be passed onto the renderer, therefore no matter what DirectShow based solution you use, it will not work? If this is correct then you are only left with duping it into MP4 or MKV.

Correct me if I'm wrong somewhere.

talen9
30th March 2008, 14:54
I think that is incorrect. Isn't the signalling supposed to be handled by DirectShow, and from what I read DirectShow does not read the signalling in AVI files, therefore it cannot be passed onto the renderer, therefore no matter what DirectShow based solution you use, it will not work? If this is correct then you are only left with duping it into MP4 or MKV.

Correct me if I'm wrong somewhere.

Well, my anamorphic AVI encodes play correctly via MPC/FFDshow (not VfW codecs) :)

Brother John
30th March 2008, 17:17
That Xvid dialog sets the PAR flag in the MPEG4 bitstream (DAR is converted to PAR automatically). It’s completely independent of the container used. Bitstream flag and MP4/MKV container flag can even co-exist. For proper playback splitter and decoder have to support AR signalling. Haali + ffdshow are a good choice for DirectShow. Just make sure to enable “Set par in output media type” in ffdshow’s “output” options.

A while back I did a comparison of a couple of DShow playback solutions. (Haali and Gabest splitter, ffdshow, Xvid and DivX decoder)
http://brother-john.net/ar-vergleich.html
The page is in German but you should be able to read the result tables. Afaik they are still valid today.

Koppel
30th March 2008, 21:53
So whats the conclusion?

Is it possible to have an Xvid *.avi file in anamorphic or not?
So that Media Player Classic shows it "Video size: 1024x576" whereas it actually is 720x576.

Or do I definitely have to use MKV or MP4?

SeeMoreDigital
30th March 2008, 22:07
So whats the conclusion?

Is it possible to have an Xvid *.avi file in anamorphic or not?
So that Media Player Classic shows it "Video size: 1024x576" whereas it actually is 720x576.Actually, these figures show that the anamorphic signalling (placed within the video bit-stream and muxed within the .AVI container) is working correctly!


Cheers

Ranguvar
30th March 2008, 22:22
Yep. To further clarify, the video is 720x576 as stored (1:1 PAR), but it is being stretched by the anamorphic signaling.

SeeMoreDigital
30th March 2008, 22:40
Yep. To further clarify, the video is 720x576 as stored (1:1 PAR), but it is being stretched by the anamorphic signaling.Indeed, using 64:45 PAR signalling...

Brother John
30th March 2008, 22:41
If it’s stretched, it can’t be PAR 1:1. 720->1024 is (generic) PAR 64:45.

sysKin
31st March 2008, 05:08
By the way, those screens look like from WMP not MPC??

Koppel
31st March 2008, 10:09
Actually, these figures show that the anamorphic signaling (placed within the video bit-stream and muxed within the .AVI container) is working correctly!
Its working correctly in the *.mpg file, not in the xvid I'm trying to make.
Is this caused by VirtualDub or is this because of xvid's inability to do so. Thats what I'm trying to find out.
I want the xvid encode to show the video like its 1024x576 but it opens up 720x576 like the Aspect Ratio settings in the xvid config doesn't count.

sysKin, the screens are exactly the same in MPC and WMP

talen9
31st March 2008, 11:46
Could you try to download and install AVInaptic (http://forum.doom9.org/showthread.php?t=123076)? It's simply a matter of downloading a zip file and extracting the contentes, no setup or registry messing.

You open the final AVI file which *should* be anamorphic with it, then "File" -> "Save report" produces a .txt file with the same name as your .AVI.

If you post it here, it'll give us info about the correct (or wrong) aspect information of your encode ... because it could be a problem in the chain of player/splitter/codec which doesn't preserve the aspect information too ;)

Brother John
31st March 2008, 11:50
If you set the AR flag on Xvid’s “aspect ratio” tab, it’s in the bitstream. For a twopass encoding, the second pass is the one that counts. Make an analysis with avinaptic (http://forum.doom9.org/showthread.php?t=123076) to find out if your encoded file really has the flag set (and post the logfile if you’re unsure).

The problem is more likely on the playback side. What’s your exact setup there?

Koppel
31st March 2008, 15:25
avinaptic report
[ Video track ]

FourCC: xvid/XVID
Resolution: 720 x 576
Frame aspect ratio: 5:4 = 1.25
Pixel aspect ratio: 64:45 = 1.422222
Display aspect ratio: 16:9 = 1.777777
Framerate: 25 fps
Number of frames: 500
Stream size: 9,750,954 bytes
Bitrate: 3900.3816 kbps
Qf: 0.376194
Key frames: 11 (0; 62; 87; 124; 149; ... 408)
Null frames: 0
Min key int: 1
Max key int: 143
Avg key int: 45.454545
Delay: 0 ms

Looks like the tags are in the xvid file but Media Player Classic doesn't read them correctly. Damn, why does it read the tags from the *.mpg then?
Is there a difference whether I change the PAR or DAR to 16:9 ?

Found this:
Koepi
14th July 2005, 16:14
XviD's directshow filter from the 1.0 branch has no support for "on the fly aspect ratio correction", thus you see correct aspect ratio in VLC but not in media player.

Install the xvid-1.1-build (i.e. from my site) and try playback through media player again, it should look different. (Unless you did _not_ use packed bitstream, the dshow code doesn't get the information right for non-packed-bitstreams).

Cheers
Koepi

I don't really get what Koepi says, the correct way to show the picture is up to the decoder not the media player or what?

SeeMoreDigital
31st March 2008, 15:52
Some early MPEG-4 Part-2 (Xvid and DivX) direct-show video decoders did not fully support MPEG-4 video streams containing anamorphic signalling!

However, all the newer MPEG-4 Part-2 direct-show video decoders now do ;)

Personally, I use FFdshows filter suite....

Brother John
31st March 2008, 16:02
Pixel aspect ratio: 64:45 = 1.422222
Yep. PAR is set in the file.

the correct way to show the picture is up to the decoder not the media player or what?
Decoder and Splitter actually. Which of those are you using? In MPC: Contents of “Play / Filters” while the movie is running.

One of the most compatible solutions for the different AR signalling situations is Haali Media Splitter (http://haali.cs.msu.ru/mkv/) + FFDShow (http://ffdshow.info). In ffdshow’s “output” options enable “set par in output media type” and “allow output format changes”.

Koppel
31st March 2008, 19:06
I like to produce a file that gets played like its meant to be in any computer, not just mine.

I think I found part of the problem why MPC didn't stretch the image.
I had the "Playback > Output" DirectShow Video as Overlay Mixer*
Setting it to "VMR9 (renderless)" makes the opened files look like they're letterboxed. Right proportions but with black bars.
When viewing full screen the black bars don't matter, the picture is just scaled inside the MPC window.

I was hoping the video gets shown like its resolution is 1024x576 but instead it gets showed downscaled like its 720x405 in the program window.
Full screen there is no difference between them.

talen9
31st March 2008, 20:17
Setting it to "VMR9 (renderless)" makes the opened files look like they're letterboxed. Right proportions but with black bars.
When viewing full screen the black bars don't matter, the picture is just scaled inside the MPC window.

I was hoping the video gets shown like its resolution is 1024x576 but instead it gets showed downscaled like its 720x405 in the program window.
Full screen there is no difference between them.

Sometimes MPC behaves in this way to me too, when opening anomorphic encodes.
Try this: when you open the file, and it appears letterboxed, right click on the video -> "Video Frame" -> "Touch window from the inside", and "Zoom" -> "100%" ... usually it works with the correct vertical resolution, in this way :)

Koppel
31st March 2008, 21:29
Does anyone know how the aspect ratio info is different in the *.mpg file than in the xvid *.avi.

I pretty much have the answer to my original question and confirmation that the aspect ratio settings in the xvid actually do work.
I would still like to know why the aspect ratio in the *.mpg file gets shown correctly even in the "overlay mixer" mode of MPC while the xvid *.avi file is not.

SeeMoreDigital
31st March 2008, 21:59
Does anyone know how the aspect ratio info is different in the *.mpg file than in the xvid *.avi.Before you develop an understanding about that....

First you have to understand that an MPEG-2 video stream placed within the .MPG container uses a completely different direct-show video decoder filter than an MPEG-4 video stream placed within the .AVI container.

And yes, provided you have the correct MPEG-4 decoder filter installed and configured correctly, along with your media player. There's no reason why your anamorphic MPEG-4 files wont behave in the same way as your anamorphic MPEG-2 files..... All mine do!


Cheers