Re: AVIStream mp3 stream - stream size?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



From: "dominolog"

You don't really deserve an aswer because of the abusive
multipost...

I have created an output AVI file with
AVIOpen/AVICreateStream. This is a video stream encoded
with selectable codec (XVID). Then i create an output
audio stream, configure it to be MPEGLAYER3WAVEFORMAT
format. Then I open a mp3 file, read chunk by chunk and
write it to the audio stream. The problems are: - I have
to synchornize video and audio stream - the video and
audio streams have to have the same time length. How to
get the
output audio stream time? The AVIStreamLengthTime
function seems to be returnig not correct values (not the
stream time value). What do I have to do?

If the MP3 stream is VBR, then there is no way to correctly
guess its duration unless the bitrate in the stream header
is set to the average bitrate, which is not always the case.
AVI does *not* properly support VBR audio streams and
AVIFile does not know how to handle them, which means you
have to do your own magic (a.k.a. parse the MP3 stream) to
properly handle VBR MP3 via AVIFile.

- Second issue is the output movie seems to have problem
with video synchronization - the video plays but with
some "hoops" - the movie plays for 3-5s and then stops
for 1-2s. If I dont create the audio stream in output
movie, the video stream plays correct.

This may be caused by incorrectly muxing the VBR MP3 stream
so that the latency between audio and video frames may grow
beyond the tolerance of the playback system. When you mux
VBR streams, you have to take care to interleave an audio
frame very close to the corresponding video frame, because
the AVIFile systems does not know how to properly interleave
VBR audio streams.

--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm




.



Relevant Pages

  • Re: Digital Signage, Multimedia Steaming etc.
    ... A full featured video editing software is a major undertaking imo. ... However if you need to stream different video streams to each client, ... simultanious clients is no small task. ... 4.There will be 5-10 distribution servers. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Stream DVDs with full dolby digital from vob files possible? (extenders?)
    ... stream to some device.. ... DVD or more than 60 hours of HD video from your camera. ... when i switch to the tv in the livingroom, ... if i were stuck using a keyboard out in the living ...
    (alt.video.dvd)
  • Re: Skywise
    ... But the bird was on cue ... I found out what kind of bird's on the video. ... there was so much salmon that they could cross the ... the upper reaches of the main stream is a step in the right direction. ...
    (sci.geo.geology)
  • Re: Back again
    ... As for your other questions, as I said, the video will play just ... I have a valid internet connection. ... I just can't stream it. ... See http://zachd.com/pss/pss.html for some helpful WMP info. ...
    (microsoft.public.windowsmedia.player)
  • Re: Skywise
    ... That last one is very funny to hear coming from a bird. ... Keep up the good work with the video. ... there was so much salmon that they could cross the stream on ... reaches of the main stream is a step in the right direction. ...
    (sci.geo.geology)