Converting Video Files - Keeping Audio In Sync? - AVS Forum
Forum Jump: 
 
Thread Tools
post #1 of 13 Old 12-21-2008, 11:04 AM - Thread Starter
Member
 
IBNobody's Avatar
 
Join Date: May 2007
Posts: 186
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
If I am converting a video file (using any number of suites, currently VirtualDub), what's the best way to keep the audio in sync with the video?
IBNobody is offline  
Sponsored Links
Advertisement
 
post #2 of 13 Old 12-21-2008, 02:41 PM
Advanced Member
 
jhue's Avatar
 
Join Date: Sep 2000
Location: Silicon Valley
Posts: 720
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by IBNobody View Post

If I am converting a video file (using any number of suites, currently VirtualDub), what's the best way to keep the audio in sync with the video?

You need to be WAY more specific. There are so many combinations of source media, codecs, filters, muxers, container formats, etc that it's pretty much impossible to offer a solution that's guaranteed to fix your problem, or even be suitable to the particular conversion you're performing.

Describe the specific problem you're having - tell us everything - and maybe someone can provide a useful response.
jhue is offline  
post #3 of 13 Old 12-22-2008, 04:49 PM - Thread Starter
Member
 
IBNobody's Avatar
 
Join Date: May 2007
Posts: 186
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
I can elaborate more, but to put it simply, I just don't have the magic touch it takes to get things into sync.

Here's a good example. I have an XviD AVI file that is encoded in AC3. It won't play on my media player. I know that the problem is the audio because I can strip it out and get the video to play. So... I know I need to change the audio.

I've tried Xilisoft Video Converter and, VirtualDub to try and convert the audio to Lame MP3. I've tried some of the PS3/PSP Video 9 suites to convert to MP4. Every time I do anything, I always end up with out of sync audio. Surely there has to be an easy way to fix this, right?
IBNobody is offline  
post #4 of 13 Old 12-24-2008, 12:24 AM
Advanced Member
 
jhue's Avatar
 
Join Date: Sep 2000
Location: Silicon Valley
Posts: 720
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
The tools you're using are overkill for what you need to do. All you need to do is re-encode the audio and remux with the existing video. I'd use ffmpeg:

ffmpeg -i input_file -vcodec copy -acodec libmp3lame -ab 192k -ac 2 -f avi output_file

I have experienced VirtualDub throwing off audio sync on one particular type of file (Dish Network H.264 fed in through an AviSynth script, using DirectShowSource() and CoreCodec). Feeding that same AviSynth script into ffmpeg maintained audio sync. Go figure.
jhue is offline  
post #5 of 13 Old 12-30-2008, 07:30 PM - Thread Starter
Member
 
IBNobody's Avatar
 
Join Date: May 2007
Posts: 186
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by jhue View Post

The tools you're using are overkill for what you need to do. All you need to do is re-encode the audio and remux with the existing video. I'd use ffmpeg:

ffmpeg -i input_file -vcodec copy -acodec libmp3lame -ab 192k -ac 2 -f avi output_file

I have experienced VirtualDub throwing off audio sync on one particular type of file (Dish Network H.264 fed in through an AviSynth script, using DirectShowSource() and CoreCodec). Feeding that same AviSynth script into ffmpeg maintained audio sync. Go figure.

Tried that... The video will no longer load up in WM11.

EDIT: Nevermind. My codecs are scrambled. I will reattempt the conversion and report back.
IBNobody is offline  
post #6 of 13 Old 12-30-2008, 08:37 PM - Thread Starter
Member
 
IBNobody's Avatar
 
Join Date: May 2007
Posts: 186
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Ok... Using a build of FFMPEG still results in sync issues, just like everything else I try.

Here is the MediaInfo of the original file.

Code:
General #0
Format                       : AVI
Format/Info                  : Audio Video Interleave
Format/Family                : RIFF
File size                    : 701 MiB
PlayTime                     : 1h 6mn
Bit rate                     : 1473 Kbps
StreamSize/String            : 4.47 MiB
Writing application          : VirtualDubMod 1.5.10.2 (build 2540/release)
Writing library              : VirtualDubMod build 2540/release

Video #0
Codec                        : XviD
Codec/Family                 : MPEG-4V
Codec/Info                   : XviD project
Codec profile                : Streaming Video Profile/Level 1
Codec settings, Packet bitst : No
Codec settings, BVOP         : Yes
Codec settings, QPel         : No
Codec settings, GMC          : 0
Codec settings, Matrix       : Default
PlayTime                     : 1h 6mn
Bit rate                     : 1016 Kbps
Width                        : 592 pixels
Height                       : 320 pixels
Display Aspect ratio         : 1.850
Frame rate                   : 23.976 fps
Resolution                   : 8 bits
Chroma                       : 4:2:0
Interlacement                : Progressive
Bits/(Pixel*Frame)           : 0.224
StreamSize/String            : 483 MiB
Writing library              : XviD 1.1.2
Writing library/Date         : UTC 2006-11-01

Audio #0
Codec                        : AC3
PlayTime                     : 1h 6mn
Bit rate mode                : CBR
Bit rate                     : 448 Kbps
Channel(s)                   : 6 channels
Channel positions            : Front: L C R, Rear: L R, LFE
Sampling rate                : 48.0 KHz
Video0 delay                 : 499ms
StreamSize/String            : 213 MiB
Here is the MediaInfo for the transcoded file with sync issues:

Code:
General #0
Format                       : AVI
Format/Info                  : Audio Video Interleave
Format/Family                : RIFF
File size                    : 581 MiB
PlayTime                     : 1h 6mn
Bit rate                     : 1221 Kbps
StreamSize/String            : 6.05 MiB
Writing application          : Lavf52.13.0

Video #0
Codec                        : XviD
Codec/Family                 : MPEG-4V
Codec/Info                   : XviD project
Codec profile                : Streaming Video Profile/Level 1
Codec settings, Packet bitst : No
Codec settings, BVOP         : Yes
Codec settings, QPel         : No
Codec settings, GMC          : 0
Codec settings, Matrix       : Default
PlayTime                     : 1h 6mn
Bit rate                     : 1016 Kbps
Width                        : 592 pixels
Height                       : 320 pixels
Display Aspect ratio         : 1.850
Frame rate                   : 23.976 fps
Resolution                   : 8 bits
Chroma                       : 4:2:0
Interlacement                : Progressive
Bits/(Pixel*Frame)           : 0.224
StreamSize/String            : 483 MiB
Writing library              : XviD 1.1.2
Writing library/Date         : UTC 2006-11-01

Audio #0
Codec                        : MPEG-1 Audio layer 3
Codec profile                : Joint stereo
PlayTime                     : 1h 6mn
Bit rate mode                : CBR
Bit rate                     : 192 Kbps
Channel(s)                   : 2 channels
Sampling rate                : 48.0 KHz
Resolution                   : 16 bits
StreamSize/String            : 91.3 MiB
Writing library              : LAME3.98 (beta)
IBNobody is offline  
post #7 of 13 Old 01-18-2009, 07:01 PM - Thread Starter
Member
 
IBNobody's Avatar
 
Join Date: May 2007
Posts: 186
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Still no response? Surely, I'm not the only one who has resyncing issues.
IBNobody is offline  
post #8 of 13 Old 01-18-2009, 08:11 PM
Member
 
capitolm94's Avatar
 
Join Date: Apr 2007
Posts: 50
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Looks like your original file has an audio delay set into it:

Video0 delay : 499ms


and your new one doesnt. If your audio is ~1/2 second ahead of the video, and that difference is consistent through the duration, then thats probably your issue.

I dont know how to add in a delay, but its probably easy.
capitolm94 is offline  
post #9 of 13 Old 01-18-2009, 08:22 PM
 
bonapart's Avatar
 
Join Date: Dec 2001
Posts: 109
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
If ffpmeg isn't working, maybe try an mencoder based solution. Format Factory is a GUI front end for a well configured mencoder system. However, don't use the newest version (1.65) as it has issues, use 1.55. Just be sure to set the fps to match, and choose a custom configuration in order to set custom resolutions/bitrates.
bonapart is offline  
post #10 of 13 Old 01-18-2009, 09:23 PM - Thread Starter
Member
 
IBNobody's Avatar
 
Join Date: May 2007
Posts: 186
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by capitolm94 View Post

Looks like your original file has an audio delay set into it:

Video0 delay : 499ms


and your new one doesnt. If your audio is ~1/2 second ahead of the video, and that difference is consistent through the duration, then thats probably your issue.

I dont know how to add in a delay, but its probably easy.

That was it... You get the cookie.

But what disturbs me is that this is not always apparent...

Code:
General
Format                           : AVI
Format/Info                      : Audio Video Interleave
File size                        : 579 MiB
Duration                         : 1h 6mn
Overall bit rate                 : 1 217 Kbps
Writing application              : VirtualDubMod 1.5.10.2 (build 2540/release)
Writing library                  : VirtualDub build 30080/release

Video
Format                           : MPEG-4 Visual
Format profile                   : Streaming Video@L1
Format settings, BVOP            : Yes
Format settings, QPel            : No
Format settings, GMC             : No warppoints
Format settings, Matrix          : Default
Codec ID                         : XVID
Codec ID/Hint                    : XviD
Duration                         : 1h 6mn
Bit rate                         : 1 016 Kbps
Width                            : 592 pixels
Height                           : 320 pixels
Display aspect ratio             : 1.850
Frame rate                       : 23.976 fps
Resolution                       : 24 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.224
Stream size                      : 483 MiB (83%)
Writing library                  : XviD 1.1.2 (UTC 2006-11-01)

Audio
Format                           : MPEG Audio
Format version                   : Version 1
Format profile                   : Layer 3
Codec ID                         : 55
Codec ID/Hint                    : MP3
Duration                         : 1h 6mn
Bit rate mode                    : Constant
Bit rate                         : 192 Kbps
Channel(s)                       : 2 channels
Sampling rate                    : 48.0 KHz
Resolution                       : 16 bits
Stream size                      : 91.3 MiB (16%)
Alignment                        : Split accross interleaves
Interleave, duration             : 42 ms (1.00 video frame)
Interleave, preload duration     : 500 ms
Writing library                  : LAME3.98.2
How did I know that I put a 499ms offset in there? It's not always apparent.

Is there a tool that can tell me how much I need to tweak my audio?
IBNobody is offline  
post #11 of 13 Old 01-18-2009, 11:52 PM
Advanced Member
 
jhue's Avatar
 
Join Date: Sep 2000
Location: Silicon Valley
Posts: 720
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
If you just need a constant delay, as opposed to sync that varies or grows throughout the file, just use the -itsoffset options (will need -map too).
jhue is offline  
post #12 of 13 Old 01-19-2009, 05:07 AM - Thread Starter
Member
 
IBNobody's Avatar
 
Join Date: May 2007
Posts: 186
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by jhue View Post

If you just need a constant delay, as opposed to sync that varies or grows throughout the file, just use the -itsoffset options (will need -map too).

I just stuck the value into VD offset field...

But in cases where I have a straight-up offset and Mediainfo does not list a delay, is there a tool that will tell me automatically what the delay is?
IBNobody is offline  
post #13 of 13 Old 01-19-2009, 08:57 AM
Member
 
capitolm94's Avatar
 
Join Date: Apr 2007
Posts: 50
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
It probably has something to do with this:

Alignment : Split accross interleaves
Interleave, duration : 42 ms (1.00 video frame)
Interleave, preload duration : 500 ms


but I cant decipher that. Perhaps someone else has more info on that?
capitolm94 is offline  
Reply Networking, Media Servers & Content Streaming

User Tag List

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off