What's new

Technical info on 16:9 MPEG-2 files (1 Viewer)

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
Here's a poser for the very MPEG-technically astute.

To create a 16:9 Enhanced DVD using non-commercial (aka less than $1,000) software like Sonic's DVDit and pre-generated MPEG-2 files, those files need to be "flagged" within the datastream as 16:9 files, even though a file of the same resolution can be used in a 4:3 project.

I've been trying to convert non-16:9 files to 16:9 with TMPGenc, but I've not had a lot of luck.

This whole concept that an MPEG-2 file must be "flagged" really bothers me because, whether it's flagged or not, the MPEG-2 file still uses the same resolution of 720x480. So, the concept that one 720x480 MPEG-2 is not flagged and is therefore unacceptable yet somehow a flagged 720x480 MPEG-2 *is* acceptable for 16:9 Enhanced projects really is more than a little strange to me.

When all other things are equal (resolution, video bit rate, audio bit rate, etc), I cannot understand how a simple flag can so drastically change an MPEG-2 file as to allow it to be a part of a 16:9 project or conversely deny its ability to be in a 16:9 project.

How exactly do 16:9 MPEG-2 files differentiate themselves from non-16:9 MPEG-2 files and why is it such a big deal?

Anyone? Anyone? Beuller?
 

MichaelG

Second Unit
Joined
Jul 10, 2000
Messages
322
John, I believe the reason that flag is needed is only for the DVD player and use of a standard 4:3 TV set.

If the display type is set as 4:3 and the DVD player reads a 16:9 flag then it will process the video differently to output the correct aspect ratio. If the DVD player's display type is set to 16:9 then it should just output the video as it is on the disc. I would just go ahead and continue ti create your project without worrying about the flag. If you have a 16:9 TV then just use the TV display mode for watching an anamorphic souce.

Unless I am sorely mistaken, the 16:9 flag doesn't matter if your DVD player display type is 16:9, and you are using a 16:9 TV.

Hope this helps
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
Unless I am sorely mistaken, the 16:9 flag doesn't matter if your DVD player display type is 16:9, and you are using a 16:9 TV.
Sadly, it does matter to the authoring software which totally drives me bananas.
I have a file that is the exact same resolution as its 16:9 flagged counterpart. The file is also the exact same video rate. The file is also the exact same audio bit rate. For all intents and purposes, the files are absolutely identical. Yet the flagged file will be accepted for a 16:9 project whereas the other will not. This is totally mind-boggling to me.
Yet, even though it's considered to be a "flag" the entire video needs to be put through a complete re-rendering process to be "flagged". Maybe I'm been working with computers too long, but to me a "flag" is a single byte field that says "yea" or "nay". :) If that's the case, I should be able to hex-edit the file and turn this flag on rather than re-render it.
I think that this is one of those issues where engineers decided to make something far more complicated than it needed to be ... probably to sell books on the subject or something like that. :)
 

Jeff Kleist

Senior HTF Member
Joined
Dec 4, 1999
Messages
11,266
No, it's not far more complicated than it need be. If you have a picture designed for 16:9 TVs that is not flagged then it will display as-is without downconversion on 4:3 screens. So to prevent that, the authoring software will only accept flagged titles for intended 16:9 output.

You can't hex edit it unless you have a lot of time on your hands, probably more than to re-render it. the flag is a reoccuring one. MPEG works like this. Every X frames you have a single uncompressed frame, Between frames X and Y, there are instructions that say things like "Pixel 147 red for 5 frames" and so-on. That's how MPEG compression works. Every time you have your uncompressed frame, you need to have your flags in place with it. This is why titles like Sixth Sense and T2:UE have trouble on the Apex, because it incorrectly reads the flags at certain points
 

Ken Chan

Senior HTF Member
Joined
Apr 11, 1999
Messages
3,302
Real Name
Ken
This whole concept that an MPEG-2 file must be "flagged" really bothers me because, whether it's flagged or not, the MPEG-2 file still uses the same resolution of 720x480.
Huh? The pixels are different shapes when in 16:9 or 4:3 mode. (720x480 is neither, it's 3:2). If you take 4:3 and convert it to 16:9, you can keep the same scanlines, but everything needs to be squished to window-box it -- what used to be 720 pixels across takes less (too lazy to do the math). In short everything moves, so the flag is the least of your problems.

//Ken
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
If you take 4:3 and convert it to 16:9, you can keep the same scanlines, but everything needs to be squished to window-box it -- what used to be 720 pixels across takes less (too lazy to do the math). In short everything moves, so the flag is the least of your problems.
Now I think I see where our signals are getting crossed, but that's also because I didn't explain it better. :)
I'm talking about taking a 16:9 anamorphic image on a 4:3 frame and trying to make it into a 16:9 project on a DVD. The image is already squished horizontally. I just want to capture it, massage it up with whatever effects I want, and import it into a 16:9 project.
The problem comes up because even though *I* know that the image is already anamorphically squeezed, it was captured as a standard 4:3 frame since for all intents and purposes it is a 4:3 frame.
(Yes, my Sony 8mm camdorder does **true** 16:9 anamorphic. Please don't argue with me that there are no personal camcorders that do that because I already got into that argument with someone else on HTF and I posted the images to prove him wrong. :) I know that the resolution sucks because it's 8mm NTSC, but that's besides the point.)
I'm not actually trying to use an image with a resolution of 16:9 as though it's the equivalent of 1,600 x 900 or 800 x 450 or whatever. The actual resolution of the MPEG-2 file is the recommeneded 720x480. Since they recommend 720x480 whether it's for an anamorphic project or not, you can see where my frustration at this restriction is coming from.
If the video file is 720x480 for 16:9 and 4:3 projects, this restriction of "flagging" a file as 16:9 is incredibly ridiculous, at least on the surface. I'm hoping to go beyond the surface to figure out what the hell is going on. :)
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
MPEG works like this. Every X frames you have a single uncompressed frame, Between frames X and Y, there are instructions that say things like "Pixel 147 red for 5 frames" and so-on. That's how MPEG compression works. Every time you have your uncompressed frame, you need to have your flags in place with it.
You're completely correct that I was going at this from the angle that all frames are uncompressed so a recurring flag should be unnecessary. I've even explained to people in the past how MPEG only changes what needs to be changed. :rolleyes:My bad.
However, what this doesn't explain is why frames or files need to be flagged anyway. As I understand how downconversion works, every fourth (or fifth - I've heard both ways) display line is removed by the DVD player for anamorphic DVDs on 4:3 TVs once the player is told that the video clip in question is 16:9 enhanced. If the scan lines are simply removed anyway by the player, how does flagging throughout the file even enter into this whole scenario? What does the DVD player care? It's not going to remove only those lines that it's told to remove, because it's not being told to remove specific lines. It's going to remove every fourth (or fith) line regardless of what data is on that line; therefore, the compressed/uncompressed nature of MPEG-2 should be totally irrelevant to the issue of downconversion.
That being the case, if I use the same 720x480 file (assuming that flagging was not necessary) the DVD will just get rid of every fourth/fifth line when it's told that it's a 16:9 and will use the whole image when it's told that it's a 4:3 file.
I see the two dots. Where am I missing the line that connects them?
 

Jeff Kleist

Senior HTF Member
Joined
Dec 4, 1999
Messages
11,266
Because a set-top DVD player totally relies on the flags in the file to tell it to downconvert. I know of no player that will allow you to instruct it to downconvert manually
 

Wayne Bundrick

Senior HTF Member
Joined
May 17, 1999
Messages
2,358
It's been a month or two since I burned a DVD but I think the DVD standard requires every GOP to have a sequence header. And I think the sequence header has a 16:9 flag. That's why the flag is recurring. There may also be other data structures in the MPEG2 stream that also have a 16:9 flag. It's possible that TMPGenc isn't quite doing everything properly for 16:9 and DVDit is rejecting it. But I think DVDit is just way too inflexible about bringing in MPEG2 video encoded elsewhere. Sonic Solutions won't put a lot of effort into making it work more painlessly because they also sell mid-level ($2000+) and high-end ($10,000+) DVD authoring systems.
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
that said:
This is where Ulead needs to jump in and take over. DVD Workshop already has a huge number of features (16:9 not being one of them unfortunately) that make it outshine DVDit. The only two things that make DVDit better are the Dolby Digital 2.0 and the 16:9 capabilities. Otherwise, DVD Workshop kicks its a$$ and costs about 1/4 the price to boot.
 

Jeff Kleist

Senior HTF Member
Joined
Dec 4, 1999
Messages
11,266
file when (technically) all that should be needed is a flag at the beginning of the file that says "Hey! I'm anamorphic! Delete every fourth/fifth line as necessary!" Hence why I said that it's seems to have been made more complicated that it needed to be.
Unless you want a medium where you can jump to any point at will(like DVD), in which case you need to keep having those flags
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
Unless you want a medium where you can jump to any point at will(like DVD), in which case you need to keep having those flags
True enough; however, chapter points can be placed anywhere when creating a DVD. Anamorphic is selected for each individual file. You can't have the same video clip be anamorphic one second and non-anamorphic another. So, technically, only a single flag should be necessary in the beginning to say "I'm anamorphic!" The other flags can then be duplicated throughout the file as necessary.
Granted, this topic is moot since the MPEG standard isn't going to change, but it's good to vent on what one perceives as bad design every now and then. :D
 

Marty Christion

Stunt Coordinator
Joined
Oct 3, 2001
Messages
229
I think you need to stop using the term "anamorphic" right now. Stop. Never use it again when talking about DVD.

DVD's are not "anamorphic". The video image can be 16x9 or 4x3. These are two different shapes (it's actually shapes of pixels, but same difference). You seem to expect the technology to act more like anamorphic film, where the filmframe is the same shape and size, but one has a special lens to project a wider image from the same frame. DVD doesn't do this. They haven't "squeezed" a 16x9 image into a 4x3 area, and the player/TV isn't "unsqueezing" a horizontally compressed image. Once video got converted into bits and pixels, all the rules changed and we had to start looking at moving pictures in a different way.

Try this: look at a 16x9 TV, and a 4x3 TV. Imagine every pixel on every TV has a number, starting with "1" in the upper left hand corner, and "1000" in the lower right hand corner. Assume it's a CRT that scans the pixels in order. Also assume the same number of pixels, with different shapes (obviously).

Now take an image that has a 16x9 shape, also 1000 pixels, with the first pixel being in the corresponding upper left hand corner, and the 1000th pixel being in the lower right hand corner. Paste this image, pixel for pixel, onto the 16x9 display, and it will look perfect. No problem.

Now take that same 1000pixel, 16x9 image, and paste it pixel for pixel onto the 4x3 monitor. What does it look like? It looks like someone has horizontally squeezed it (much like a frame of film looks after it has been through an anamporphic filter, thus the common misunderstanding). But has anything changed in the picture? No. It is the same number of pixels, in a 16x9 format, only now it's displayed with a 4x3 shape. It hasn't been "squeezed", it hasn't been filtered or processed. It hasn't been nipped or tucked. It is only being displayed in the wrong shape.

The reverse would be true if you display a 4x3 image on a 16x9 monitor; it would look horizonatlly stretched.

As stated before, this isn't anamporphisism, it only looks that way. And people call it that. And it's no problem, until you are actually creating video and need to solve problems related to the issue. If you don't understand the basic issues involved, you won't be able to solve the problems. So the second you start working with digital video and aspect ratios, you need to stop thinking of anamorphic film and squeezing and unsqueezing using lenses. It stops being a semantic/ theoretical issue and starts being a very real one.

So now you know how the MPEG2 flag, the player aspect ratio setting, and the shape of the TV all work together to display the image correctly. Assuming the MGPEG2 flag, the player, and the TV are all set correctly, the thought process goes like this:

"I'm a DVD player. My owner has told me that I am connected to a monitor with a 4x3 shape (and he prefers letterboxing). The video I am playing has a shape of 16x9. I need to display pixel 1 of the image where I would usually display pixel 232, and pixel 1000 where I would usually display 745. The area I am not displaying pixels in will be colored black. I also need to use my built in algorithm to skip lines of pixels, so the video will still look like it should."

"Now I am playing a video with an aspect ratio of 4x3. Now I should display pixel 1 in the top left hand corner, where it should be, and pixel 1000 in the bottom right hand corner, where it should be. But why is my pathetic owner watching a pan and scanned video? Why couldn't I have been bought by a member of the HTF? What? This is the Friends Season 1 set? And I'm an Oritron player, without an S-Video output? I guess that answers both questions."

If you have a true 16x9 image, you back and encode it as such.
 

Jeff Kleist

Senior HTF Member
Joined
Dec 4, 1999
Messages
11,266
I wasn't talking about chapter points. I'm talking about typing a timecode (1:23:42 for example) into your remote and it going to that time. Without the flags every X frames, it wouldn't work
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
But why is my pathetic owner watching a pan and scanned video? Why couldn't I have been bought by a member of the HTF? What? This is the Friends Season 1 set? And I'm an Oritron player, without an S-Video output? I guess that answers both questions.
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
Perhaps it's because of broadcast/streaming, where there is no file. When you turn on your HDTV, you grab the MPEG-2 stream flying through the air, and you start with the first full GOP you get
Hmm! Okay. That's a very valid point.
Cool! Now I don't feel so badly. :D
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
Is it in an MPEG that has already been tagged as 4:3? If so, who did that?
Whoops. Forgot this in the previous post of mine.

Actually, from what I can tell just about all video editing programs that support MPEG-2 like Ulead Media Studio Pro force 4:3. The resulting MPEG-2 files need to be rendered separately through a third-party product like TMPGenc or Bitrate Viewer to be flagged as 16:9. Ulead has hinted that the upcoming version of Media Studio Pro (version 7.0) will have 16:9 rendering capabilities.
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
I wasn't talking about chapter points. I'm talking about typing a timecode (1:23:42 for example) into your remote and it going to that time. Without the flags every X frames, it wouldn't work
I guess that I'm confused about why that would be the case. From everything that I've seen, the file is either entirely 4:3 or it's 16:9 - no mix or match. So, when it loads up the correct VOB file, it should just look to the ...
{massive pause}
Wait a minute ... !! The light finally went on as I was typing. :)
NOW I see what you're getting at!!!
All of the MPEG clips are stored in those VOB files, not as the separate MPEG files as they were rendered. So the player has to go to the specific segment of the VOB file to grab that section that is dedicated to the clip. If it goes right to the section, like to a specific time code which happens to be in the middle of the clip, it will bypass the beginning of the clip and completely skip over where I've been thinking a single flag should be so it will miss the 16:9 flag.
JEFF!! Buddy! Fellow Pennsylvanian! (Don't be ashamed that I live in the same state as you. :) )
Thank you! Thank you! After months of frustration of trying to figure the rationale for it, you got me to see the light! Now I can see why a file has to be re-rendered to be 16:9.
You did, too, Ken! I don't want you to feel left out either!
This is a good day, too! ( Well, it will be as long as the owners don't kill my HTF account. :rolleyes:)
Someone on Sonic's site just today said that I should have no sync problems combining video-only and audio-only to make a DVD. Since Bitrate Viewer will only handle video-only, that was a concern.
Oh, this is too cool! :emoji_thumbsup: :emoji_thumbsup: :emoji_thumbsup: :emoji_thumbsup: :emoji_thumbsup:
Jeff, the next time I'm in the Philly area, the beer is on me! :D :D :D
 

Wayne Bundrick

Senior HTF Member
Joined
May 17, 1999
Messages
2,358
I've been looking up some information about MPEG2 video. You're absolutely right, John. The idea of repeating sequence headers is to make random access easy. Jump to any point in the file, scan for the very next sequence header, then start decoding from there.

And my guess about sequence headers was correct, the sequence header does indeed contain aspect ratio information along with just about everything else describing the characteristics of the video. A video sequence needs only one sequence header, at the beginning, but it's okay to repeat the sequence header, which as we've already realized is a good idea for random access.

Earlier you and Jeff talked about using a hex editor to go through the file and change all the flags to 16:9. But hell, if you know enough about the structure of an MPEG2 file to be able to recognize the sequence headers and the aspect ratio flag in each header, then that same knowledge can be used to write a short and simple program to change the whole file in one fell swoop. When I say short and simple I mean really short and really simple.

Here's what I've learned:

Sequence headers always begin with the start code hex 01 B3. The next 12 bits are the horizontal resolution and the next 12 bits after that are the vertical resolution, three bytes total. For 720 x 480 video that's 2D0h x 1E0h so the three bytes are 2D 01 E0.

The next four bits are the aspect ratio. Possible values are:
1 = 1:1 square pixels
2 = 4:3
3 = 16:9
4 = 2.21:1 (not valid for DVD)

The next four bits are the frame rate. Possible values are:
1 = 23.976
2 = 24
3 = 25
4 = 29.97
5 = 30
6 = 50
7 = 59.94
8 = 60

So I think that all you have to do is search the file for "01 B3 2D 01 E0 2X" (where X is the frame rate, probably either 1 or 4) and replace the 2X with 3X.

I tried it on a short 10 second clip and it worked.
 

Users who are viewing this thread

Sign up for our newsletter

and receive essential news, curated deals, and much more







You will only receive emails from us. We will never sell or distribute your email address to third party companies at any time.

Forum statistics

Threads
357,068
Messages
5,129,980
Members
144,283
Latest member
Nielmb
Recent bookmarks
0
Top