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 > Capturing and Editing Video > New and alternative a/v containers

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 11th December 2003, 14:07   #1  |  Link
Registered User
Join Date: Nov 2001
Posts: 9,770
HowTo create DVD-like Menus in MP4 - MP4Menu

ok, as some of you might already know the mpeg-4 standard offers the possibility to put menus, as known from DVDs, into the MP4 file format.
this small guide aims at helping you to be able to create an own menu, as known from dvd, yourself in the MP4 container format, by using the mp4menu script i wrote to make the process easier
with mp4menu you should be able to make a 1:1 copy of a DVD on CDR

proof of concept sample
before you start doing it yourself, you maybe want to see a proof of concept sample kindely provided by OBcecado!
note that only chapter1 and 2 will work (as its not the whole movie of course)

authoring in mpeg-4 systems
till someone writes a nice mpeg-2 systems -> mpeg-4 systems convertor, the menu authoring has to be done "by hand" by using a textual language format, called XMT or BT (based on VRML, like the well known Flash), which than has to be compiled/encoded into mp4 (a free available compiler/encoder is for example mp4box), which creates the so called BIFS track, which carries the menu and controls how the a/v gets played

why mp4menu?
as you can imagine writing a whole BT/XMT scipt from the ground by hand for a dvd-like menu in mp4 is not that easy.
a gui would make this process much easier and there are already some GUI oriented MP4 authoring tools existing, but all not available to the broad public!

now i always wanted to be able to also use menus on my backups, to be able to make a real 1:1 copy of a dvd on a cdr. so i wanted to explore the possibilities of mpeg-4 systems and create a dvd-like menu in mp4. thats why i started to learn the BT/XMT language from the ground.
to share my learned knowledge (and the resulting script) i created the mp4menu project which has the goal to make it easier for you to author such dvd-like menus in mp4 yourself

now you can find the product of this work on sourceforge on the mp4menu page i created there
i hope that i will be able to make mp4menu even better with your suggestions on what to improve

how can i use mp4menu?
mp4menu provides you a BT sample script (XMT will follow) which already offers all the main features you can find on a dvd menu (ie chapter menu, language menu, etc...)
"all" you have to do now is to adopt this sample script to the dvd menu you want to make a backup from (well most dvd menus are similar but not exactly the same)

so lets start with a small guide
before you can start let me tell you something about the "world" we are in:
[hm, as doom9 doesnt allow political discussions here i will leave the most important part out ]
in the current mp4menu script we are in a world that has 2 dimensions (well 3 dimensions are also possible in mpeg-4 systems, but i havent seen a 3D dvd menu till now ) and this world is defined by time (not frames, as mp4 also handles variable framerate) and pixels (not meters or somthing similar)

preparing the source
first of all: i dont allow the usage of mp4menu when it is against the legal situation in your country (in most countries its still allowed to make a backup of dvds you own, but not to break the dvd copy protections etc...)

i expect you to have your vob files, which contain the dvd menu, (or any other source you want to use) on your hd already

1) watch the dvd, learn how it works and note down what happens if you push here and there, where are the intros/outros/transitions between menus, what parts get looped etc...

2) encode/prepare the streams:
a) audio: specified audio formats in mp4 are mp3 and aac, but i think it makes things easier when you first convert your ac3 streams from the vob only into .wav (use besweet for that for example)
i will write later on why this can avoid problems

b) video: i expect you to know how to encode the video from a vob to mpeg-4. to avoid problems i suggest to use a codec which is able to input keyframes at specific points (all menus (chapters, languages, mainmenu) are stored right behind each other in the vob and will also be stored like this in 1 video stream in the mp4)
make sure you have a keyframe at positions where there are changes from 1 menu to the other for example (to find out where this exactly is you can also have a look at the vob (for example with virtualdubmod), cause it also has the keyframes at this points)
you can set keyframes in xvid (and in divx5 by using this ekg tool too afaik)
note that avi files created by divx5 or xvid using b-frames have to be muxed with mp4box or 3ivx to mp4, to get spec compliant mp4 files!

a second thing you have to look for is that the width of your menu video stream has to have the same width as the movie! (to avoid black borders on the sides)

c) convert your subs into the srt format (or hardcode them onto the video stream)

3) cut the video:
often there are different styles of menus stored on a dvd/in a vob, i suggest you to choose only one to keep the final menu size low
a) mux the wav with the whole video, open the video in vdm and cut out all parts you dont want to have/dont need in your final menu
you can do that with the ac3 too, but vdm isnt that good in ac3 cutting imho as you will see if you do it
b) demux the cutted wav and encode it with your favourite encoder to mp3 or aac

the following formats are supported as input in mp4box:
mpeg-4 video in .avi and .mp4
audio: .mp3, cbrmp3 in .avi (not vbrmp3!), aac in .mp4

lets start with the script
grap the mp4menu script
the script might look like a huge beast at first sight but dont be afraid you dont have to change that much in there

if you want to know what each command is for, feel free to ask or have a look a this great guide written by the guys of the gpac project (i think it covers everything i have in my script)

1) define the size of your "world"
search for "pixelWidth" and set it to the width of your videos, set the height in a 4:3 ratio, ie width is 576 than the height is 432 (576*3/4)

2) change the links to your input files

3) adjust the segments:
a) as you can see you can define the chapterpoints with segmentdescriptor, you always have to define the startpoint and the duration (all in seconds)
b) the same method is used to define the different parts of the menuvideo stream (menuintro, transitions, the menus themselves etc...)

4) define the type/position of your buttons:
to make the buttons visible add a "#" before "transparency 1.0" in the buttonappearance proto
a) as known from your mathematics courses we have to define two values to define a point in a 2D world
the first value (x) will move the object horizontally, the second (y) vertically. the point 0 0 is in the middle of the world!
b) you can have all sorts of types for a button, ie rectangle, ellipse aso...
x is the width of the object and y the height (for some styles (ie circle) you need to define a radius)

5) define the appearance and position of the subs
search for MovieSubtitle, there you can define the size, font etc...
guess what you can define under position

6) the moviebuttons
i have added an own menu which you can use during movie playback, which you will not find on a dvd that way

its a little bit difficult to describe here what you need to look for, where to add the buttons, etc.. thats why i added some infos in the script itself

ok, i think these are all basic things everyone has to look for when using mp4menu, of course there are some things you have to change for each dvd seperately (like the number of chapters, the number of languages (audio and subs) aso...
i didnt described now how exactly this works cause it will be different every time, but feel free to ask, i will do my best to help you with your specific backup

convert the script into mp4
to convert the bt script into binary format in mp4 you need a compiler/encoder
jeanlf from gpac has written such a tool, mp4box, which works great
grap it from here
create and execute a .bat file with the following commandline:
"c:\path to\mp4box.exe" -mp4 "c:\path to\mp4menu_0.1.bt"
and you will get the ready output mp4 file

how can i play these mp4 files?
as these mp4 files are spec compliant to the mpeg-4 systems standard you should be able to play them with every good mpeg-4 systems 2D player
imho the best currently available is the Osmo4 from GPAC!
i dont recommend the usage of enviviotv as it is very limited (doesnt support all the funky features, like mp3, png decoding, chapters, loop...) and is not available for free anymore!

how is the chance that i will be able to playback these menus on hardware players in the future?
if h264 will become the next dvd successor the chance isnt that small imo
you have to know that the mp4 container is the native container of the h264 codec (not avi) as defined in the mpeg-4 standard
well if h264 becomes a success, the industry will ask for a way to create dvd-like menus and the chance is great that they will use the mpeg-4 systems standard for that

- make the moviebuttons/menu to be placed automatically at the bottom of the world
- design a nicer layout for the moviemenu (perhaps add a jpg/png as background)
- add some "on mouse over" animations
- convert the BT script to XMT
- write a nicer guide add things that might arise in the discussion
- get dshow developers to release better support for mp4menu or at least write a dshow video switcher

hm, anything else i wanted to say? i surely forgot something
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; 21st May 2004 at 15:41.
bond is offline   Reply With Quote

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 20:25.

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