VideoHelp Forum




+ Reply to Thread
Results 1 to 8 of 8
  1. i tried to mux 2 streams

    one video and other mp3...........

    the problem i get is initailly both video and audio play fine then video stops and audio plays fine .....video plays in small parts while audio is continuous ....after audio finishes the video plays continously ..........

    where cud be the problema nd wot cud the problem how can i rectify it ...............it works fine if i make a avi of video stream first and then add the audio stream through virtual dub

    some bodyyyy help me
    all thats awesome is awkward
    Quote Quote  
  2. Hi-

    it works fine if i make a avi of video stream first and then add the audio stream through virtual dub

    But that's what muxing is-adding one stream to another. So I don't really understand your problem. Maybe if you describe the process that lead to the problem, someone can help.

    However, I'll make a guess. You were adding the audio to the video as the video was being encoded? And that's what lead to the problem? Is the MP3 VBR? And were you using Virtual Dub for this? Because VDub doesn't properly support VBR MP3. So you should probably use VDubMod for the process. Just a guess, though.
    Quote Quote  
  3. iam sorry as i wasnt clear

    i have peice of code which does this muxing its just a set of the functions
    AVIFileOpen,AVIFileCreateStream, AVIStreamSetFormat and AVIStreamWrite which are defined in vfw.h

    whic works pretty fine with ogg vorbis .........whereas in the case of muxing with mp3 there are 4 more feilds which need to be filled theMPEGLAYER3WAVEFORMAT struct apart from the normal WAVEFORMATEX
    wID=1;
    fdwFlags=2;
    BlockSize=576;//AS I USE AUDIO OF 8KHZ nFramesPerBlock=1;
    nCodecDelay=0;
    i filled those feilds as mentioned above

    AND THEN FOLLOWED each frame of audio with one frame of video

    when i try to do with this peice of code then it gives me the problem that i mentioned .....if any other clarifiaction is required regarding the question please mention

    thank u
    all thats awesome is awkward
    Quote Quote  
  4. Sorry. I won't be much good to you, as I haven't the foggiest notion of what you're talking about. Maybe someone else can help.
    Quote Quote  
  5. well anyway i have found away out

    the problem was due the field dwrate in the AVISTREAMINFO struct

    when the audiorate was 16000 .it gave me breaks in video and when it was just 120 the video used to play fast in parts where there used to be break .....................


    can any body give me some explanationas to how its value should be calculated and it wot units is this value...........i eman (milliseconds or microseconds)

    this is wot i read
    dwscale:-"Used with dwRate to specify the time scale that this stream will use. Dividing dwRate by dwScale gives the number of samples per second. For video streams, this is the frame rate. For audio streams, this rate corresponds to the time needed to play nBlockAlign bytes of audio, which for PCM audio is the just the sample rate."

    is there any exact way that we can calculate this value so that the sync between audio and video are also maintained
    all thats awesome is awkward
    Quote Quote  
  6. Originally Posted by awkawe
    well anyway i have found away out

    the problem was due the field dwrate in the AVISTREAMINFO struct

    when the audiorate was 16000 .it gave me breaks in video and when it was just 120 the video used to play fast in parts where there used to be break .....................


    can any body give me some explanationas to how its value should be calculated and it wot units is this value...........i eman (milliseconds or microseconds)

    this is wot i read
    dwscale:-"Used with dwRate to specify the time scale that this stream will use. Dividing dwRate by dwScale gives the number of samples per second. For video streams, this is the frame rate. For audio streams, this rate corresponds to the time needed to play nBlockAlign bytes of audio, which for PCM audio is the just the sample rate."

    is there any exact way that we can calculate this value so that the sync between audio and video are also maintained
    VFW uses a pair of numbers to specify frame and sample rates because some rates can't be perfectly represented by one number. For example 1/3 frame per second video would display each frame for 333333.333333... microseconds.

    As the docs state, for PCM audio you just set the values to any pair that gives you the correct sampling rate. Assuming 44100 samples/sec you could set dwRate to 44100 and dwScale to 1, or you could set dwRate to 441000 and dwScale to 10, or you could set dwRate to 88200 and dwScale to 2. Any pair that gives you the correct ratio is fine.

    I'm not sure what happens when you use MP3 audio though. Given how so many programs have problems with variable bitrate MP3, I supect that you set the pair to reflect the average bitrate of the MP3 audio, not the actual sampling rate.
    Quote Quote  
  7. well thanx .............

    the thing that I read meant that i need to give the time required to play nblockalign bytes of audio data..............ie the ratio of dwscale /dwrate gives the time required to play nblockalign of audio data ...that is wot i understood but in case of VBR mp3 how do we calculate it ?

    i hope somebody will surely help me out

    thanx
    all thats awesome is awkward
    Quote Quote  
  8. This AVI file structure viewer might help you out:

    http://www.thozie.de/avimaster/

    Looking at a few AVI files with MP3 audio, the dwScale and dwRate values appear to reflect the underlying digital audio, not the compressed mp3 data.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!