View Full Version : Setting the audio/video delay in MP4 with mp4box
bob0r
9th June 2005, 18:50
If ever mp4box developers read this thread:
I would really like an audio delay option added to mp4box, my satellite captures always have an audio delay... :thanks:
vortex_hl
9th June 2005, 19:40
If ever mp4box developers read this thread:
I would really like an audio delay option added to mp4box, my satellite captures always have an audio delay... :thanks:
did you try delaycut tool?
http://jsoto.posunplugged.com/audiotools.htm
Kurtnoise
10th June 2005, 09:36
If ever mp4box developers read this thread:
I would really like an audio delay option added to mp4box, my satellite captures always have an audio delay... :thanks:
Why not specify this delay when you encode your audios streams ? BeSweet can do that...
SeeMoreDigital
11th June 2005, 00:21
New mp4box compile please... :D I can't do it by myself... :o yes, I'm lazy. Jeez... that was fast work by Jean :D
I wonder how the delay is done if it might not be supported by some players?
Anyway, with regard to setting audio/video sync delays, I wonder whether it would be simpler for people to understand if it was done by "frames" instead of by "Milliseconds"?
Just a thought....
Cheers
bond
11th June 2005, 13:07
splitted this too in an own thread
as some might have realised already its possible now to set a delay between audio and video via the -delay switch
I wonder how the delay is done if it might not be supported by some players?
should be supported if its done the same way as the 3ivx muxer handled the delay setting, as once i tested it all players i tried handled it
of course this still doesnt change the point that its better to correct the delay when encoding the audio (eg in besweet), cause this will than work in any player (and of course you will also not loose sync again when extracting the audio and muxing again or similar conversions)
Anyway, with regard to setting audio/video sync delays, I wonder whether it would be simpler for people to understand if it was done by "frames" instead of by "Milliseconds"?
it doesnt make sense to do anything like this on a frame basis in a container that handles variable framerates
apart from that people mostly get delayed streams from dvds where you also only get the info in milliseconds on how big the delay is
bond
12th June 2005, 20:32
hm, did anyone manage to set the delay with mp4box?
somehow whatever i set i dont seem to get the delay recognized during playback with various players
Kurtnoise
12th June 2005, 21:05
hm, did anyone manage to set the delay with mp4box?
Example with a delay of 200ms for the trackID 2 from a mp4 file :
mp4box -delay 2=200 -add input.mp4 output.mp4
somehow whatever i set i dont seem to get the delay recognized during playback with various players
From the changelog :
10/06/05:
- added -lang option to MP4Box to change track language
- added -delay option to MP4Box to change initil media delay - ALTHOUGH 100% STANDARD, THIS MAY NOT BE SUPPORTED BY SOME PLAYERS
Doom9
12th June 2005, 21:20
I'm wondering about something.. there's a bunch of options for import in general (like fps, delay, etc). How does mp4box handle those options? would it make the most sense to do something like
mp4box -add fps 23.976 video.264 -add -delay 2=200 -lang 2=eng audio1.aac -add -delay 3=-50 -lang 3=ger audio2.aac -new output.mp4
the documentation does not really outline the order in which arguments have to be given. I figure for the delay it doesn't matter.. but -fps for instance can be used for video and subtitle input, and it doesn't require a track id.
bond
12th June 2005, 21:35
Example with a delay of 200ms for the trackID 2 from a mp4 file :
mp4box -delay 2=200 -add input.mp4 output.mp4
ok of course, but did you also test whether players use that delay? if yes, what players/filters did you try?
the documentation does not really outline the order in which arguments have to be given. I figure for the delay it doesn't matter.. but -fps for instance can be used for video and subtitle input, and it doesn't require a track id.indeed a good question. would love to know the answer too
Kurtnoise
13th June 2005, 07:59
ok of course, but did you also test whether players use that delay? if yes, what players/filters did you try?
Osmo4, VLC, MPLayer enable the delay...I think all players which don't work with dshow filters. Tested into MPC (with the last haali splitter & ffdshow A/V decoders) and the delay wasn't taken into account. Maybe it just requires an update concerning the mp4 splitter...
Kurtnoise
13th June 2005, 08:08
I'm wondering about something.. there's a bunch of options for import in general (like fps, delay, etc). How does mp4box handle those options? would it make the most sense to do something like
mp4box -add fps 23.976 video.264 -add -delay 2=200 -lang 2=eng audio1.aac -add -delay 3=-50 -lang 3=ger audio2.aac -new output.mp4
the documentation does not really outline the order in which arguments have to be given. I figure for the delay it doesn't matter.. but -fps for instance can be used for video and subtitle input, and it doesn't require a track id.
I think that all these options must be include before the stream add command.
bond
13th June 2005, 14:06
seems i am too dumb to make it work (tried latest mplayer and vlc) :devil:
can you plz post your exact steps, inclusive used commandlines and the trackids of the input/output files
thanks a lot!
Kurtnoise
13th June 2005, 15:42
Well...if you want.
1°) Movie Info for the input file :
* Movie Info *
Timescale 600 - Duration 00:02:58.160
Fragmented File no - 4 track(s)
File Brand isom - version 1
File has root IOD
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: AVC/H264 Profile (0x15)
Audio PL: AAC Profile @ Level 1 (0x28)
No streams included in root OD
Chapters:
Chapter #1 - 00:00:00.000 - "Chapter 1"
Chapter #2 - 00:01:00.000 - "Chapter 3"
Chapter #3 - 00:01:30.000 - "Chapter 4"
Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:02:58.160
Media Info: Language "und" - Type "vide" - Sub Type "avc1" - 4454 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 512 x 336
Self-synchronized
Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:02:58.133
Media Info: Language "und" - Type "soun" - Sub Type "mp4a" - 4175 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 24000 - SBR SampleRate 48000
Synchronized on stream 1
Track # 3 Info - TrackID 5 - TimeScale 48000 - Duration 00:02:58.133
Media Info: Language "und" - Type "soun" - Sub Type "mp4a" - 4175 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 24000 - SBR SampleRate 48000
Synchronized on stream 1
Track # 4 Info - TrackID 8 - TimeScale 1000 - Duration 00:01:43.279
Media Info: Language "und" - Type "text" - Sub Type "tx3g" - 39 samples
3GPP/MPEG-4 Timed Text - Size 512 x 336 - Translation X=0 Y=0 - Layer 0
2°) Apply the delay of 2 seconds for the trackID 1 from this mp4 file :
mp4box -delay 1=2000 -add input.mp4 output.mp4
3°) Movie info for the output file :
* Movie Info *
Timescale 600 - Duration 00:03:00.160
Fragmented File no - 4 track(s)
File Brand isom - version 1
File has root IOD
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: AVC/H264 Profile (0x15)
Audio PL: AAC Profile @ Level 1 (0x28)
No streams included in root OD
Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:02:58.160
Media Info: Language "und" - Type "vide" - Sub Type "avc1" - 4454 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 512 x 336
Self-synchronized
Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:02:58.133
Media Info: Language "und" - Type "soun" - Sub Type "mp4a" - 4175 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 24000 - SBR SampleRate 48000
Synchronized on stream 1
Track # 3 Info - TrackID 3 - TimeScale 48000 - Duration 00:02:58.133
Media Info: Language "und" - Type "soun" - Sub Type "mp4a" - 4175 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 24000 - SBR SampleRate 48000
Synchronized on stream 1
Track # 4 Info - TrackID 4 - TimeScale 1000 - Duration 00:01:46.191
Media Info: Language "und" - Type "text" - Sub Type "tx3g" - 39 samples
3GPP/MPEG-4 Timed Text - Size 0 x 0 - Translation X=0 Y=0 - Layer 0
4°) The playback with VLC 0.8.2 test2 :
http://kurtnoise.free.fr/vlc_delay.gif http://kurtnoise.free.fr/vlc_wo_delay.gif
Sergejack
13th June 2005, 16:00
Tested into MPC (with the last haali splitter & ffdshow A/V decoders) and the delay wasn't taken into account. Maybe it just requires an update concerning the mp4 splitter...
Yes I think it comes from haali splitter (wich btw, doesn't split some mkv rigth (seeking making bugs happen)).
About synthax :
MP4Box [option] input [option]
ie : MP4Box "G:\Anime EAF\Final\[EAF]CPR_03.mp4" -delay 2=-500
bond
13th June 2005, 18:08
thanks a lot kurt! i did it exactly like you, so the failure was not on my side :D
i actually seem to have found a bug:
when the audio stream for example has the id 101, setting the delay while refering to 101 doesnt work (meaning no delay gets set)
when setting the same delay on the other hand on the same input file but refering to id 1 (which normally is the id of the bifs stream in that file) it works (in videolan)
when doing the same on a .mp4 file which has the audio with id 1 it works fine (of course)
i will investigate this further when i come home...
that said the delay set seems to be recognized by videolan, osmo4 and the 3ivx splitter correctly (doesnt matter what decoders used), after all the 3ivx muxer handles setting the delay for some time now
it didnt work with latest mplayer (always plays parts of the sound over and over again at the beginning, till the point where the audio should start and than plays the audio from the beginning without delay - that is cd's compile), nero's and haali's parser (no matter what decoder was used)
bond
14th June 2005, 14:38
important:
here is what jeanlf wrote about the issue:
For now you can only modify the start delay of an existing
file, you cannot specify it on the fly at import time.
so the cmdl (as posted by kurt):
mp4box -delay 1=2000 -add input.mp4 output.mp4is strictly speaking not valid, altough it works for some strange reasons (but doesnt work with trackid 101)
a valid commandline would only be
MP4Box -delay 1=2000 input.mp4 (-out output.mp4)
Sergejack
14th June 2005, 15:08
so the cmdl (as posted by kurt):
mp4box -delay 1=2000 -add input.mp4 output.mp4is strictly speaking not valid, altough it works for some strange reasons (but doesnt work with trackid 101)
I wouldn't say it work since it append input.mp4 into output.mp4 if it exists.
"-new" is a usefull param in such case.
mp4box -delay 1=2000 -new -add input.mp4 output.mp4
a valid commandline would only be
MP4Box -delay 1=2000 input.mp4 (-out output.mp4)
That's quite what I previously wrote ^^'
(feel like not being read anymore)
bond
14th June 2005, 15:10
I wouldn't say it work since it append input.mp4 into output.mp4 if it exists.
"-new" is a usefull param in such case.
mp4box -delay 1=2000 -new -add input.mp4 output.mp4
the point is this is not supposed to work as jeanlf said and therefore isnt save to use imho
That's quite what I previously wrote ^^'
(feel like not being read anymore)
indeed :p
Sergejack
15th June 2005, 00:28
the point is this is not supposed to work as jeanlf said and therefore isnt save to use imho
I know, I was just talking about the -new feature.
vsv
9th August 2005, 18:06
I've used MP4Box from GPAC version 0.2.4
"E:\>mp4box -delay
Option -delay unknown. Please check usage"
PS ok now have
MP4Box - GPAC version 0.4.0
GPAC Copyright: (c) Jean Le Feuvre 2000-2005
(c) ENST 2005-200X
nixx
26th November 2006, 16:13
$ ./MP4Box -version
MP4Box - GPAC version 0.4.2
GPAC Copyright: (c) Jean Le Feuvre 2000-2005
(c) ENST 2005-200X
$ ./MP4Box -tmp ~nixx/ -add video3.264:fps=23.9760 -add 1-vbr-110ms-head.mp3:lang=Russian -new dumb.mp4
$ ./MP4Box -info dumb.mp4 > info1.txt
$ ./MP4Box -delay 2=-110 dumb.mp4 -out dumbout.mp4
$ ./MP4Box -info dumbout.mp4 > info2.txt
$ diff info1.txt info2.txt
2c2
< Timescale 600 - Duration 01:46:36.028
---
> Timescale 600 - Duration 03:45:54.196
what i'm does wrong?
nobody here? ;) so, i have this bug on many files. i find it on divx(avi)+mp3, x264(raw)+mp3.
nixx
24th December 2006, 09:44
can anybody help me with mp4box' a/v delays? or my bug is only MY bug?
bond
24th December 2006, 12:54
seems to be a mp4box bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1589916&group_id=84101&atid=571738
nixx
30th December 2006, 23:33
seems to be a mp4box bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1589916&group_id=84101&atid=571738
thanks. i read your comment there - i don't use megui. i works in windows with mp4box only and in freebsd with gpac from fresh ports.
nixx
25th March 2007, 16:29
how to set "minus" audio delay with MP4Box? i downloads it from kurtnoise.free.fr/mp4tools/MP4Box-0.4.3_20070320.zip.
i tries commandlines like:
MP4Box.exe -add 123.avi -add 1234.mp3:lang=Russian:delay=-500 -new fox.mp4
or
MP4Box.exe -add 123.avi -add 1234.mp3:lang=Russian -new fox.mp4
MP4Box.exe -delay 2=-500 fox.mp4 -out foxout.mp4
but with no effect.
Drachir
25th March 2007, 17:42
Which player do you use for playback? Your player probably don't support the Edit Box/Edit List Box. Ask the developers of the used player if they support the Edit Box/Edit List Box.
Try playback with Osmo4.
nixx
25th March 2007, 22:46
Which player do you use for playback?
media player classic 6.4.9.0 with internal mp4/mov filter and with latest haali media splitter.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.