View Full Version : mp4creator audio sync
OCedHrt
19th February 2005, 03:09
I have been re-encoding the audio of some anime I have to get the season to fit on a single DVD. These are usually MP3 VBR from AVI files that I would extract and encode to AAC with Nero's encoder. I would then use mp4creator to mux the avi video and the aac audio into one mp4 file.
The problem is, the resulting mp4 has minor sync problems. It seems that most files will be off-sync by about 100-300ms. At first I thought it was the audio files since they were MP3 VBR from AVI but using AVI-Mux I found that by muxing these AAC files into AVIs instead, the audio is in sync.
So now I am attributing this sync issue to either mp4creator, MPC, or whichever splitter was chosen for the mp4 file.
I will try it with MP4Box once I find a newer build. Mine is 0.1.9 and seems a bit outdated? When importing AVI it sets the resolution to 0x0 so I'm using mp4creator atm.
Hmm used MP4Box and the delay in audio is gone. Is it because of the b-frames in my source AVI? Seems like it's a bad idea to use b-frames with mp4creator..but I haven't had any problems with the video itself.
JoeBG
19th February 2005, 07:54
Originally posted by OCedHrt
Seems like it's a bad idea to use b-frames with mp4creator..but I haven't had any problems with the video itself.
The newest mpeg4ip tools can handle b-frames. Try mp4muxer, it does everything automatic in the correct order :D
bond
19th February 2005, 11:27
Originally posted by JoeBG
The newest mpeg4ip tools can handle b-framesdont mix mpeg-4 asp with mpeg-4 avc! these are totally different formats
as i write in my sticky there are issues with b-frames in .avi, which are caused by .avi and influence the bahviour of most .mp4 tools including mp4creator, which i will not repeat here
additionally there are two things in mp4creator:
1) if you mux from .avi to .mp4 with b-frames mp4creator (and all tools using it: mp4ui, mp4muxer...) will not create the needed ctts atom. most players seem to not need it, still its necessary to be 100% spec compliant
solution: demux your video stream to raw from .avi with the avi2raw tool from mpeg4ip and than remux to .mp4 with mp4creator
2) mp4creator seems to round the framerate to 2 decimal places, therefore 23.976 becomes 23.98 fps. on long movies this might causes sync issues
Originally posted by OCedHrt
The problem is, the resulting mp4 has minor sync problems. It seems that most files will be off-sync by about 100-300ms. At first I thought it was the audio files since they were MP3 VBR from AVI but using AVI-Mux I found that by muxing these AAC files into AVIs instead, the audio is in sync.1) vbr mp3 doesnt cause sync issues normally
2) is the audio desync right from the beginning and stays desync by the same amount troughout the movie OR does the sync become worse during playback?
I will try it with MP4Box once I find a newer build. Mine is 0.1.9 and seems a bit outdated? outdated. always use the latest version of any tool you use
dont ask where to get it :search:
JoeBG
19th February 2005, 12:17
Originally posted by bond
solution: demux your video stream to raw from .avi with the avi2raw tool from mpeg4ip and than remux to .mp4 with mp4creator
This is exactly what mp4muxer does :)
Originally posted by bond
...mp4muxer...) will not create the needed ctts atom.
So this is not true. mp4muxer creates the needed ctts atom. :)
OCedHrt
19th February 2005, 12:45
Hmm..I see that it is up to 0.2.3 now. Thanks :) I have version 1.2 of mpegip tools.
The sync seems to be relatively consistent throughout but it does vary somewhat.
If I use avi2raw to dump out the video data then mp4creator will work with b-frames? I will give that a try when I have some other files to process.
And about mp4muxer, I gave it a try and it does not work for me. It doesn't generate the CompleteVideo.mp4 file, instead I only get the tmp files with the audio and video in seperate files.
I'm not too concerned about the muxing process because I wrote batch files to process them for me :) But it seems like using mp4box has solve the problems for me so I will stick with that for now.
JoeBG
19th February 2005, 12:54
Originally posted by OCedHrt
And about mp4muxer, I gave it a try and it does not work for me. It doesn't generate the CompleteVideo.mp4 file, instead I only get the tmp files with the audio and video in seperate files.
So you found a bug or you didnīt update mpeg4iptools and gpac or you did something wrong.
mp4muxer definitly has no problems with muxing avis and aac or mp4 with aac from Nero Filter.
Can you post the log?
bond
19th February 2005, 13:22
Originally posted by OCedHrt
The sync seems to be relatively consistent throughoutwell this might indicate that there is an audio/video delay set in the .avi (you can check that in virtualdub on the .avi, under video->framerate)
i dunno if mp4box cares about such delays (it might as it seems to work fine for you), but mp4creator doesnt i am pretty sure
if there is such a delay the best would be you encode to aac in besweet and set the delay option to the value you have in your .avi
this will correct the audio stream to be in sync with the video without having to set a delay manually during muxing
of course this only helps if there is a delay between audio and video in the .avi!!!
Originally posted by JoeBG
This is exactly what mp4muxer does :)no need to do that (requires the double hd space as you demux first to raw and than the raw to .mp4) when using mp4box for muxing asp from .avi to .mp4
So this is not true. mp4muxer creates the needed ctts atomif it uses avi2raw to demux to raw with mpeg-4 asp streams than yes
bond
20th February 2005, 00:06
JoeBG, and yes i feel the need to point out the following again, its really important: if avi2raw and mp4creator is used for all avi->mp4 conversions you will not get correct mp4 files when using packed bitstreams in the .avi!
avi2raw has now (starting with version 1.2.6) some codec-specific options to let you get rid of packed bitstream correctly (descibed here (http://forum.doom9.org/showthread.php?s=&threadid=90282)), but its still a big hassle and might not work correctly
mpeg-4 asp in .avi should always be converted to .mp4 with mp4box (or 3ivx)...
OCedHrt
20th February 2005, 05:08
well this might indicate that there is an audio/video delay set in the .avi (you can check that in virtualdub on the .avi, under video->framerate)
Hmm, I don't see any place in there that would mention the audio delay. There very well could be but I don't think there is because when demuxing the audio using VirtualDub it is still out of sync with mp4creator. I think it may have to do with either b-frames or packed bitstream since mp4creator is not compatible with them. Neither of these seem to affect mp4box though. I was setting the delay in virtualdub before dumuxing to fix the sync issues (by truncating 100-300 ms of audio off the front of the stream) but since mp4box does not seem to suffer from it it has made it a lot easier :)
Now it's just demux with avigui->convert to aac with foobar/nero encoder->run them thru my batch file :)
I'm not really making these files to play them on a hardware mp4 player so I'm not too concerned about standards compliance as long as they do play on the computer. (Maybe I'll regret it later when they don't work on the TV XD) I'm mainly using mp4 because of it's lower overhead to try and fit these files (175-220MB x26) on to a 4.38GB DVD.
JoeBG
20th February 2005, 10:00
Originally posted by bond
mpeg-4 asp in .avi should always be converted to .mp4 with mp4box (or 3ivx)...
Would the following work?:
- -convert the avi with mp4 box to mp4
- -extrakt *.m4v with mp4creator
- -c with mp4creator?
Itīs important to get an answer if this woul be ok :)
bond
20th February 2005, 11:25
Originally posted by OCedHrt
Hmm, I don't see any place in there that would mention the audio delay.my fault i mixed something up.
open the original .avi with the audio in virtualdubmod, goto streams->streams list, right click on the audio stream and choose interleaving
if there is a delay between audio and video in the .avi it would be shown under "audio skew correction"
There very well could be but I don't think there is because when demuxing the audio using VirtualDub it is still out of sync with mp4creator.if there is a delay between audio and video this is the expected behaviour
I think it may have to do with either b-frames or packed bitstream since mp4creator is not compatible with them.b-frames dont cause sync issues
also mp4creator can handle b-frames correctly if you know what you have to do
Neither of these seem to affect mp4box though. I was setting the delay in virtualdub before dumuxing to fix the sync issues (by truncating 100-300 ms of audio off the front of the stream) but since mp4box does not seem to suffer from it it has made it a lot easierso you did set a delay between audio and video?
demuxing with virtualdub doesnt keep the delay of course
Originally posted by JoeBG
Would the following work?:
- -convert the avi with mp4 box to mp4
- -extrakt *.m4v with mp4creator
- -c with mp4creator?why do you want to extract the video from mp4box' .mp4 and then reimport to .mp4 with mp4creator? this makes no sense... keep the .mp4 created by mp4box
JoeBG
20th February 2005, 11:50
Originally posted by bond
why do you want to extract the video from mp4box' .mp4 and then reimport to .mp4 with mp4creator? this makes no sense... keep the .mp4 created by mp4box
Because I want to add the video to an existing mp4 with -c from mp4creator. So is it possible this way?:
- -convert the avi with mp4 box to mp4
- -extrakt *.m4v with mp4creator
- -c with mp4creator?
bond
20th February 2005, 11:59
should work correctly
of course, talking about the topic, demuxing to raw will always loose a set delay (other than 0) between audio and video
JoeBG
20th February 2005, 12:12
Originally posted by bond
should work correctly
So next mp4muxer will do that
Originally posted by bond
of course, talking about the topic, demuxing to raw will always loose a set delay (other than 0) between audio and video
So making a video, you have to correct the delay in the soundtool :)
bond
20th February 2005, 12:15
Originally posted by JoeBG
So making a video, you have to correct the delay in the soundtoolindeed, besweet can do that for a long time already :)
additionally you can use 3ivx for muxing, but its far more complicated and not an option for mp4muxer i assume
OCedHrt
21st February 2005, 02:37
I try to correct the delay when demuxing. The audio skew displayed by virtualdub is always 0 because it's for this session only. When you set a delay there it actually pads or truncates the beginning of the audio stream to achieve the skew.
Setting the delay and then demuxing audio does affect the output audio and that was what I was doing with mp4creator to remedy the sync issues. But since mp4box isn't affected by this sync problem I have switched to that for now.
JoeBG: Why would you want to use mp4creator to add to an existing mp4? You can use mp4box to merge 2 mp4's into 1.
bond
21st February 2005, 10:57
Originally posted by OCedHrt
The audio skew displayed by virtualdub is always 0 because it's for this session only.ok, as the audio and video are in sync in the .avi the sync issue is not caused by an audio/video delay set in the .avi
Setting the delay and then demuxing audio does affect the output audioi dont believe that :p
the audio/video delay is stored on the container level, not in the stream, meaning when you demux to raw the delay settings get lost
OCedHrt
21st February 2005, 13:58
I just did a test with VDubMod and I must say that that is not true. The delay is not stored in the container. First I demuxed the file with 0 delay, the output is 24:09 seconds. Then I set a delay of -2500 and the output becomes 24:07 seconds.
Then, setting the options to direct stream copy for video and audio, and with the delay set to -2500, I create a new avi and open the new one. The delay is back to 0.
I don't think the avi container is capable of delay information and even if it was, I don't think any splitter/codec honors that information. The same as with embedded ARs.
-----
I just did a test with VirtualDub and noticed that it keeps the entered delay until you restart the program. But once it's restarted it is also reset back to 0. So definitely this delay information is not stored in the AVI.
I will try to do some more tests with mp4creator and mp4box tomorrow to make sure that mp4creator is suffering from this sync issue.
bond
21st February 2005, 14:55
ok i stand corrected, the flea in my ear tells me virtualdub(mod) does some ugly stuff when dealing with delays in .avi:
it either cuts away parts of the audio stream or it adds zeros at the beginning
the first case should be ok, the second one is borky as the zero garbage is of course not valid mp3, ac3 or whatever other audio format was used data
all in all i can only say correct the delay already in besweet before dealing with garbage containing .avi files :)
OCedHrt
22nd February 2005, 00:23
Right, but I don't know what the delay is since I didn't make these files :P Plus, when demuxed the delay is carried over and mp4box seems to handle it correctly.
mp4creator doesn't handle it regardless of what I do with the stream afterwards. I have tried to keep the original mp3, converted it to aac, etc and the sync is still off.
----
After some testing, only negative delay values are carried into the demuxing. When padding it does indeed pad with 0's but this doesn't affect the demuxing until you have re-made the avi with this delay value. And, because delayed audio were padded with 0, I know my files weren't delayed because they weren't padded with 0s. But the audio was definitely behind in all mp4creator created mp4 files.
bond
22nd February 2005, 00:31
than again there might be a framerate problem. what framerate do you use? mp4creator seems to round NTSC a little bit
OCedHrt
22nd February 2005, 04:52
Hm..that might just be it :D
23.976 -> 23.98 is about 240ms over 24 minutes. But the skew doesn't seem to be gradual over time though.
bond
22nd February 2005, 10:26
Originally posted by OCedHrt
23.976 -> 23.98 is about 240ms over 24 minutes. But the skew doesn't seem to be gradual over time thoughtell the mp4creator dev your findings about the sync issue with ntsc here:
http://sourceforge.net/forum/forum.php?thread_id=1229195&forum_id=59136
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.