Log in

View Full Version : MP4Creator a/v sync probs


Chibi Jasmin
22nd April 2002, 23:33
I today made an XVID-AVI (625 MB) and an AAC-Audiofile (72,5 MB) from a whole movie.

Both play fine, when muxing alone in wmp4player, audio even in RealOnePlayer/Envivio.

The movie is 1:39:06 long.

Audio-file only, RealOne shows exactly that duration and plays fine (WMP4Player has no time stamp output).

Audio+Video muxed: WMP4Player plays movie, but audio is heavily off-sync. If opened in RealOne/Envivio it doesn't show the video, but it plays audio and shows a time of 1:43:18...something fishy here.

With MP4Creator I tried lots of combinations of rate, optimize, hint and interleave and order of muxing and whatever always with the same result. Anyone can help?

Chibi Jasmin
23rd April 2002, 20:48
I narrowed it down a bit...it is the audio that is actually 1:43:18 long after encoding with Psytel AACENC....playing with WinAmp Plugin (showing time remaining) shows correct length from the beginning and then when reaching 0.00 starts to count up again....so there must be some info in the file it is 1:39:06 but actually it isn't...I tried with -streaming and with -streaming profile 2 both times same result...input wav was 16 bit int and was correct.

Anyone knows of any related bug in AACENC V2.15?

Chibi Jasmin
23rd April 2002, 20:54
Carried it over to Audio forum, please answer here:

http://forum.doom9.org/showthread.php?s=&threadid=23817

Shayne
23rd April 2002, 23:08
I also have mux vid and audio xvid and aac of the matrix and this has major audio syn probs but both play fine independant and together. The full screen in the player doesnt work for me either 200 percent max. I figure its new technology and as doom has metioned if you want lots of headaches and failures try it. I mux it 4 times before getting anything together without errors.

Chibi Jasmin
24th April 2002, 09:36
yeah, well, found it a problem in aacenc this time...as mentioned above...still trying to find out what this bug producing too long audio-out is about...that was I was trying to explain...the output aac of aacenc was actually longer in duration than the input wav....that's why I moved it to the audio-forum.

Chibi Jasmin
24th April 2002, 12:14
forget it :-) The problem must be in the winamp plugin (Faad)...and not in the audio file.. had the same problem with a faac encoded file....sorry for confusion, but my problem must then be somewhere in the muxing process as I originally thought, so forget the above mentioned audio thread, maybe one can help with the muxing or whatever...still experimenting...

Chibi Jasmin
24th April 2002, 13:22
more...


Video muxed alone also shows 1:43:18 in realone, which is too long...

When video frame rate is changed to 25 fps, mp4creator muxes to correct length (for 25 fps, not for original 23.976 fps).

So there seems to be a problem with mp4creator muxing 23.976 fps files, the rate parameter is also ignored on these files, it always muxes a too long video (must have to low fps), and always the same, no matter, what you set rate to...

mp4getfps shows fps of 23.000256 in final mp4

also 24 fps muxes fine into 24 fps mp4...

but 23.976 always ends up as 23.000256...i'd call it a bug in mp4creator.

Chibi Jasmin
24th April 2002, 14:33
Anyone has any other versions of mp4creator I could try? For example one compiled with VS.NET or simply an older build?

I have the one in the mpg4-package dated 18-04-02 on RareWares. It shows versions 0.9.3.8 and is compiled with VS6.

ChristianHJW
24th April 2002, 23:02
Chibi, thanks for clarifying things about MPEG2 AAC and MPEG4 AAC over at hydrogenaudio .. i really appreciate your work here.

If i only had more time i would start to look into MPEG4 more deeply ...

Chibi Jasmin
25th April 2002, 11:34
Glad you like my sometimes confusing and longs posts, always answering myself :-)

The thread at hydrogenaudio about mpeg-2 aac compliance to mpeg-4 is really interesting...but did it get clear? Somehow it did...I will use mpeg-4 headers, just to be sure...

It's hard anyway to exactly know, is xvid compliant, is the player compliant is the muxer compliant...and if something fails.....is there a bug somewhere? Is something not implemented yet? Or not compliant? I had a lot more failures with mp4 than usable results, but things will change, I am sure...I'm still waiting for some approved cd/dvd-format so I would know how to layout the mp4 file on a cd to be compliant to whatever future-player, but it's too early I think...

Chibi Jasmin
25th April 2002, 12:27
found this is the sources in avi.cpp (mpeg4ip v0.9.3):

#ifdef _WIN32
MP4Duration mp4FrameDuration;
mp4FrameDuration = (MP4Duration)((int64_t)(mp4TimeScale));
mp4FrameDuration /= (int64_t)frameRate;
#else
MP4Duration mp4FrameDuration = (MP4Duration)(mp4TimeScale / frameRate);

Seems they're rounding the frame rate of avis to integer on windows systems? I'm am no coder or anything and didn't look any further...there must be a reason for this...well, anyway, probably best to wait for a new release, I don't get this compiled on vs.net anyway...it's probably works on vs6.0, but I don't have that installed...you have to export a makefile and that option doesn't exist any longer in vs.net...didn't understand the help how to deal with it... :-) That's all not my cup of tea...

But if it's true, the numbers back it up.

AVI-Frame Rate -> MP4 Frame Rate

24 -> 24
25 -> 25
29.97 -> 29.004189 :-(
23.976 -> 23.000256
23.980 -> 23.000256 (same as with 23.976, there must be some rounding of the input frame rate!?) Well, I will probably not be able to correct that, I don't have the time nor motivation to even look into compiling this thing with vs.net...

Chibi Jasmin
27th April 2002, 23:33
Part of the following is already mentioned above. It is meant as a kind of summary:

MP4Creator (tested V0.9.3 and V0.9.3.8) showed the problem that a non-integer frame rate in avi-files (for example 23.976) got rounded to integer in the final mp4-file.

This seemed to happen on purpose and only on Win32-systems, see these lines from avi.cpp (from V0.9.3 sources):

#ifdef _WIN32
MP4Duration mp4FrameDuration;
mp4FrameDuration = (MP4Duration)((int64_t)(mp4TimeScale));
mp4FrameDuration /= (int64_t)frameRate;
#else
MP4Duration mp4FrameDuration = (MP4Duration)(mp4TimeScale / frameRate);
#endif

Although I don't know the reason for this rounding on Win32, I changed the code to do the same on win32 as on other systems (no rounding):

#ifdef _WIN32
MP4Duration mp4FrameDuration = (MP4Duration)(mp4TimeScale / frameRate);
#else
MP4Duration mp4FrameDuration = (MP4Duration)(mp4TimeScale / frameRate);
#endif

Compiled with VS.NET the resulting MP4Creator V0.9.3 does not show the rounding-problem anymore (fps comes close to exact (not perfect), this is probably due to the nature of duration things in mp4 (or is this the problem, why there was rounding originally, but rounded output is also not exactly integer!?), but it's still strange integer fps-input comes out perfectly.). Resulting files seem to work fine in WMP4Player. Problem solved? Not sure, there must have been a reason for this rounding on Win32...