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 > (HD) DVD, Blu-ray & (S)VCD > IFO/VOB Editors
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th January 2005, 18:30   #1  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
How to get a single I-Frame??

Guys,
I have a technical question for you. I'm looking into ways to "shrink" a motion menu cell into a still cell, and ideally I'd like to only keep the first GOP (ok maybe not the first one) and shrink it down into a single I-Frame (by keeping the first I-frame for example and dumping all the subequent B/P frames).

I've done tests with this idea (using vobblanker to replace the original menu cell with one that I extract as described above), and I'm finding that things work find if I extract a full GOP (tested on a standalone), but not if I only keep the first I-frame (the menu frame only partially displays, but the buttons highlights are still there, and working, it's quite a treat! ).

So, does anyone know what I'm probably missing?
- Is it possible at all without re-encoding?
- Do I need to adjust the GOP structure somewhere in the VOB since I'm dumping many B/P frames? (didn't see where)
- In my tests, I kept the I-frame, but the end of it also had the beginning of a B frame, which I didn't remove (in other words, part of the last LBA also has the beginning of a B frame). That HAS to be bad, could that be the cause of my problem? Should I simply pad the LBA?


Thanks for any info.
Jeanl
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.
jeanl is offline   Reply With Quote
Old 26th January 2005, 19:35   #2  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
Well, I've done it (to test Muxman) using a demuxed m2v and a hex editor. If it's not the first GOP remove everything before the sequence header (00 00 01 b3). Then remove everything from the second picture header (00 00 01 00) on. The last thing I had to do (to satisfy the verifier and caused no problem with playback) was change the temporal sequence number to 0 (it was from a closed gop).

My guess would be the decoder doesn't like a partial B frame - it will start to decode it. Replace the picture header and following data with a padding packet.
mpucoder is offline   Reply With Quote
Old 26th January 2005, 19:40   #3  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
Thanks a bunch mpucoder, I was hoping you'd be reading this!!!
Great, I know what to do next!
Jeanl
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.
jeanl is offline   Reply With Quote
Old 26th January 2005, 20:25   #4  |  Link
jsoto
Just a Member
 
Join Date: Nov 2002
Location: Spain
Posts: 2,067
Mmmm, very, very useful info. Thanks to both of you.

jsoto
__________________
Web sites with my tools
http://download.videohelp.com/jsoto
http://jsoto.posunplugged.com/
jsoto is offline   Reply With Quote
Old 27th January 2005, 17:55   #5  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
Well, thanks to the hints from mpucoder, I was able to do exactly what I wanted: create a new cell from an existing one, keeping only the first I-frame and the subpics (that's to replace a motion menu by a still one). The "trick" was indeed to get rid of the beginning of the B/P frame in the last LBA of the I-frame (replace it with a padding packet).

The cell can then replace the original one, (vobblanker can do that easily) and the result seems to play fine on my standalone DVD player.

Success!!!

Thanks mpucoder for the hint. I'm finishing a small .exe that does the whole thing automatically (well, just the cell extraction, not the replacing which has to be done with vobblanker). I'll keep you guys posted.

@jsoto: vobblanker seem to have a NavPack pointer problem when cell replacing is used. I'll post about that in your thread.

Jeanl
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.
jeanl is offline   Reply With Quote
Old 28th January 2005, 18:23   #6  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
OK, more info, more problems!!!
- With lots of help from blutach, I found that it was not good to reset the highlight start time to 0, when extracting a still GOP from a motion menu. Apparently the highlight start time has to match the value in the subpic packs, or the buttons are not displayed.
- Now blutach also encountered a very strange case: He's got a DVD with a VOB cell that starts with a non-closed GOP! I didn't think that was possible!
mpucoder, is this bad authoring, or is it legit: the first GOP at the start of a cell that's non-closed.

Jeanl
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.
jeanl is offline   Reply With Quote
Old 28th January 2005, 18:39   #7  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
legit and common. Someone started an urban legend that all GOPs in DVD should be closed, but it's not true (except in multi-angle).

Just because it is not closed does not mean that it requires a prior reference frame. The encoding sequence of IPBBPBBPBB is self-contained, but not closed.

Last edited by mpucoder; 28th January 2005 at 18:43.
mpucoder is offline   Reply With Quote
Old 28th January 2005, 18:51   #8  |  Link
jsoto
Just a Member
 
Join Date: Nov 2002
Location: Spain
Posts: 2,067
So, how can you know if a GOP needs a prior reference frame?

jsoto
__________________
Web sites with my tools
http://download.videohelp.com/jsoto
http://jsoto.posunplugged.com/
jsoto is offline   Reply With Quote
Old 28th January 2005, 18:55   #9  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
This one would for example, right:

BPIPBBPBBP

(is it legit?). The B frame refers to the last I-frame of the previous GOP. Right?
Jeanl
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.
jeanl is offline   Reply With Quote
Old 28th January 2005, 19:01   #10  |  Link
jsoto
Just a Member
 
Join Date: Nov 2002
Location: Spain
Posts: 2,067
Can a GOP start in a P or B frame instead of an I one?
__________________
Web sites with my tools
http://download.videohelp.com/jsoto
http://jsoto.posunplugged.com/
jsoto is offline   Reply With Quote
Old 28th January 2005, 19:01   #11  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
Quote:
Originally posted by mpucoder
legit and common. Someone started an urban legend that all GOPs in DVD should be closed, but it's not true (except in multi-angle).

Just because it is not closed does not mean that it requires a prior reference frame. The encoding sequence of IPBBPBBPBB is self-contained, but not closed.
mpucoder, I'm a bit confused!
- Is it true that a non-closed GOP is one that needs a reference from another GOP (either forward or backward)?
- Why are you saying that IPBBPBBPBB is "self-contained"? It still needs the next GOP to be decoded right (because of the P frames EDIT: sorry B frames!) but it does not need the previous GOP, right?

Jeanl
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.

Last edited by jeanl; 28th January 2005 at 19:05.
jeanl is offline   Reply With Quote
Old 28th January 2005, 19:51   #12  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
Quote:
Originally posted by jeanl
mpucoder, I'm a bit confused!
- Is it true that a non-closed GOP is one that needs a reference from another GOP (either forward or backward)?
no, it may use a reference frame from the previous GOP, which would look like:
IBBPBBPBB
Or it may be self-contained, which looks like:
IPBBPBBPBB
The key is how many reference (I or P) frames were encoded prior to the B. In the first case only one, so the B may or may not require a frame from the previous GOP. That is what the closed-GOP flag tells us, closed means the first B frames do not require 2 reference frames.
Quote:

- Why are you saying that IPBBPBBPBB is "self-contained"? It still needs the next GOP to be decoded right (because of the P frames EDIT: sorry B frames!) but it does not need the previous GOP, right?
Jeanl
A GOP never needs the following GOP. Maybe you are getting display order and encoding order mixed up. We are talking about encoding order, the way it appears in the file. The reference frames are always encoded before the B frames (likewise the P frames rely only on the previously encoded I frame).
Also, a GOP must start with an I frame as the first encoded frame. That does not mean it is displayed first.
mpucoder is offline   Reply With Quote
Old 28th January 2005, 20:02   #13  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
mpucoder, thanks a bunch for taking the time to straighten me up, I was seriously wrong!!! And indeed, I was mixing up encoding order and display order (indicated by the temporal sequence number I guess).

If I'm understanding you correctly, you can't always tell whether a GOP is closed or open from just looking at the sequence of IBP frames. That's why we have the flag, to tell us if the B frames rely on a previously encoded reference frame.

OK, thanks again.
Jeanl
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.
jeanl is offline   Reply With Quote
Old 28th January 2005, 20:10   #14  |  Link
jsoto
Just a Member
 
Join Date: Nov 2002
Location: Spain
Posts: 2,067
Thanks also from my side. I was also wrong in some concepts.

jsoto
__________________
Web sites with my tools
http://download.videohelp.com/jsoto
http://jsoto.posunplugged.com/
jsoto is offline   Reply With Quote
Old 28th January 2005, 20:57   #15  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
jean, that's true when there is only one reference frame in the GOP preceeding the first B frame. Otherwise the flag should not be set.

Then there's the broken flag...
It means a "normal" GOP, ie IBBPBBPBB which was not closed (so therefore relied on the previous GOP) has been orphaned by editing (previous GOP removed). This can be avoided / corrected by removing the first group of B frames and adjusting the temporal sequence numbers of the remaining frames downward by the number of B frames removed. Now you will see a "self-contained" GOP emerge - IPBBPBB
Broken and closed should never be set at the same time, if the GOP was closed you can not break it.

Last edited by mpucoder; 28th January 2005 at 21:01.
mpucoder is offline   Reply With Quote
Old 28th January 2005, 21:08   #16  |  Link
jsoto
Just a Member
 
Join Date: Nov 2002
Location: Spain
Posts: 2,067
Hey, I didn't ask about broken GOP flag but I really was wondering about its meaning...( mpucoder, do you also have a crystal ball? ).

One question more... If the broken flag is properly set (when cutting the VOB in a non-closed GOP)... Does the decoder (the player) have to honor the flag and skip the B frames?.

jsoto
__________________
Web sites with my tools
http://download.videohelp.com/jsoto
http://jsoto.posunplugged.com/
jsoto is offline   Reply With Quote
Old 28th January 2005, 21:10   #17  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
Quote:
Originally posted by mpucoder
jean, that's true when there is only one reference frame in the GOP preceeding the first B frame. Otherwise the flag should not be set.
AH! OK. That's because a B frame can reference a reference frame up to 2 frames before? If there are 2 ref frames (IP for example) before the B, then we know that it's closed because the B frame cannot reference 3 frames back. If there's only 1 I/P frame, then it may or may not be closed. I'm paraphrasing you to make sure I understand. Am I right?

Quote:
Then there's the broken flag...
It means a "normal" GOP, ie IBBPBBPBB which was not closed (so therefore relied on the previous GOP) has been orphaned by editing (previous GOP removed). This can be avoided / corrected by removing the first group of B frames and adjusting the temporal sequence numbers of the remaining frames downward by the number of B frames removed. Now you will see a "self-contained" GOP emerge - IPBBPBB
Broken and closed should never be set at the same time, if the GOP was closed you can not break it.
OK I understand that now. I had no idea what the broken flag meant!!! Your explanation is very clear.

Again, a million thanks for taking the time to enlighten us. There's probably a place where all this is fully explained (your site perhaps?), but so far I haven't been able to find it!

Jeanl
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.
jeanl is offline   Reply With Quote
Old 28th January 2005, 21:16   #18  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
They should not try to decode the frames, but repeat the previous successfully decoded frame. But some decoders have clever ways of masking the errors.

And don't feel bad about being confused, I didn't get it at first, and the author of Scenarist didn't get it either. This is why Scenarist, and almost all authoring programs since, insist on closed GOP for multi-angle. Because the user can switch between angles they thought only closed GOP would do that without problems. But a self-contained GOP will do just as well.
mpucoder is offline   Reply With Quote
Old 28th January 2005, 21:23   #19  |  Link
jeanl
Registered User
 
jeanl's Avatar
 
Join Date: Sep 2004
Location: California, USA
Posts: 2,079
mpucoder,
I'm still confused!!!
Why do you say that IPBBPBBPBB is self-contained, but not closed?

The first 2 frames are reference frames, so why is it not closed? I does not depend on the previous GOP (as you said, it's self-contained), but why is it not closed????


Jean
__________________
A few PgcEdit guides.
DVDSubEdit a free tool to edit subtitles directly inside the vob.
jeanl is offline   Reply With Quote
Old 28th January 2005, 21:28   #20  |  Link
mpucoder
Moderator
 
Join Date: Oct 2001
Posts: 3,530
Just semantics - closed means the closed flag is set and there is only the I frame before the first B. Self-contained means there is an I and P before the first B. Neither one depends on the previous GOP.
mpucoder is offline   Reply With Quote
Reply


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 16:22.


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