View Full Version : Where is Macrovision?


dvdshrink
20th April 2003, 12:35
Hi,

I am trying to implement macrovision removal for the next version of DVD Shrink.

Does anybody know where the macrovision stuff is stored in the VOBS, and how to get rid of it?

Thanks -

VidHack
20th April 2003, 18:19
If I remember correctly, I think its in the MPEG2 PES header, think theres a table at MPUcoders website, or its in the vStrp.c code to get the exact byte location, and even microsoft can help you out.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/htm/gettingmpeg2psitables.asp

I think MPUcoder may have to verify this, I may be wrong?

VidHack

Ookami
21st April 2003, 06:31
Originally posted by dvdshrink
Hi,

I am trying to implement macrovision removal for the next version of DVD Shrink.

Does anybody know where the macrovision stuff is stored in the VOBS, and how to get rid of it?

Thanks -

First, thanks for your software!

http://members.aol.com/mpucoder/DVD/index.html

http://ookami.videoxone.de/programmers.html (I've copied and pasted the Nowhereman txt file below)

From Nowhereman's old txt file (mpucoder can clarify if it's 100% correct or not):

DVD Format

Document 0.0b - March 20, 2000

Just some basic stream info and possibly macrovision information so far. I'd like to add information on the other files on the DVD (.INF files) in the future... I do know that the .BUP files are just BackUP files of the .IFO files. Also that byte 0x23 is the byte that sets the Region code for the DVD, if you set it to 0xC0 the DVD will be region free.

A DVD is created by taking the whole movie as one big .VOB file approximately 4.5 Gigs (depending on the movie length, MPEG-2 Video Compression bitrate, and all the audio and subtitle info). To ensure the file can be stored on current DVD's it's chopped up into 1 Gig files with the left over in the last file. Header info is only in the first 1 Gig .VOB, there is no new header info at the beginning of the other .VOBs because they are just a spliced parts of the original 4.5 gig file (our example). So with our example Movie you would have on the DVD 5 files
Vts_01_1.vob - 1 Gig
Vts_01_2.vob - 1 Gig
Vts_01_3.vob - 1 Gig
Vts_01_4.vob - 1 Gig
Vts_01_5.vob - 500 Megs (.5 Gig)

Total - 4.5 Gigs

I believe the file Vts_01_0.vob has menu info...

So far I know the actual movie starts in the first .VOB that is 1 Gig (actually 1,073,739,766 bytes), usually named Vts_01_1.vob

Actual format of the DVD as far as I know it...

0x000001BA - Pack Start Code, followed by
0x4400 - ?
0x???? - Next we have some incremental word (maybe timing info)
0x0189 - ?
0xC3F8 - ?

Next we have another 4 byte header.

0x000001B9 - MPEG Program End Code
or
0x000001BB - System Header Start Code
or
0x000001B3 - Sequence Header Code
or
Packet Start Code Prefix which is 4 bytes:

0x00000180 - Substream AC3 (may go upto 0x0000018F)
0x000001C0 - Audio Stream (may go upto 0x000001DF)
0x000001BC - PROGRAM STREAM MAP
0x000001BD - PRIVATE STREAM 1
0x000001BE - PADDING STREAM
0x000001BF - PRIVATE STREAM 2
0x000001E0 - VIDEO STREAM (may go upto 0x000001EF)
0x000001F0 - ECM STREAM
0x000001F1 - EMM STREAM
0x000001FF - PROGRAM STREAM DIRECTORY
0x000001F2 - DSMCC STREAM
0x000001F8 - ITUTRECH222TYPEE STREAM

After the above 4 bytes you have a word (2 byte Motorola Big Endian) which is the length of that particular packet of data. So if you move through the file to the current address + (2 byte value) you will start again at the next header.

Actual bytes from the beginning of a Region_1 .VOB file:

000001BA4400040004010189C3F8000001BB001280C4E100E17FB9E0E8B8C020BDE03ABFE002000001BF03D400000000008000000001C0F41000000FFF0000BF....

Breaks down to this:

000001BA - Pack Start Code
4400 - skip
0400 - skip
0401 - skip
0189 - skip
C3F8 - skip
000001BB - System Header Start Code
0012 - This block is 0x0012 (18 decimal) bytes long
80C4E100E17FB9E0E8B8C020BDE03ABFE002 - Don't know what these byte are yet...
000001BF - Private Stream 2 which holds the macrovision byte!
03D4 - This block is 0x03D4 (980 decimal) bytes long
00 - Private Stream 2 substream number 00, substream 01 doesn't have macrovison as far as I can tell.
000000008000000001C0F41000000FFF0000BF......
^^
The 0x80 in this example (5th byte after substream number) is the macrovsion byte. As far as I know 0x80 is Region 1 and 0x40 is region 2. If this value is not 0 then Macrovsion is enabled, so set it to 0 to disable macrovision. This Private Stream 2 substream 00 is continued throughout the entire movie so within each block with a Private Stream 2 substream 00, you must make the 5th byte after the substream a 0x00 to disable macrovision thoughout the entire movie.

So a program to remove Macrovision (and move through a .VOB would look something like this... (I haven't programmed in years)


x=get((doubleword)infile); /* get the Header ID */
put((doubleword) x, outfile);
l=get(word(infile)); /* get the length of this block */
put((word) l, outfile);
if (x == 0x000001BA) { /* Pack Start Code */
for (y=0; y < 8 ; y++) /* skip next 8 bytes */
putc(getc(infile), outfile);
x=get((doubleword)infile); /* get the Header ID */
put((doubleword) x, outfile);
l=get(word(infile)); /* get the length of this block */
put((word) l, outfile);
}
if (x == 0x0000001BF) { /* Private Stream 2 */
s=getc(infile);
putc(s, outfile);
l = l - 1; /* we moved forward in the file */
if (s == 0) { /* 0 = substream 0 where macrovision is */
for (y = 0; y < 4; y++) /* copy next 4 bytes */
putc(getc(infile), outfile);
getc(infile); /* this is our macrovision byte */
putc( 0, outfile); /* so we turn it into a 0x00 */
l = l - 5; /* since we moved a head 5 bytes in the file */
}
for (y = 0; y < l; y++)
putc(getc(infile), outfile);

if not End Of File goto top of program and loop until EOF Else open next .VOB and continue from the top until we've done all the .VOB's on our harddrive.

I know this isn't tons of information but it's a start. A lot of this information came from [maven] (maven@maven.de) and his program vstrip. Thanks for the source code maven! The macrovision byte was found by RED321, I just put the info together.

Once we get a program running owners of the Hollywood Plus can watch DVD's from the harddrive without macrovision. I can finally rent new DVD's during the week (when no one else rents movies) and copy them to the harddrive to watch on the weekend (when it's impossible to rent a new movie) with my wife.

If you have any more information to add or correct to this document, please post it on www.delphi.com - The Delphi Forums under PC_DVD.

Hope this becomes a huge document one day. :)

Nowhereman.

Cheers,

Mijo.

dvdshrink
22nd April 2003, 13:54
Wow, thanks for all that. Shall I just cut and paste the code ;-)

Regards -
dvdshrink

alhall
24th April 2003, 19:26
I would like to say THANK YOU! THANK YOU! THANK YOU!. I knew it was only a matter of time before a great program would show up. I've been using CCE on over a hundred movies, your program is great. One small thing, would it be possible in your next version to demux? I'm having to use yur program then demux so I can create a menu. Just asking? Keep up the GREAT work. Thank you again. Your new devoted follower.