Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 ASP

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th May 2004, 17:35   #1  |  Link
wanton
Registered User
 
Join Date: Jan 2002
Posts: 28
Changing Embedded XVID aspect ratio?

Is there any utility to change xvid embedded aspect ratio? I've come across some video files that seems to have wrong aspect ratio in xvid encoded video and i don't seem to find any utility to fix it to correct one. I'm using XBOX Media Center that's based on mplayer. I have couple of files that are 640x480 resolution but show as 1.21 but are really 1.33 but for now i haven't found anyway to patch or remove aspect flags from avi file without re-encoding video.
wanton is offline   Reply With Quote
Old 25th May 2004, 20:53   #2  |  Link
Neo Neko
Registered User
 
Neo Neko's Avatar
 
Join Date: Mar 2002
Location: Kansas City, Missouri
Posts: 1,812
AFAIK there is no such software yet. It should be possible but no one has written it. I am also looking for it as well.
__________________
Opensource will not take over the world. But it will sure improve the lives of most of it!
_______________________________________________
Inkscape - Scallable Vector Graphics for everyone.
The GIMP - Free raster graphics and photo editing software.
Planeshift - Free 3D MMORPG. Cause everyone needs some fun.
Neo Neko is offline   Reply With Quote
Old 25th May 2004, 21:11   #3  |  Link
Zhnujm
Registered User
 
Zhnujm's Avatar
 
Join Date: Oct 2001
Posts: 983
Im also searching for that.
I tried to write a simple patching utility some time ago but it was more complicated than i thought, the values and the position where they are stored seem to change if you use different options in xvid.
And i have absolutely no idea how to really read the avi file structure.
Zhnujm is offline   Reply With Quote
Old 25th May 2004, 23:49   #4  |  Link
Moitah
Registered User
 
Join Date: Feb 2004
Location: Virginia, USA
Posts: 334
In which part of the AVI is the aspect ratio information stored?
Moitah is offline   Reply With Quote
Old 26th May 2004, 00:41   #5  |  Link
mikeX
yakisoooobaaa!!
 
mikeX's Avatar
 
Join Date: Sep 2003
Location: Greece
Posts: 329
Quote:
Totally wrong. The Open-DML AVI standard includes a VIDEOPROPERTYHEADER for video streams, which allows to indicate the output resolution in the sense of Matroska's DisplayWidth and DisplayHeight elements.
from Alex Noe's homepage

But what the application should do is change the AR in the MPEG4 bitstream, not in the particular container header (although that would make a nice addition)
mikeX is offline   Reply With Quote
Old 5th June 2004, 04:17   #6  |  Link
Moitah
Registered User
 
Join Date: Feb 2004
Location: Virginia, USA
Posts: 334
I am almost finished with a program that will change the aspect ratio in XviD AVIs. It was not a simple task, unfortunately. I hope to have it done and released within a few days, assuming no unforeseen problems.
Moitah is offline   Reply With Quote
Old 5th June 2004, 11:17   #7  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,191
Quote:
Originally posted by Moitah
I am almost finished with a program that will change the aspect ratio in XviD AVIs...
This sounds very interesting.

Will it be an XviD only application. And will the signalling work when the AVI stream is muxed into an MP4 container?

I can test MP4's in hardware if you like?


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 5th June 2004, 14:41   #8  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
Quote:
Originally posted by Moitah
I am almost finished with a program that will change the aspect ratio in XviD AVIs. It was not a simple task, unfortunately. I hope to have it done and released within a few days, assuming no unforeseen problems.
nice, as the ar is stored in the mpeg-4 bitstream, i assume your tool will work with all mpeg-4 bitstreams (like divx5, 3ivx aso..)?
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 5th June 2004, 14:58   #9  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,191
Quote:
Originally posted by bond
nice, as the ar is stored in the mpeg-4 bitstream, i assume your tool will work with all mpeg-4 bitstreams (like divx5, 3ivx aso..)?
That's what I'm hoping for too!
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 5th June 2004, 16:00   #10  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
Quote:
Originally posted by SeeMoreDigital
That's what I'm hoping for too!
i hope Moitah meant that his tool aims at editing the ar stored in the bitstreams, and not in the avi itself, as the editing of the info stored in the avi will not help anything, as the avi splitter from m$ ignores this info anyways (which means during playback in dshow there will not be a resize) :>
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 5th June 2004, 16:06   #11  |  Link
Moitah
Registered User
 
Join Date: Feb 2004
Location: Virginia, USA
Posts: 334
The video must be in an AVI container, and OpenDML is not supported (maybe an AVI could be split into <1 gig pieces with VirtualDub, run the tool on each piece, and rejoin them). It should work on other MPEG-4 video streams inside AVI.

EDIT: Yes, it changes the aspect ratio stored in the MPEG-4 stream, not in any AVI headers.
Moitah is offline   Reply With Quote
Old 5th June 2004, 16:11   #12  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,191
Quote:
Originally posted by Moitah
Yes, it changes the aspect ratio stored in the MPEG-4 stream, not in any AVI headers.
Oooo, can't wait
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 5th June 2004, 16:17   #13  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
Quote:
Originally posted by Moitah
EDIT: Yes, it changes the aspect ratio stored in the MPEG-4 stream, not in any AVI headers.
great! cant wait to test it out

Quote:
The video must be in an AVI container
what about supporting .mp4 too?
its license free (meaning its totally legal to spread tools with .mp4 support) and opensource libraries are available from mpeg4ip and gpac
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 6th June 2004, 05:59   #14  |  Link
Moitah
Registered User
 
Join Date: Feb 2004
Location: Virginia, USA
Posts: 334
I have it working now, I will release a preview. It is written in C#, so you will need the .NET v1.1 Framework to run it (available at WindowsUpdate). It is command-line for now but I am most likely going to make it a GUI app.

Usage:
rp <src_path> <dest_path> <ar_info>

<ar_info> must be:
1 (Square Pixels)
2 (4:3 PAL Pixel Shape (12:11))
3 (4:3 NTSC Pixel Shape (10:11))
4 (16:9 PAL Pixel Shape (16:11))
5 (16:9 NTSC Pixel Shape (40:33))
par:<par_width>:<par_height> (Pixel Aspect Ratio)
dar:<frame_width>:<frame_height>:<dar_width>:<dar_height> (Display Aspect Ratio)

Examples:
rp c:\play.avi c:\play-new.avi 1
rp c:\play.avi c:\play-new.avi par:10:11
rp c:\play.avi c:\play-new.avi dar:640:480:16:9

EDIT: I will release the source code once I finish up a bit more.

EDIT2: Download link removed. See this thread for the new version.

Last edited by Moitah; 14th June 2004 at 21:37.
Moitah is offline   Reply With Quote
Old 6th June 2004, 12:35   #15  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,779
ok i now tested the par option with a 3ivx, xvid and divx5 stream and it seems to work great
i tested the resize by remuxing from .avi to .mp4

i noticed that the display of the old ar stored is repeated various times. i assume thats because the value gets changed on every keyframe, right?

also its maybe important to mention that the options 2-5 will only work with DVD input, with SVCD input you will have to use other values if i understood it right.
xvid currently doesnt offer these values, but the 3ivx encoder does (if you want to find out which values these are)

also i noticed that by using .net the download increases from 5KB to 25MB :/
and .net tools will also not work on non windows systems if i understood it right, maybe it would have been better to write a commandline tool in a way its platform independant, but well i am no dev, i cant really say much about this...

thanks for this tool!

ps: what does "RP" stand for?
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free

Last edited by bond; 6th June 2004 at 12:41.
bond is offline   Reply With Quote
Old 6th June 2004, 12:50   #16  |  Link
Zhnujm
Registered User
 
Zhnujm's Avatar
 
Join Date: Oct 2001
Posts: 983
Yes, thanks for your tool.
Too bad that i currently dont have the right hardware player to try it out.
Zhnujm is offline   Reply With Quote
Old 6th June 2004, 13:19   #17  |  Link
SeeMoreDigital
Life looks better in HD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 11,191
I'm crap with 'non GUI' tools and can't make it work!

I would like to test an AVI to MP4 muxed stream (without B-VOP's) to see if they work in hardware

Can anybody post one please?


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 6th June 2004, 16:08   #18  |  Link
mikeX
yakisoooobaaa!!
 
mikeX's Avatar
 
Join Date: Sep 2003
Location: Greece
Posts: 329
Moitah,
very nice to see this idea realised
Quote:
[b]
EDIT: I will release the source code once I finish up a bit more.
That would be great since it could attract people into changing your code to something more portable than C# and also attract interest into OpenDML AVI support (in case you don't plan supporting it yourself).
Best of luck ; )
mikeX is offline   Reply With Quote
Old 6th June 2004, 16:15   #19  |  Link
Moitah
Registered User
 
Join Date: Feb 2004
Location: Virginia, USA
Posts: 334
Quote:
Originally posted by bond
ok i now tested the par option with a 3ivx, xvid and divx5 stream and it seems to work great
i tested the resize by remuxing from .avi to .mp4
Thanks for testing . I noticed VLC pays attention to the aspect ratio even when in an AVI container.
Quote:
Originally posted by bond
i noticed that the display of the old ar stored is repeated various times. i assume thats because the value gets changed on every keyframe, right?
Correct.
Quote:
Originally posted by bond
ps: what does "RP" stand for?
RIFF Parse. The first code I wrote was to build a RIFF tree in memory from a .avi, so thats what I named the project. It will be renamed when I make a proper release with GUI.
Moitah is offline   Reply With Quote
Old 6th June 2004, 19:34   #20  |  Link
bot
Registered User
 
bot's Avatar
 
Join Date: Dec 2003
Posts: 56
Don't mean to add stones to burden, but would it be possible to add custom resolutions?
(I'm currently wrangling '2001: A Space Odyssey', which has an AR of 2.21:1)
__________________
I love CLI up to a point ... which is usually located somewhere below thirty character lines.
bot is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:13.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.