View Full Version : MP4 Chapters not seeking properly...
ndjamena
27th April 2014, 11:45
I've posted this on VideoHelp:
http://forum.videohelp.com/threads/364100-Chapter-Issues-MKV-MP4
And asked on the MP4Box Forum:
https://sourceforge.net/p/gpac/discussion/287547/thread/76d07c9b/?limit=25#2a9b
And got nowhere, and I really need an answer to this. I'm encoding 2 versions of my DVDs with X264, one for a WDTV [MKV/AVC/AAC] and one for iPhone [MP4/AVC/AAC(Nero)]. I've managed to develop my process to the point where I'm extracting the Chapter Info from my MakeMKV rips and converting them to X264 QP files to set I-frames at the chapter points and GPAC ttxt files and Nero/Ogg text files to add chapters to the MP4s. My MKV encodes are coming out perfectly, the I-frames are in exactly the right places and when I seek to the next chapter in VLC it goes to exactly the right frame. However I'm having problems with the MP4Box generated MP4s. VLC just WILL NOT seek to the right frame, despite the fact that there's an I-frame there. It always manages to start a few frames early and the apple players (iTunes/iPhone) do the same thing. I've looked at the MP4box documentation and fiddled with the nodrop and packed options to no avail. Oh, wise ones, I'm at a loss here. What am I doing wrong?
(MPC-HC seems to seek within the MP4's perfectly)
SeeMoreDigital
27th April 2014, 14:34
From what I remember about creating chapters for MP4 contained files, they don't actually have to be I-frame specific...
It's a long time since I generated any .MP4 contained files (for use with my hardware players), but when I did I used YAMB and wrote my own 'chapter' text file complete with chapter names.
I don't remember having any chapter navigation issues...
ndjamena
27th April 2014, 14:45
<?xml version="1.0" encoding="UTF-8" ?>
<!-- GPAC 3GPP Text Stream -->
<TextStream version="1.1">
<TextStreamHeader width="480" height="368" layer="0" translation_x="0" translation_y="0">
<TextSampleDescription horizontalJustification="center" verticalJustification="bottom" backColor="0 0 0 0" verticalText="no" fillTextRegion="no" continuousKaraoke="no" scroll="None">
<FontTable>
<FontTableEntry fontName="Arial" fontID="1"/>
</FontTable>
<TextBox top="0" left="0" bottom="368" right="480"/>
<Style styles="Normal" fontID="1" fontSize="32" color="ff ff ff ff"/>
</TextSampleDescription>
</TextStreamHeader>
<TextSample sampleTime="00:00:00.000">"Beast Wars"</TextSample>
<TextSample sampleTime="00:01:01.520">Part 1</TextSample>
<TextSample sampleTime="00:09:22.000">Part 2</TextSample>
<TextSample sampleTime="00:14:08.680">Part 3</TextSample>
<TextSample sampleTime="00:20:39.520">Next Time...</TextSample>
<TextSample sampleTime="00:21:09.520">Credits</TextSample>
<TextSample sampleTime="00:22:10.080" text = ""></TextSample>
</TextStream>
CHAPTER01=00:00:00.000
CHAPTER01NAME="Beast Wars"
CHAPTER02=00:01:01.520
CHAPTER02NAME=Part 1
CHAPTER03=00:09:22.000
CHAPTER03NAME=Part 2
CHAPTER04=00:14:08.680
CHAPTER04NAME=Part 3
CHAPTER05=00:20:39.520
CHAPTER05NAME=Next Time...
CHAPTER06=00:21:09.520
CHAPTER06NAME=Credits
1538 I
14050 I
21217 I
30988 I
31738 I
General
Complete name : F:\iPhone\Beast Wars\Season 01\Beast Wars - 01x01 - Beast Wars (1).mp4
Format : MPEG-4
Codec ID : M4V
File size : 176 MiB
Duration : 22mn 10s
Overall bit rate mode : Variable
Overall bit rate : 1 112 Kbps
Encoded date : UTC 2014-04-27 09:34:38
Tagged date : UTC 2014-04-27 09:34:38
Writing application : NDJMux
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 10 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 22mn 10s
Bit rate : 949 Kbps
Maximum bit rate : 4 839 Kbps
Width : 768 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.086
Stream size : 150 MiB (85%)
Title : AVC/H.264/MPEG4 Part 10 (25 fps)
Writing library : x264 core 142 r2409 d6b4e63
Encoding settings : cabac=1 / ref=10 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=0 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=250 / rc=crf / mbtree=1 / crf=22.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=2:1.10
Language : English
Encoded date : UTC 2014-04-27 09:34:38
Tagged date : UTC 2014-04-27 09:34:40
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 22mn 9s
Bit rate mode : Variable
Bit rate : 159 Kbps
Maximum bit rate : 177 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 25.3 MiB (14%)
Title : English AAC(2.0)
Language : English
Encoded date : UTC 2014-04-23 00:50:48
Tagged date : UTC 2014-04-27 09:34:40
Menu #1
ID : 3
Codec ID : tx3g
Duration : 22mn 10s
Title : *ttxt:chap@GPAC0.5.1-DEV-rev5222
Encoded date : UTC 2014-04-27 09:34:40
Tagged date : UTC 2014-04-27 09:34:40
Bit rate mode : VBR
Menu #2
00:00:00.000 : "Beast Wars"
00:01:01.520 : Part 1
00:09:22.000 : Part 2
00:14:08.680 : Part 3
00:20:39.520 : Next Time...
00:21:09.520 : Credits
14168
That's the frame 'Part 2' is supposed to start at, yet if I skip to that chapter using VLC (or iTunes or my iPhone) I then have to press the frame by frame button 5 times to get to that frame and I'd like to know why, so I can fix it.
manolito
27th April 2014, 15:03
In MediaInfo your chapters are shown only in the "Menu" section. This means that you do not have chapters in the "Apple Text" format which leads to several media player software not being able to read the chapters correctly.
You can add Apple Text chapters to your file with MKVtoMP4 in addition to the chapters that your file already contains. Have a look at this thread:
http://forum.doom9.org/showthread.php?p=1608000#post1608000
Good luck
manolito
ndjamena
27th April 2014, 23:07
I loaded the file into MKVtoMP4, added some tags and saved it. The first set of chapters has been replaced, it now has a CodecID of 'text' rather than 'tx3g'. The problem persists. (The MediaInfo output is a lot neater though.)
manolito
28th April 2014, 01:11
You have to use this procedure:
http://forum.doom9.org/showthread.php?p=1569412#post1569412
You need an MKV file which already has the desired chapters. Then load both files (the MP4 file you want to add the chapters to and the MKV file) into MKVtoMP4.
After successfully doing this the Apple Text chapters appear in MediaInfo under the "Text" label like this:
Text
ID : 3
Format : Apple text
Codec-ID : text
Dauer : 6min 2s
Duration_LastFrame : -57s 897ms
Bitraten-Modus : konstant
Bitrate : 4 bps
Stream-Größe : 161 Bytes (0%)
Kodierungs-Datum : UTC 2012-12-30 01:05:58
Tagging-Datum : UTC 2012-12-30 01:05:58
Cheers
manolito
ndjamena
28th April 2014, 01:41
*sigh* I tried to follow the instructions as closely as I could BUT, I can't get the chapters directly from the DVD, because I used AVIDemux and MMG to set my own chapters in my original MKVs! Plus MMG won't let me make an MKV with just the chapters, it needs tracks to mux or it throws up an error. So I took the chapters from my original MKV and copied them into the MP4 using MKVtoMP4 and the problem persists. By the way, I'm pretty sure you're fixing the wrong problem, I already had Apple Compatible Chapters in my files, that's what feeding the ttxt file into MP4Box is for, I had two sets of chapters already, I only add the Nero chapters so I can see them in MediaInfo.
For some reason the MKV version has a 9ms delay on the AAC stream, could that have something to do with it? I didn't tell MKVMerge to add a delay, yet it does it every time, is there something about AAC that makes it start earlier than it should?
Are MP4 and MKV time-codes the same? Should I be modifying my time-codes when I copy them into the TTXT file?
Is there something wrong with VLC and iTunes seeking abilities? Are they fixed to some timeline that isn't readily apparent?
When I load a file into AVIDemux the first frame NEVER starts at 00:00:00.000. Why is that? Does that give me some clue as to what's going on?
Is it possible MakeMKV sets it's chapter time-codes one frame too early? I learnt how to determine Chapter Time-Codes by looking at it's chapters...
Or should I just accept that my mp4 chapters aren't going to seek properly and move on.
Kurtnoise
28th April 2014, 08:15
I never got this issue using the player from iTunes/iPhone...
Could you post the mp4box command line used for the mux ?
ndjamena
28th April 2014, 08:44
"C:\Program Files (x86)\GPAC\MP4Box.exe" -ipod -add "D:\Videos2\Beast Wars - 01x01 - Beast Wars (1)\iPhone\Video 1.h264:fps=25:delay=0:lang=en:name=AVC/H.264/MPEG4 Part 10 (25 fps):enable:group=1" -add "D:\Videos2\Beast Wars - 01x01 - Beast Wars (1)\iPhone\Audio 1.m4a:delay=0:lang=eng:group=2:enable:name=English AAC(2.0)" -add "D:\Videos2\Beast Wars - 01x01 - Beast Wars (1)\Chapters.ttxt:chap" -chap "D:\Videos2\Beast Wars - 01x01 - Beast Wars (1) Chapters.txt" -itags tool="NDJMux" -new "F:\iPhone\Beast Wars\Season 01\Beast Wars - 01x01 - Beast Wars (1).mp4"
I've tried adding various iterations of the the 'packed' and 'nodrop' options to no avail.
The closest thing to a clue I have is that FFVideoSource("Beast Wars - 01x01 - Beast Wars (1).mp4", seekmode=0).FFInfo() says the VFR is 120ms ahead of the CFR. I don't know what that means or how to fix it, or even if it actually is the problem.
Nero AAC Audio:
General
Complete name : D:\Videos2\Beast Wars - 01x01 - Beast Wars (1)\iPhone\Audio 1.m4a
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 25.5 MiB
Duration : 22mn 9s
Overall bit rate mode : Variable
Overall bit rate : 161 Kbps
Encoded date : UTC 2014-04-23 00:50:48
Tagged date : UTC 2014-04-23 00:51:21
Audio
ID : 1
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 22mn 9s
Bit rate mode : Variable
Bit rate : 159 Kbps
Maximum bit rate : 181 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 25.3 MiB (99%)
Writing library : Nero AAC codec 1.5.4.0
Encoding settings : -2pass -br 162000
Encoded date : UTC 2014-04-23 00:50:48
Tagged date : UTC 2014-04-23 00:51:21
Menu
H264 Video:
General
Complete name : D:\Videos2\Beast Wars - 01x01 - Beast Wars (1)\iPhone\Video 1.h264
Format : AVC
Format/Info : Advanced Video Codec
File size : 150 MiB
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 10 frames
Width : 768 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Writing library : x264 core 142 r2409 d6b4e63
Encoding settings : cabac=1 / ref=10 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=250 / rc=crf / mbtree=1 / crf=22.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=2:1.10
According to FFVideoSource the end file has the same number of frames as the UTCodec Source shared by the two different encodes...
I'm waiting for someone to tell me I'm and idiot and why...
Kurtnoise
28th April 2014, 09:19
Try this :
"C:\Program Files (x86)\GPAC\MP4Box.exe" -add "D:\Videos2\Beast Wars - 01x01 - Beast Wars (1)\iPhone\Video 1.h264:lang=en:name=AVC/H.264/MPEG4 Part 10 (25 fps):group=1" -add "D:\Videos2\Beast Wars - 01x01 - Beast Wars (1)\iPhone\Audio 1.m4a:lang=eng:group=2:name=English AAC(2.0)" -add "D:\Videos2\Beast Wars - 01x01 - Beast Wars (1)\Chapters.ttxt:chap" -itags tool="NDJMux" -new "F:\iPhone\Beast Wars\Season 01\Beast Wars - 01x01 - Beast Wars (1).m4v"
And try also with another player like mpc-hc to check if the seeking issue comes from the player or not...
ndjamena
28th April 2014, 09:37
I tried MPC-HC already and it takes me to exactly the right frame. I have exactly the same file open in both VLC and MPC-HC right now. If I pause and press next chapter until I get to "Part 2" VLC takes me five frames early, MPC-HC takes me to exactly the right frame, which I can verify by opening the UT source in VirualDub [which gives me the time-code Frame 14050 (0:09:22.000) for it] and comparing. The real problem is the apple 'i' programs follow VLCs lead and that is the intended destination.
Could MPC-HC simply be seeking to the next I-Frame?
Kurtnoise
28th April 2014, 12:52
Blame the players then not the tool used to create those files...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.