Certain VBR audio causes me trouble

Discussion in 'MPEG-1 and MPEG-2 encoding (AVI to DVD)' started by HinoTori, Aug 30, 2005.

  1. HinoTori

    HinoTori Member

    Joined:
    Aug 29, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    11
    I've been having difficulty at encoding the audio on certain avi files. Mind you, the programs I use can deal with VBR in most avi files, but not all of them. Normally I use BeSweet with VOBInput.dll to decode VBR audio from an avi file and it works like a charm.

    With the problem files, using BeSweet to extract the audio, it creates a 0 byte mp2 file. The program ends abruptly without any completion OR error message in the log.

    If I use virtualdubMod to extract the wav file, it ends up desyched from the video. The end of the video is more badly desynched than the beginning so I can't simply time shift the audio to make it work.

    Using GSpot I hunted for some apparent difference between "good" VBR and "bad" VBR and I found one consistent difference. For a good VBR GSpot says that the birate is "121 kb/s (60/ch x 2 ch) VBR LAME3.92", while for a bad VBR it says the bitrate is "117 kb/s (58/ch x 2 ch) VBR". Obviously the exact numbers change based on the file, but bad VBR always lacks the "LAME3.92" notation.

    Can anyone figure out the difference in these files or why I am having problems?
     
  2. aldaco12

    aldaco12 Active member

    Joined:
    Nov 6, 2002
    Messages:
    2,544
    Likes Received:
    0
    Trophy Points:
    66
    First, extract an uncompressed WAV (with what you prefer: VirtualDubMod, VirtualDub). Just take care: tha 'WAV' must be 10.1 MB x length (in minutes) long. If it is not so, you either don't have a decompressor (it usually happens with AC3, not MP3), or you have a corrupt audio stream an the AVI (Of course, in VirtualDub set Audio__Full Processing Mode and File___Save WAV, on VirtualDubMod do 'Stream ___ Stream List___Save WAV').

    If the WAV is a 'true WAV' (just open it with EAC, for example. It will give an error if it isn't so) it can be out-of-sync only of a constant amount, which you can fix putting a delay (both BeSweet and HeadAC3he allow it).
    If the WAV is NOT a 'true WAV' the problem is BIG, but let's speak about it only if it is so. First, try to convert the audio into a 'true WAV', and if it is so, encode it to what you want (MP2 if you're making a (S)VCD, WAV id you're making a DVD) putting 'by ear' the needed delay, so that the 'audio2.WAV' file is in-sync with the video (you can do this check easily by adding a MP3 CBR version of that stream with VirtualDubMod, or making a VCD movie [the quickest] (using the AVI as 'video input' and the WAV as 'audio input' with TMPGenc, keeping 'motion search precision = very fast (low quality)').
     
    Last edited: Aug 30, 2005
  3. HinoTori

    HinoTori Member

    Joined:
    Aug 29, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    11

    Extracted the WAV with VirtualDub, using audio full process mode. The size was a bit larger than you suggested. Length was 10.9MB x minutes (instead of 10.1MB).

    Then I opened it with EAB to check it as you suggested. BANG! Big Trouble! It says [bold]"The selected WAV file is no standard WAV ! EAC processes only uncompressed 4.1 kHz stereo WAVs !"[/bold]

    Please, let's talk about it! It has the expected length and plays just fine using either WinAmp, TCMP or MPC. MPC tells me it is "Audio: PCM 48000Hz stereo 1536Kbps".

    Clearly though, there is a problem I do not understand. How do I make it into a 'true WAV'?
     
  4. aldaco12

    aldaco12 Active member

    Joined:
    Nov 6, 2002
    Messages:
    2,544
    Likes Received:
    0
    Trophy Points:
    66
    NOW we have a trouble.

    First, we must get a 'true WAV' audio stream. And , if needed, fixing its sync with the video.

    Once you manage to obtain a 'in sync' WAV, you can either use it as TMPGenc's 'audio input' or compress (with HeadAC3he) to MP3 CBR and sustitute in in the AVI, with VitrtualDubMod.

    To compress the WAV to CBR MP3, once you have a 'true WAV', you just have to open the WAV with HeadAC3he. Compress it into CBR MP3 (Choose destination Forumat = MP3 and click 'optiond' until you can select 'Preset = Alt CBR' and Mode = CBR. Bitrate = 128 kbps is enough. You can also resemple the stream to 44.1 kHz, if it appears 48 kHz, when you load it, but I don't think it'll be 48 kHz. The 'wrong framerate: 48 not 44.1 kHz' could be just caused by the corruption.
    Once you've a 'true' uncompress WAV, look below the WAV name with HeadAC3he, now. Under the fie name you should see the 'stream info'...

    As soon yo have the CBR MP3 open the AVI with VirtualDubMod. Do Stream___Stream List, Disable the old audio stream, load the new CBR MP3 you just made.
    Set video__direct Stream copy and Save (F7).
    Just few minutes.

    The first thing you can try is: Open The movie with VirtualDub. Do File__Save (save it DEMUXED.WAV, since Audio, by default, is set at Direct Stream Copy).
    Rename DEMUXED.WAV into DEMUXED.MP3.
    Open DEMUXED.MP3 with EAC. If, with Tools___Decompress, it can decompress it to WAV, you're done.

    Another test you can do it 'Dragging and dropping' Demux.MP3 to BeSlice and open the 'Fixed' MP3 with EAC (as above).

    Otherwise, if no way I explained works, the only '100% working' way I know to fix it is to make a 'true WAV' manually'. To get a 'true WAV' , you can load the AVI with TMPGenc. Make a 'Dummy VCD MPEG-1' movie with 'Motion Search Precision = Highest Speed (very fast)'. The movie will be out-of-sync, but at least you can extrct a 'True WAV' file from it with VirtualDub.

    Once you have a 'true WAV' audio file, if you still have A/V sync problems, run EAC and do Tools__Process WAV opening the 'true WAV' you made.
    Now, 'by ear' you must do Edit__Insert Silence or Edit__Cut in the WAV until the WAV is in-sync with the AVI video.
    Then use it (compressed to CBR MP3) in the AVI ot use it as 'TMPGenc's 'audio input' to make a MPG. But checking the perfect A/V sync in a new AVI built with VirtualDubMod (made in the way I've written above) is suggested.

    The main problem is fixing 'by ear' ALL the WAV audio stream with the video.

    I hope you have lot of free time and the movie is not too long. This is, at least, the only way I know to recover a corruped file. This doen't happen often...
     
    Last edited: Aug 31, 2005
  5. HinoTori

    HinoTori Member

    Joined:
    Aug 29, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    11
    Holy mother of God and all her wacky nephews!!

    That is certainly a non-trivial solution. I've managed to make a true WAV by running it through TMPGEnc like you suggested. That was the easy part. It is desynched, but at least the desych is a constant quantity now.

    Now I'm using EAC to add silence to the beginning in hopes of synchronizing it with the video. (Using virtualdubmod to add the new WAV and playing it to test the results.) EAC takes ages to process a WAV. Isn't there a quicker way to do this? I'm just shocked at how long it takes to add a few fractions of a second to the sound.

    Shouldn't there be a easier or faster way to fix the synchronization?
     
  6. aldaco12

    aldaco12 Active member

    Joined:
    Nov 6, 2002
    Messages:
    2,544
    Likes Received:
    0
    Trophy Points:
    66
    If the delay is constant, you can add a constant delay (with the precision of 1 ms!) when you compress the WAV,using HeadAC3he.
    The problem can be that the delay can be spread in the file, and won't fized by simpy adding e.g. +300 ms to the file.

    I would suggest doing this, first:

    1) Open that AVI with VirtualDub. Do file___Save WAV and, since Audio has been lest at Direct Stream Copy, will extract a fake WAV.

    If you open the AVI with Gspot, probably it will tell you which audio codec has been used; if it is the Fraunhofer MPEG Layer 3 codec you're fine: simply rename that 'audio.WAV' you demuxed as 'audio.MP3'.

    Open that MP3 with EAC, I hope it'll be able to open (Tools__Uncompress) it. Make a WAV file and compress MP3 CBR as I explained. Than substitute the 'bad' audio stream in your AVI with the one you made, ad I explained (VirtualDubMod Video__Direct Stream Copy ; Stream ____ Stream List ----> Disable (the old audio stream) and add (the new one). Press F7 to save the new AVI.

    And pray that the AVI has A/V sync. Otherwise: edit the WAV manually with EAC and work HARD.
     
    Last edited: Aug 31, 2005
  7. HinoTori

    HinoTori Member

    Joined:
    Aug 29, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    11
    I'm in hell. I was mistaken about it having a constant delay. The whole thing is messed up which leaves me editing with EAC.

    I am extremely puzzled about how the video could play flawlessly on my computer as an avi when it cannot be converted. Can you (or someone else) fill me in on how such a bad audio track can play properly?

    Even more confusingly, if it is capable of playing, why can't it be fixed? I'm sure this must be a way, though perhaps the necessary program just hasn't been written by anyone.
     
  8. aldaco12

    aldaco12 Active member

    Joined:
    Nov 6, 2002
    Messages:
    2,544
    Likes Received:
    0
    Trophy Points:
    66
    I con't know how to do it. I only know that, in order to extract a 'true WAV' you must convert AVI -> MPG and then you can uncompress the MP2 audio stream, but the audio has altrady turned out-of-sync.
    If you find how to fix an audio (I've heard of BeSlice, but I didn't had a full success. You can try. The main problem is: extracting the audio stream without manipulating the video, and I haven't found yet).

    The only thing I can suggest you is to find a .SRT subtitle to put in-sync with the AVI (before the audio manipulation + extraction) and to use the .SRT file to find exacltly at which time every word lies. Ater that, one can listen to the out-of-sync WAV with EAC finding 'by ear' the position of each speech, so finding exactly the delay one as to nsert in the WAV is easier...
     
  9. HinoTori

    HinoTori Member

    Joined:
    Aug 29, 2005
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    11
    I got it! This isn't perfect, but I found a reasonable way to get the audio VERY close without killing myself. Thank you for mentioning BeSliced, it was helpful.

    1. Use VirtualdubMod to demux the audio stream as an mp3. Normally it is considered proper to convert it to a WAV, but since the WAV was messed up, I decided to see what would happen if I simply extracted the mp3 intact from the avi without editing it.

    2. Run the mp3 through BeSliced. (That's the GUI front-end for BeSplit.) It fixes some things.

    3. Run the fixed mp3 through BeSweet to turn it into a mp2.
    "C:\Program Files\DVD2SVCD\besweet\besweet.exe" -core( -input "F:\directory\audiofile.mp3" -output "F:\directory\audiofile.mp2" -logfilea "C:\Program Files\DVD2SVCD\besweet\BeSweet.log" ) -ssrc( --rate 48000 ) -toolame( -m s -b 160 )

    4. Encode the avi into an m2v using the encoder of your choice. TMPGEnc will do it (ES - Video only), but I prefer using CCE.

    5. If you want to combine audio and video, use mplex.
    "C:\Program Files\DVD2SVCD\dvdauthor\mplex.exe" -f 8 -o "F:\directory\file.mpg" "F:\directory\videofile.m2v" "F:\directory\audiofile.mp2"

    Voila! It works. Or at least close enough to satisfy me.
     
    Last edited: Sep 1, 2005
  10. aldaco12

    aldaco12 Active member

    Joined:
    Nov 6, 2002
    Messages:
    2,544
    Likes Received:
    0
    Trophy Points:
    66
  11. macielcri

    macielcri Member

    Joined:
    Oct 6, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    11
    Hi!

    Sorry for my poor English.

    Step 1:
    Download and run "NanDub" (it´s a variation of VirtualDub)

    File > Open video file > Save WAV

    Step 2:
    Download and install "dBpowerAMP Music Converter"

    Right-click on the WAV file you saved: Convert to > (choose "Wave") > Convert

    Step 3: (if you will create a VCD or SVCD)
    Download and run "TMPGEnc"

    Video File (Browse) - select the AVI file

    Audio File (Browse) - select the WAV file you have converted


    In my opinion that process works perfectly.

    Hugs from Brasil,

    Maciel
     

Share This Page