Log in

View Full Version : Encoding yields audio out of sync


ChrisR34000
1st June 2008, 23:14
Hello!

I encoded a mkv file (video x264, audio ac3) with a higher bitrate to a mkv file (video x264, audio aac) with a lower bitrate. This process results in an out of sync audio. The delay is variable: at the beginning of the file, the sound is in sync and then it becomes gradually faster than the video.
Here are the details:

The original file has the following specifications

Format : Matroska
File size : 12.3 GiB
Duration : 3h 3mn
Overal bit rate : 9597 Kbps
Encoded date : UTC 2007-08-19 00:03:37
Writing application : mkvmerge v2.0.2 ('You're My Flame') built on Feb 21 2007 23:40:55
Writing library : libebml v0.7.7 + libmatroska v0.8.1

Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.1
Format settings, CABAC : Yes
Format settings, ReFrames : 8
Codec ID : V_MPEG4/ISO/AVC
Duration : 3h 3mn
Bit rate : 8758 Kbps
Nominal bit rate : 9132 Kbps
Width : 1920 pixels
Height : 816 pixels
Display aspect ratio : 2.35
Frame rate : 23.976 fps
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.243
Writing library : x264 - core 56 svn-667C
Encoding settings : cabac=1 / ref=5 / deblock=1:-2:-1 / analyse=0x3:0x133 / me=umh / subme=6 / brdo=1 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=2 / deadzone=21,11 / chroma_qp_offset=0 / threads=3 / nr=0 / decimate=1 / mbaff=0 / bframes=3 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=1 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=2pass / bitrate=9132 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30
Language : English

Audio
Format : AC-3
Format/Info : Audio Coding 3
Codec ID : A_AC3
Duration : 3h 3mn
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
Language : English

I used MkvExtract to extract the AC3 file and MeGui to encode sound and audio (If I wouldn't encode the audio and use the original AC3 file, I would have the same desync issue):


Format : Matroska
File size : 2.80 GiB
Duration : 3h 3mn
Overal bit rate : 2184 Kbps
Encoded date : UTC 2008-05-31 07:19:41
Writing application : mkvmerge v2.2.0 ('Turn It On Again') built on Mar 4 2008 12:58:26
Writing library : libebml v0.7.7 + libmatroska v0.8.1

Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.1
Format settings, CABAC : Yes
Format settings, ReFrames : 10
Codec ID : V_MPEG4/ISO/AVC
Duration : 3h 3mn
Nominal bit rate : 1914 Kbps
Width : 1280 pixels
Height : 544 pixels
Display aspect ratio : 2.35
Frame rate : 23.976 fps
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.115
Writing library : x264 - core 59 r851M e11ef38
Encoding settings : cabac=1 / ref=10 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=6 / me-prepass=0 / brdo=1 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / threads=3 / nr=0 / decimate=0 / mbaff=0 / fgo=0 / bframes=5 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=3 / wpredb=1 / bime=1 / keyint=250 / keyint_min=25 / scenecut=40(pre) / rc=2pass / bitrate=1914 / ratetol=1.0 / rceq='blurCplx^(1-qComp)' / qcomp=1.00 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=2:1.00
Language : English

Audio
Format : AAC
Format/Info : Advanced Audio Codec
Format version : Version 4
Format profile : LC
Format settings, SBR : No
Codec ID : A_AAC
Duration : 3h 3mn
Channel(s) : 6 channels
Channel positions : Front: L C R, Rear: L R, LFE
Sampling rate : 48.0 KHz
Resolution : 16 bits

I usually don't have these desync issues with any mkv files. I would be extremely grateful if you could help me in fixing this problem.

bond
6th June 2008, 19:28
boy, looking at the threads you create about audio desync, i really wonder

classic reason for audio desync:
- in case the audio has a constant desync over time: wrong audio/video delay set
- in case the audio has an increasing desync over time: wrong video framerate set

Guest
6th June 2008, 21:32
Why re-encode from an MKV? Why not re-enocde from your original DVD? You'll get better quality.

Stakiman
6th June 2008, 22:45
Although it says 23.976fps there, make sure you put assumefps(23.976024) in your AVS.