| |||||||
| Commercial message | |
| | |
| Video Edit Software Find out the best video edit software, learn about video edit magic and movie authoring. Discuss MPEG-4 and Super Video CD editing and authoring. |
![]() |
| | Thread Tools |
| | #1 (permalink) |
| New on Forum Join Date: Feb 2006
Posts: 2
| Fixing A/V sync problems in mpg with freeware Very often, when recording TV or other video, the audio and video get progressively out of sync. This is a way to fix the sync quite accurately and relatively easily (it uses a batch file to make things simple) using only freeware programs. It is based on http://club.cdfreaks.com/showthread.php?t=59487 which suggests stretching the audio sampling rate a small amount (for instance 44100 to 44116) in order to resync. The actual steps exactly match the RESYNC.bat lines listed below 1) Delete previous work files 2) Demux the video from the mpg 3) Demux the audio from the mpg 4) Convert the audio from mp2 to wav 5) Stretch the wav by changing the sampling rate 6) Convert the new wav to mp2 7) Remux the video and new mp2 into a synced mpg To set up the resync... 1) Calculate the AdjustedSamplingRate. You can download the shareware program VideoRedo (which I highly recommend purchasing) at www.videoredo.com . Open a video of at least 90 minutes. Go to Tools\Adjust Audio Synchronization\ which can adjust audio sync off by a fixed (not progressive) amount. Now go somewhere near the end of the video where you can see the lips move. Change the 'AudioSyncAdjustment' so the audio and video exactly match (if over 1000 ms, go to an earlier part of the video). Read how many seconds (Msec/1000; negative if audio leads video) this AudioSyncAdjustment is. Also read how many seconds this is into the video (SecIntoVideo = hr x3600 + min x60 + sec). Plug these into the formula AdjustedSamplingRate = (SecIntoVideo + AudioSyncAdjustment)/(SecIntoVideo) * 44100 What I have found is that this new sampling rate is constant, at least for my computer, so it doesn't have to be constantly recalculated. For me, the AdjustedSamplingRate is 44116. 2) Using a text editor, create the file RESYNC.bat with the following text. Del E:\E.mpv, E:\E.mpa, E:\E.wav, E:\E16.wav, E:\E2.wav, E:\E2.mp2 C:\Video\Mpgdemux\Mpgdemux.exe -d -s 0xe0 E:\E.mpg E:\E.mpv C:\Video\Mpgdemux\Mpgdemux.exe -d -s 0xc0-0xdf -b E:\E.mpa E:\E.mpg C:\Video\MP3Decode\Mp3Decode.exe E:\E.mpa C:\Video\Audacity\audacity.exe E:\E.wav C:\Video\TooLame\toolame.exe -b 224 E:\E2.wav E:\E2.mp2 C:\Video\Mplex1\mplex1.exe E:\E.mpv E:\E2.mp2 E:\E2.mpg NOTE: If you put the programs somewhere beside C:\Video\ , or the work files are somewhere beside E:\ , just change RESYNC.bat to point to the correct location 3) Download and install the following freeware programs in folders in C:\Video\ Mpgdemux http://www.hampa.ch/mpegdemux/ MP3Decode http://www.etalonsoft.com/mp3decode.html Audacity http://audacity.sourceforge.net/ TooLame http://sourceforge.net/projects/toolame Mplex1 http://members.aon.at/johann.langhofer/mplex1.htm (Tmpgenc is not used because the mp2 conversion expires, and you must buy it) 4) Open Audacity and go to Edit\Preferences\File Format\. Insure the 'Uncompressed File Format' is 'WAV(Microsoft 16 bit PCM)'. Be sure that the file format stays this. That completes the setup. To use... NOTE: Do not edit sections from the mpg until the resync is completed. 1) Copy the mpg that needs resyncing to drive E. Rename it E.mpg. 2) Run RESYNC.bat. At first, you will see a DOS box and two lines, but no action for maybe 3 minutes. Be patient. 3) In a little while, Audacity will come up and load E.wav. Once it's loaded... 4) There will be an area to the left of the waveform with a triangle pointing downward. Click the triangle, Go down to 'Set rate', and then 'Other...'. 5) Change the 44100 to 44116 or whatever your AdjustedSamplingRate found above is. Click OK. Immediately below the down triangle should now say 'Stereo,44116,16-bit' 6) Click on File\Export as Wav\ . Change the filename to E2.wav and click 'Save'. 7) After exporting is completed, close Audacity and click 'No' to 'Save changes' 8) There will be additional processing, and eventually the DOS box will close. 9) Go to E:\E2.mpg and rename to whatever. This is your resynced file ready to play. All this is much easier to do than say. And it really fixes the sync problem quite well. |
| | |
| | #2 (permalink) |
| CD Freaks Junior Member Join Date: Apr 2004 Location: Smithville, OH
Posts: 87
| Re: Fixing A/V sync problems in mpg with freeware I'm having problems with this... I can get the audio out, that's not a problem, I can stretch it to the length I need it, but the result is a mpg file that can't be played by any of my video players (Winamp, WMP 10, divx player, a few others, I can't remember them all). The problem seems to be in the video portion of the demuxing or multiplexing, I can play the audio streams at all points in the process except for the final mpg (e.mpg plays audio and video, e.mpa plays, e.wav plays, e2.wav plays). I am taking 48000hz and converting it to 47955, my video trails my audio by 9/10ths of a second after 16 minutes. That all seems fine, as I can play the original demuxed audio file and the output m2.wav, and the audio now seems to be in the right place, I just can't compare it to the video because when I multiplex it, it produces a worthless file. I'm doing 48000hz because my TV capture program powerVCRII automatically captures at 48000hz in 224kbps. Any suggestions would be greatly appreciated.
__________________ My Systems "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook |
| | |
| | #3 (permalink) |
| CD Freaks Junior Member Join Date: Apr 2004 Location: Smithville, OH
Posts: 87
| Re: Fixing A/V sync problems in mpg with freeware I sorta fixed the problem, I'm just demuxing the audio stream and following the audio portion of the guide, then using TMPGenc to import the adjusted audio stream back into the original MPG file. Thanks for the write-up, it's helped me a ton!
__________________ My Systems "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook |
| | |
| | #4 (permalink) |
| CDFreaks Resident Join Date: Aug 2004 Location: @FX labs .de ...watching [Benders.Big.Score] [Tripping.The.Rift.The.Movie]
Posts: 23,824
| Re: Fixing A/V sync problems in mpg with freeware I dunno, this is so old. I did it approx. hundred times already. info: videohelp.com
__________________ Started with burning capable optical drives (CD-R) in 1997. Bought optical drives from AOpen, HP, LiteOn, NEC, Philips, Pioneer, Plextor, Ricoh, Samsung, Sanyo, Toshiba and Yamaha. 'Things are now in motion that cannot be undone.' [Gandalf, LoTR] Enable DMA with micrAp$0ft Enable DMA free at your will busTRACE => Upper/Lower Filters Util DevCon ***HOW TO ... Delete the Upper & Lower Filters!*** If you expect help then please start by using the powerful SEARCH. |
| | |
| | #5 (permalink) |
| New on Forum Join Date: Feb 2006
Posts: 2
| Re: Fixing A/V sync problems in mpg with freeware I just found a substantial improvement in the original method Instead of using Audacity to change the sampling rate, download the freeware Shibatch Sampling Rate Converter http://shibatch.sourceforge.net/ Unpack and copy ssrc.exe to C:\Video\ssrc\ Now in resync.bat, instead of C:\Video\Audacity\audacity.exe E:\E.wav type C:\Video\ssrc\ssrc.exe --rate 44116 E:\E.wav E:\E2.wav (Note: That is space, two minus signs, 'rate', and whatever your AdjustedSamplingRate is) This eliminates steps 3 to 7, making the batch file run totally automatically! Optionally, instead of 44116 or whatever, you can put %1. Then, you would run "resync.bat 44116" |
| | |
| |
| |
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Any tips on fixing audio sync problems on FLV -> DVD MPEG? | Pelvis Popcan | Video Edit Software | 7 | 28-05-2007 09:00 |
| MPEG Video Wizard - fixing out of sync files | qprfact | DVD+RW Video Recorders | 8 | 19-12-2005 18:44 |
| help fixing A/V sync on avi file? | eli | Video Edit Software | 3 | 22-09-2003 12:01 |
| How to fix A/V sync problems in MPG files | ChickenMan | Guides and Tutorials | 0 | 03-12-2002 02:58 |
| Heel handig mpg, avi player (freeware) | SoulShower | Dutch: De Woonkamer | 3 | 17-12-2001 18:06 |