Page 1 of 1

Audio/Video out of sync when encoding using h264 with mp4a

Posted: 20 Feb 2010 10:46
by marcsto
When I try to transcode a video in VLC using the h264 video codec and mp4a audio codec, the audio and video is consistently out of sync by about 1 second. As part of my debugging process, I tried using MediaCoder with the same codecs and similar settings and the audio / video was also out of sync, which seems to hint at some incompatibility with some of the settings I'm using. Here is the command line:

vlc -v "myvideo.avi" -I dummy --sout "#transcode{soverlay, ab=64, samplerate=44100,channels=2, acodec=mp4a, vcodec=h264, width=480,height=320,fps=25,vb=400,venc=x264{vbv-bufsize=10000, partitions=all,level=12,no-cabac, subme=7, threads
=4, ref=2,mixed-refs=1,bframes=0,min-keyint=1,keyint=50,trellis=2, direct=auto,qcomp=0.0, qpmax=51}}:gather:rtp{mp4a-latm, sdp=rtsp://0.0.0.0:1234/stream.sdp}"

Anyone have an idea of what might be wrong?

Thanks!
Marc

Re: Audio/Video out of sync when encoding using h264 with mp4a

Posted: 20 Feb 2010 17:10
by VLC_help
Does adding audio-sync to transcode help at all?

Re: Audio/Video out of sync when encoding using h264 with mp4a

Posted: 21 Feb 2010 09:31
by marcsto
Unfortunately no.

Re: Audio/Video out of sync when encoding using h264 with mp4a

Posted: 22 Feb 2010 12:25
by marcsto
I did some more experiments and found the following results:

Encapsulation Video codec Audio codec Result
MP4/MOV h264 MPEG 4 Audio (AAC) out of sync
MP4/MOV h264 MPEG Audio out of sync
MP4/MOV h264 MP3 out of sync
MP4/MOV MPEG-4 MPEG Audio out of sync
MPEG-PS h264 MPEG Audio in sync
MPEG-TS h264 MPEG Audio in sync
MPEG-1 h264 MPEG Audio in sync

Unfortunately, I can't use the MPEG-* encapsulations as I am trying to play these on my android phone and it doesn't support those encapsulations.

Any other ideas? Seems like some of the other programs can do an mp4 - h262 - aac combination that works but I think they use faac to encode the audio which isn't in the downloadable binary of vlc. I suppose I could try to compile the source and add faac, but I'm still hoping there's a more straightforward way.

Thanks!
Marc

Re: Audio/Video out of sync when encoding using h264 with mp

Posted: 22 Dec 2010 19:59
by Master_Mister
I got the same problem !! Did you found a solution to fix it ??

Re: Audio/Video out of sync when encoding using h264 with mp

Posted: 11 Feb 2011 12:39
by tomask50
I am having the same problem. I'm using VLC on a WIN7/64 machine and capturing/encoding a website's output. After 15mins. of streaming, the problem is very noticeable. After 90mins. of streaming the sync problem makes the .mp4 file unwatchable. It seems to have some thing to do with the bitrate of the website. The higher the bitrate of the website, the more out of sync the file becomes.

Re: Audio/Video out of sync when encoding using h264 with mp4a

Posted: 19 Jul 2017 22:08
by Remy33
It's an ancient topic, it's a shame nobody has answered that. The problem is that they use the wrong MUX while saving to file.