Log in

View Full Version : Import chapters into mp4


Pages : [1] 2

hhanh00
5th April 2005, 09:28
Does anyone know of a *standalone* tool that can mux a chapter info file (exported from an IFO file for instance) into a mp4 container? I know Nero Mp4 muxer can do that but it's not command line and one has to manually type in the chapter stops.

Thanks a bunch
--h

bond
5th April 2005, 18:15
nope it hasnt been reverse engineered till now :D

but it would be great if someone could do this ;)

the nero chapters are placed in the udta atom (user data), which can be used for placing private data in the .mp4

hhanh00
5th April 2005, 21:18
Strange ... MPC understands nero chapter stops so I figured it knew how to parse it. Maybe it's metadata returned by the mp4 splitter? The format of the atom looks rather simple though. I wonder why they have timestamps in 1/10 000 000 of a sec...

Thanks,
--h

bond
5th April 2005, 21:22
Originally posted by hhanh00
[B]Strange ... MPC understands nero chapter stops so I figured it knew how to parse it. if you use the nero parser together with the nero decoder it will work in any dshow player

Maybe it's metadata returned by the mp4 splitter? nope, the chapters are in udta

The format of the atom looks rather simple though. I wonder why they have timestamps in 1/10 000 000 of a sec...maybe because the timescale is set in a way this is necessary? sorry dunny :/

hhanh00
6th April 2005, 02:14
Thanks, bond.

Here's a tool for adding chapters to an mp4 file. Please read the documentation before using it.

IT MODIFIES YOUR FILE IN PLACE WITHOUT MAKING A BACKUP.

JoeBG
6th April 2005, 05:47
Originally posted by hhanh00
Thanks, bond.

Here's a tool for adding chapters to an mp4 file. Please read the documentation before using it.

IT MODIFIES YOUR FILE IN PLACE WITHOUT MAKING A BACKUP.

Where is it? Canīt see it :confused:

yaz
6th April 2005, 09:12
@hhanh00
where is 'here' ? pls !
thx
y

hhanh00
6th April 2005, 09:27
A moderator has to approve the upload...

bond
6th April 2005, 17:18
hhanh00, wow you are quick! :)
cant wait to test it

btw would it be possible for you to also post the sources (and eg release it under gnu public license), so other mp4 tool devs can incorportate this into their tools too?

JoeBG
6th April 2005, 17:50
Which tools creates the needed Chapter file for your tool? It seems to be really great. Makes things much more easy. Can I create it with Chapter Extraktor?

SeeMoreDigital
6th April 2005, 18:03
Somebody make a GUI please?


Cheers

hhanh00
6th April 2005, 18:27
I have attached the source code. There is a big caveat with this tool: the moov atom has to be the last one in the mp4 file. It's quite difficult to make it work with any file because the chapter information goes into the moov atom. By inserting anything in it, you change the offsets of the data that follows it. Unless, you also update a lot of other entries (sample offsets and such), you end up with a corrupted file.

Changing a gpac or mpeg4ip is a more reasonable choice. It has all the infrastructure to deal with mpeg4 atoms. I wonder how they are confortable with modifications to their code though.

--h

JoeBG
6th April 2005, 18:33
Originally posted by JoeBG
Which tools creates the needed Chapter file for your tool?

I sitting here and really want to test it. But please tell me the tool for creating the chapterfile.

hhanh00
6th April 2005, 18:36
I use scenchap.

bond
6th April 2005, 18:51
Originally posted by hhanh00
There is a big caveat with this tool: the moov atom has to be the last one in the mp4 file. It's quite difficult to make it work with any file because the chapter information goes into the moov atom. By inserting anything in it, you change the offsets of the data that follows it. Unless, you also update a lot of other entries (sample offsets and such), you end up with a corrupted file.hum, ok good to know, so your tool is not useable on any file

still its good to have a first step of reverseengineering this :)

Changing a gpac or mpeg4ip is a more reasonable choice. It has all the infrastructure to deal with mpeg4 atoms. I wonder how they are confortable with modifications to their code though.i am sure they have absolutely nothing against batches or hints how they could add this :)

hhanh00
6th April 2005, 23:33
I've made a patch to mp4box (gpac-0.2.4rc4) to support adding chapters.

For instance, if you want to mux a video file (video.avi) and a mp4 file audio file (audio.mp4) with chapter points coming from (movie.chp) into a final movie.mp4 file, run
$ mp4box -add audio.mp4 -add video.avi -chpl movie.chp movie.mp4

The zip file contains a release executable compiled with MSVC and the diff file of the changes.

The chapter stops are compensated for the drop frame, i.e. they appear 0.1% later than what's indicated in the chp file.

It's too big to upload here (~0.5 MB), where can I put it?

Thanks,
--h

bond
6th April 2005, 23:38
wow great stuff

you might want to submit your code to the gpac project so that jeanlf can add it to the official mp4box cvs and therefore all compiles will offer that functionality too

you can for example submit patches to the gpac project via the sourceforge interface here (http://sourceforge.net/tracker/?atid=571740&group_id=84101&func=browse) or contact jeanlf directly

i am sure he would be happy about it :)

hhanh00
6th April 2005, 23:49
Cool. I've uploaded the diff over there.

bond
7th April 2005, 17:25
great!

JoeBG
7th April 2005, 20:00
Originally posted by hhanh00
I use scenchap.

And I tried to use it too. Am I right when I load the IFO (by typing the whole path) and create a new chapter.chp with copy and past with an editor like notepad? This is nearly the same work like typing the chapters into the Nero Direct Show muxer. There is really no progress.

It would be a progress if itīs possible to import chapterfiles from more comfortable tools like Chapter Extractor (Maestro and many other chapterfile formats) or directly the chapterfile from Decrypter (OGG chapterfile).

@ bond

Itīs really great, but not with scenechap :(

hhanh00
7th April 2005, 20:13
I suppose you can use ChapterXtractor if you want. The chapter format is simply
HH:MM:SS;FF/30

SeeMoreDigital
7th April 2005, 20:48
Yes....

There just seems to be so many ways of logging chapters. Here are DVDdecrypters options: -CCE: -

chapter=0:
chapter=6508:
chapter=11114:
chapter=14496:
chapter=18831:
-------------------------------------------------------------------------------------------
DVDLab: -

00:00:00:000
00:04:20:000
00:07:24:000
00:09:39:000
00:12:33:000
-------------------------------------------------------------------------------------------
IfoEdit: -

6508
11114
14496
18831
22315
-------------------------------------------------------------------------------------------
LBA: -

CHAPTER_01:VTS_02_1 - 0xE0 - Video - MPEG-2 - 720x576 (PAL) - 16~9 - Letterboxed.M2V:0
CHAPTER_02:VTS_02_1 - 0xE0 - Video - MPEG-2 - 720x576 (PAL) - 16~9 - Letterboxed.M2V:79291
CHAPTER_03:VTS_02_1 - 0xE0 - Video - MPEG-2 - 720x576 (PAL) - 16~9 - Letterboxed.M2V:123554
CHAPTER_04:VTS_02_1 - 0xE0 - Video - MPEG-2 - 720x576 (PAL) - 16~9 - Letterboxed.M2V:161018
CHAPTER_05:VTS_02_1 - 0xE0 - Video - MPEG-2 - 720x576 (PAL) - 16~9 - Letterboxed.M2V:206059
-------------------------------------------------------------------------------------------
OGG: -

CHAPTER01=00:00:00.000
CHAPTER01NAME=Chapter 1
CHAPTER02=00:04:20.320
CHAPTER02NAME=Chapter 2
CHAPTER03=00:07:24.560
CHAPTER03NAME=Chapter 3
CHAPTER04=00:09:39.840
CHAPTER04NAME=Chapter 4
CHAPTER05=00:12:33.240
CHAPTER05NAME=Chapter 5
-------------------------------------------------------------------------------------------
Scenarist: -

00:00:00;00
00:04:20;08
00:07:24;14
00:09:39;21
00:12:33;06
-------------------------------------------------------------------------------------------
DVDMaestro: -

$Spruce_IFrame_List

00:00:00:00
00:04:20:08
00:07:24:14
00:09:39:21
00:12:33:06
-------------------------------------------------------------------------------------------
BSPlayer: -

[CHAPTERS]
1=0 Chapter 1
2=6508 Chapter 2
3=11114 Chapter 3
4=14496 Chapter 4
5=18831 Chapter 5What a shame DVD's were never designed to display the names of the chapters too. Can be done for chapters within the MP4 container?


Cheers

hhanh00
7th April 2005, 21:08
The chapter names are stored inside the mp4 file. It's probably what's displayed by the player. Nero stores 'Chapter n'.

SeeMoreDigital
7th April 2005, 21:11
Are you able to experiment and report back?


Cheers

LigH
7th April 2005, 21:23
Originally posted by hhanh00
I've made a patch to mp4box (gpac-0.2.4rc4) to support adding chapters.
katjarella reports that this patch is obviously not working in GPAC dev build 0.2.5 by celtic-druid?!
Option -chpl unknown. Please check usage
If the code is indeed already included, maybe just the command line parsing was not updated...

hhanh00
7th April 2005, 21:29
I've just sent them the patch. I don't think they have included it yet.

hhanh00
7th April 2005, 21:31
chapter names are indeed supported.

opsis81
7th April 2005, 23:46
@ hhanh00
Well done hhanh00:)
You could upload your patched mp4box build in http://www.yousendit.com
or http://rapidshare.de/en/webhosting.html until they include it.

bond
8th April 2005, 10:05
Originally posted by opsis81
You could upload your patched mp4box build in http://www.yousendit.com
or http://rapidshare.de/en/webhosting.html until they include it. [/B]slow guys slow

jeanlf now added chaptersupport to mp4box, but he changed hhanh00's code a little bit

so a plain cvs mp4box compile would be the best way to go atm (maybe someone wants to send celtic_druid a pm), but beaware that this option is not tested at all, so only use it for testing atm!

JoeBG
8th April 2005, 15:46
Originally posted by hhanh00
I suppose you can use ChapterXtractor if you want. The chapter format is simply
HH:MM:SS;FF/30

30 is fps? This means for Europe 25?

Okay I createt a new preset in Chapter Extractor with:

00:00:00;00/25
00:01:21;80/25

Does this file work as Chapter.chp or as chapter.txt?

bond
8th April 2005, 16:06
mp4box should support the following input formats according to the changelog:

currently support for (one chapter entry per line):
ZoomPlayer syntax: AddChapter (-fps for import framerate selection), AddChapterBySecond and AddChapterByTime
Regular time code … la SRT: HH:MM:SS[:ms or .ms] [Chapter Name]
SMPTE time code: HH:MM:SS;fr/fps [Chapter Name] - if fps is omitted, use '-fps' if specified or 25 fps default.and the so called "ogg format":added support for new chaper format: CHAPTERX=HH:MM:SS[:ms or .ms] and CHAPTERXNAME=string

JoeBG
8th April 2005, 16:32
Originally posted by bond
mp4box should support the following input formats according to the changelog:
SMPTE time code: HH:MM:SS;fr/fps [Chapter Name]


What means fr? number of frames in the chapter?

Edit: Itīs cc in frames.

So the only thing what is left for me is, if it should be *.chp file or *.txt or whatever?

Doom9
8th April 2005, 17:28
timecodes can either be specified with 1/100 of seconds, or with frames. Many formats use frames because it's always accurate and more obvious than writing out 17/23.976..

JoeBG
8th April 2005, 18:22
Originally posted by Doom9
timecodes can either be specified with 1/100 of seconds, or with frames. Many formats use frames because it's always accurate and more obvious than writing out 17/23.976..

Thanks for this information. I programmed Chapter Extractor to output the followind *.txt file:

00:00:00;00/25 Chapter 1
00:04:08;04/25 Chapter 2
00:09:17;01/25 Chapter 3
00:11:39;00/25 Chapter 4
00:14:31;08/25 Chapter 5
00:15:58;02/25 Chapter 6
00:22:10;02/25 Chapter 7
00:28:12;00/25 Chapter 8

Can I import this as txt or chp?

SeeMoreDigital
8th April 2005, 18:48
Or, I guess it could be expressed like this: - hh:mm:ss:fr
00:07:24:14 Chapter 3

Whereby, 14 would represent the 14th frame out of 25 for a PAL encode
Cheers

bond
8th April 2005, 19:10
guys why not simply use the good old ogg chapter format ;)

SeeMoreDigital
8th April 2005, 19:28
Originally posted by bond
guys why not simply use the good old ogg chapter format ;) According to DVDdecrypter, the OGG chapter format is presented like this: -CHAPTER03=00:07:24.560
CHAPTER03NAME=Chapter 3Is this what you mean?


Cheers

bond
9th April 2005, 08:16
Originally posted by SeeMoreDigital
Is this what you mean?sure :)

SeeMoreDigital
9th April 2005, 08:49
Originally posted by bond
sure :) It looks like the OGG method also supports chapter naming... Such as this: -CHAPTER03=00:07:24.560
CHAPTER03NAME=Street Scene... So I'm in!


Cheers

opsis81
10th April 2005, 23:37
http://4nykey.nm.ru/misc/gpac.7z

Latest mp4box build,compiled in 10-Apr-2005,supports nero chapters with -chap command and accepts the ogg chapter format.

pogo stick
11th April 2005, 09:59
Working great! Big Thanks to Hhanh and Jeanlf! And AK (4nykey) for compiling! :)

SeeMoreDigital
11th April 2005, 10:21
The link is dead for me :(


Cheers

bond
11th April 2005, 15:06
Originally posted by opsis81
http://4nykey.nm.ru/misc/gpac.7z

Latest mp4box build,compiled in 10-Apr-2005,supports nero chapters with -chap command and accepts the ogg chapter format. seems to work great for me (both link and mp4box)
no problem here handling chapters as created by mp4box with tools understanding the chapters i tested (a preview of 3ivx, the tool from the avc beta testing...) didnt test nero's stuff, but i assume it handles it too :D

btw the "srt format" jeanlf talks about in the changelog has to look like this:

00:00:00.000 Some Chaptername for Chapter 1
00:00:00.880 Some Chaptername for Chapter 2
00:00:02.400 Some Chaptername for Chapter 3
00:00:06.720 Some Chaptername for Chapter 4
00:00:08.840 Some Chaptername for Chapter 5it seems mp4box also sets the milliseconds correctly (unlike the nero dshow mp4 parser, which doesnt allow setting milliseconds)

Elias
11th April 2005, 15:43
Is this chapter method MPEG-4 ISO/IEC compliant? I don't want to use chapters if they're non-compliant like Nero's chapters.

Doom9
11th April 2005, 15:50
Is this chapter method MPEG-4 ISO/IEC compliant?From the first line in the readme written by the original author of the patch:
Mp4Chap adds Nero style chapter points to an existing Mp4 file

SeeMoreDigital
11th April 2005, 15:59
This is great news...

Now if we had an MP4 muxing GUI built along the same lines as mpucoder's excellent Muxman (http://forum.doom9.org/showthread.php?s=&threadid=92122), our lives would be a whole lot simpler...


Cheers

bond
11th April 2005, 16:20
Originally posted by Elias
Is this chapter method MPEG-4 ISO/IEC compliant? I don't want to use chapters if they're non-compliant like Nero's chapters. first of all noone really knows whether there exist explicit specs for something like chapters in any of the mpeg standards :D

it might be that mpeg-7 covers something like this, but i am not sure. mpeg-4 doesnt explicitely handle this (implicitely it can be done via systems (eg via a menu) but there is still the old issue of not wide enough support for systems)

apart from that the nero-style chapters dont break the mpeg-4 standard as they are placed in the userdata atom (udta) which the mpeg-4 standard specifies for storage of private data
other examples of the useage of this udta atom are itunes' tags and coverart
so any player not handling the content in the udta atom will simply ignore it, therefore its save to use these chapters

Doom9
11th April 2005, 16:20
@smd: that would mean plugging into the library mp4box uses to mux (if there's one at all).. I could imagine that to be quite a bit of work. You're always quick to ask for graphical tools.. have you considered learning a programming language?

SeeMoreDigital
11th April 2005, 16:59
Hi Doom9,

I wish I had the patience (and higher intelligence) to learn how to program... I don't mind designing GUI's though.


Cheers

Doom9
11th April 2005, 17:04
you can design a GUI in the GUI designer of an IDE.. then it's not a big deal to turn that into a GUI. It's only when you start to have to suck stuff out of your finger (as in progress bars) when it gets a bit trickier.