Audio delay

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
manjeroque
Posts: 4
Joined: Thu May 03, 2018 3:02 pm

Audio delay

Post by manjeroque »

Description of problem or question:
I am ripping my DVD-collection to MKV's with MakeMKV and then converting video to H.264 with HandBrake.
After encoding directly from DVD I usually do not have audio delay relative to video (usually i do a passthrough without encoding audio), but after converting MKV ripped with MakeMKV HandBrake adds different delays to diffeent audio formats (with passthrough and with encoding).
Now I want to encode audio separately with Apple AAC, but I do not know if I should add any delay while muxing video+audio...
What is it all about these delays? Should I add the same delays while adding additional audio tracks?



Steps to reproduce the problem (If Applicable): For some conversions there is no delay, but it usually adds some delay. Usually I do rips of PAL DVD's and the audio delay is 40ms with AC3 passthrough (1 frame for 25fps framerate). The log is for PCM to FLAC => 40ms.




HandBrake version (e.g., 1.0.0): 1.0.7 and 1.1.0




Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update): Windows 7 x64 Ultimate




HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all

HandBrake 1.1.0 (2018040700) - 64bit
OS: Microsoft Windows NT 6.1.7601 Service Pack 1 - 64bit
CPU: Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
Ram: 6135 MB, 
GPU Information:
  NVIDIA GeForce GT 740 - 23.21.13.8871
Screen: 1920x1080
Temp Dir: C:\Users\PETER\AppData\Local\Temp\
Install Dir: F:\!!! Portable Apps\PortableApps\! Video Coding\HandBrake
Data Dir: C:\Users\PETER\AppData\Roaming\HandBrake Team\HandBrake\1.1.0.0

-------------------------------------------


# Starting Encode ...

[16:50:51] hb_init: starting libhb thread
[16:50:51] 1 job(s) to process
[16:50:51] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": -1,
        "DRC": 0.0,
        "Encoder": 1048576,
        "Gain": 0.0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 48000,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      1073807360,
      1073743872,
      1074003968,
      1073750016,
      1090519040,
      1074790400,
      1074266112,
      1107296256
    ],
    "FallbackEncoder": 2048
  },
  "Destination": {
    "ChapterList": [],
    "ChapterMarkers": false,
    "AlignAVStart": false,
    "File": "F:\\Johnny Hallyday - Mes videos\\1984 Casualty of love (vertiges de l'amour) 18!.mkv",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "Mux": 2097152
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 4,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 11,
        "Settings": {
          "crop-bottom": "6",
          "crop-left": "14",
          "crop-right": "10",
          "crop-top": "0",
          "height": "570",
          "width": "696"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "0"
        }
      }
    ]
  },
  "PAR": {
    "Num": 16,
    "Den": 15
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "F:\\Johnny Hallyday - Mes videos\\1984 Casualty of love (vertiges de l'amour).mkv"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": 65536,
    "Level": "3.1",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "veryslow",
    "Profile": "main",
    "Quality": 18.0,
    "HWDecode": false,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[16:50:51] CPU: Intel(R) Core(TM) i7 CPU         920  @ 2.67GHz
[16:50:51]  - logical processor count: 8
[16:50:51] Intel Quick Sync Video support: no
[16:50:51] hb_scan: path=F:\Johnny Hallyday - Mes videos\1984 Casualty of love (vertiges de l'amour).mkv, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image F:\Johnny Hallyday - Mes videos\1984 Casualty of love (vertiges de l'amour).mkv
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
[16:50:51] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 5.0.3
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[16:50:51] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from 'F:\Johnny Hallyday - Mes videos\1984 Casualty of love (vertiges de l'amour).mkv':
  Duration: 00:03:24.48, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: mpeg2video (Main)
      yuv420p, tv, 720x576 [PAR 16:15 DAR 4:3], 7060 kb/s, PAR 16:15 DAR 4:3
      25 fps, 1k tbn
    Metadata:
      BPS-eng         : 4184241
      DURATION-eng    : 00:03:24.480000000
      NUMBER_OF_FRAMES-eng: 5112
      NUMBER_OF_BYTES-eng: 106949206
      SOURCE_ID-eng   : 0100E0
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.12.0 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-29 20:05:16
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:1(fre): Audio: pcm_s16le
      48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      title           : Stereo
      BPS-eng         : 1536005
      DURATION-eng    : 00:03:24.441666666
      NUMBER_OF_FRAMES-eng: 6134
      NUMBER_OF_BYTES-eng: 39252800
      SOURCE_ID-eng   : 01A0BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.12.0 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-29 20:05:16
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:2(fre): Audio: ac3
      48000 Hz, 5.1, fltp, 448 kb/s
    Metadata:
      title           : Surround 5.1
      BPS-eng         : 448000
      DURATION-eng    : 00:03:24.448000000
      NUMBER_OF_FRAMES-eng: 6389
      NUMBER_OF_BYTES-eng: 11449088
      SOURCE_ID-eng   : 0181BD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.12.0 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-29 20:05:16
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
    Stream #0:3(fre): Audio: dts (DTS)
      48000 Hz, 5.1, fltp, 768 kb/s
    Metadata:
      title           : Surround 5.1
      BPS-eng         : 754500
      DURATION-eng    : 00:03:24.448000000
      NUMBER_OF_FRAMES-eng: 19167
      NUMBER_OF_BYTES-eng: 19282002
      SOURCE_ID-eng   : 018ABD
      _STATISTICS_WRITING_APP-eng: MakeMKV v1.12.0 win(x64-release)
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-04-29 20:05:16
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
[16:50:51] scan: decoding previews for title 1
[16:50:51] scan: audio 0x1: pcm_s16le, rate=48000Hz, bitrate=1536000 Francais (pcm_s16le) (2.0 ch)
[16:50:51] scan: audio 0x2: ac3, rate=48000Hz, bitrate=448000 Francais (AC3) (5.1 ch)
[16:50:51] scan: audio 0x3: dca, rate=48000Hz, bitrate=768000 Francais (DTS) (5.1 ch)
[16:50:51] scan: 10 previews, 720x576, 25.000 fps, autocrop = 0/0/12/8, aspect 4:3, PAR 16:15
[16:50:51] libhb: scan thread found 1 valid title(s)
[16:50:51] starting job
[16:50:51] decomb filter thread started for segment 0
[16:50:51] decomb filter thread started for segment 1
[16:50:51] decomb filter thread started for segment 2
[16:50:51] decomb filter thread started for segment 3
[16:50:51] decomb filter thread started for segment 4
[16:50:51] decomb filter thread started for segment 5
[16:50:51] decomb filter thread started for segment 6
[16:50:51] decomb filter thread started for segment 7
[16:50:51] decomb check thread started for segment 0
[16:50:51] decomb check thread started for segment 1
[16:50:51] decomb check thread started for segment 2
[16:50:51] decomb check thread started for segment 3
[16:50:51] decomb check thread started for segment 4
[16:50:51] decomb check thread started for segment 5
[16:50:51] decomb check thread started for segment 6
[16:50:51] decomb check thread started for segment 7
[16:50:51] mask filter thread started for segment 0
[16:50:51] mask filter thread started for segment 1
[16:50:51] mask filter thread started for segment 2
[16:50:51] mask filter thread started for segment 3
[16:50:51] mask filter thread started for segment 4
[16:50:51] mask filter thread started for segment 5
[16:50:51] mask filter thread started for segment 6
[16:50:51] mask filter thread started for segment 7
[16:50:51] mask erode thread started for segment 0
[16:50:51] mask erode thread started for segment 1
[16:50:51] mask erode thread started for segment 2
[16:50:51] mask erode thread started for segment 3
[16:50:51] mask erode thread started for segment 4
[16:50:51] mask erode thread started for segment 5
[16:50:51] mask erode thread started for segment 6
[16:50:51] mask erode thread started for segment 7
[16:50:51] mask dilate thread started for segment 0
[16:50:51] mask dilate thread started for segment 1
[16:50:51] mask dilate thread started for segment 2
[16:50:51] mask dilate thread started for segment 3
[16:50:51] mask dilate thread started for segment 4
[16:50:51] mask dilate thread started for segment 5
[16:50:51] mask dilate thread started for segment 6
[16:50:51] mask dilate thread started for segment 7
[16:50:51] yadif thread started for segment 0
[16:50:51] yadif thread started for segment 1
[16:50:51] yadif thread started for segment 2
[16:50:51] yadif thread started for segment 3
[16:50:51] yadif thread started for segment 4
[16:50:51] yadif thread started for segment 6
[16:50:51] yadif thread started for segment 5
[16:50:51] yadif thread started for segment 7
[16:50:51] work: compression level not specified, track 1 setting compression level 5.00
[16:50:51] job configuration:
[16:50:51]  * source
[16:50:51]    + F:\Johnny Hallyday - Mes videos\1984 Casualty of love (vertiges de l'amour).mkv
[16:50:51]    + title 1, chapter(s) 1 to 1
[16:50:51]    + container: matroska,webm
[16:50:51]  * destination
[16:50:51]    + F:\Johnny Hallyday - Mes videos\1984 Casualty of love (vertiges de l'amour) 18!.mkv
[16:50:51]    + container: Matroska (libavformat)
[16:50:51]  * video track
[16:50:51]    + decoder: mpeg2video
[16:50:51]      + bitrate 7060 kbps
[16:50:51]    + filters
[16:50:51]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[16:50:51]      + Decomb (mode=39)
[16:50:51]      + Framerate Shaper (mode=0)
[16:50:51]        + frame rate: same as source (around 25.000 fps)
[16:50:51]      + Crop and Scale (width=696:height=570:crop-top=0:crop-bottom=6:crop-left=14:crop-right=10)
[16:50:51]        + source: 720 * 576, crop (0/6/14/10): 696 * 570, scale: 696 * 570
[16:50:51]    + Output geometry
[16:50:51]      + storage dimensions: 696 x 570
[16:50:51]      + pixel aspect ratio: 16 : 15
[16:50:51]      + display dimensions: 742 x 570
[16:50:51]    + encoder: H.264 (libx264)
[16:50:51]      + preset:  veryslow
[16:50:51]      + profile: main
[16:50:51]      + level:   3.1
[16:50:51]      + quality: 18.00 (RF)
[16:50:51]  * audio track 1
[16:50:51]    + decoder: Francais (pcm_s16le) (2.0 ch) (track 1, id 0x1)
[16:50:51]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[16:50:51]    + mixdown: Stereo
[16:50:51]    + dither: none
[16:50:51]    + encoder: FLAC 16-bit (libavcodec)
[16:50:51]      + samplerate: 48000 Hz
[16:50:51]      + compression level: 5.00
[16:50:51] sync: expecting 5112 video frames
[16:50:51] encx264: encoding at constant RF 18.000000
[16:50:51] encx264: unparsed options: level=3.1:ref=11:bframes=8:b-adapt=2:direct=auto:analyse=all:8x8dct=0:me=umh:merange=24:subme=10:trellis=2:vbv-bufsize=14000:vbv-maxrate=14000:rc-lookahead=60
x264 [info]: using SAR=16/15
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
x264 [info]: profile Main, level 3.1
[16:50:51] sync: first pts video is 0
[16:50:51] sync: first pts audio 0x1 is 3600
[16:50:51] sync: Chapter 1 at frame 3 time 10800
[16:57:18] reader: done. 1 scr changes
[16:57:26] work: average encoding speed for job is 13.078429 fps
[16:57:26] comb detect: heavy 4276 | light 572 | uncombed 264 | total 5112
[16:57:26] decomb: deinterlaced 4276 | blended 572 | unfiltered 264 | total 5112
[16:57:26] vfr: lost time: 0 (0 frames)
[16:57:26] vfr: gained time: 0 (0 frames) (0 not accounted for)
[16:57:26] pcm_s16le-decoder done: 6134 frames, 0 decoder errors
[16:57:26] mpeg2video-decoder done: 5112 frames, 0 decoder errors
[16:57:26] sync: got 5112 frames, 5112 expected
[16:57:26] sync: framerate min 12.500 fps, max 25.000 fps, avg 24.995 fps
x264 [info]: frame I:27    Avg QP:15.85  size: 45294
x264 [info]: frame P:1026  Avg QP:19.46  size: 20607
x264 [info]: frame B:4059  Avg QP:21.20  size:  9143
x264 [info]: consecutive B-frames:  0.7%  0.8%  4.0% 23.3% 23.5% 38.5%  6.4%  1.7%  1.1%
x264 [info]: mb I  I16..4: 27.3%  0.0% 72.7%
x264 [info]: mb P  I16..4:  5.7%  0.0%  9.2%  P16..4: 47.6% 25.4% 10.8%  0.4%  0.1%    skip: 0.8%
x264 [info]: mb B  I16..4:  0.5%  0.0%  1.1%  B16..8: 44.1% 11.5%  2.4%  direct:17.4%  skip:23.0%  L0:45.3% L1:45.0% BI: 9.7%
x264 [info]: direct mvs  spatial:99.8% temporal:0.2%
x264 [info]: coded y,uvDC,uvAC intra: 93.3% 87.1% 45.8% inter: 42.1% 45.9% 3.7%
x264 [info]: i16 v,h,dc,p: 29% 18% 13% 40%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8%  5%  2% 10% 15% 17% 14% 14% 15%
x264 [info]: i8c dc,h,v,p: 33% 26% 20% 21%
x264 [info]: Weighted P-Frames: Y:10.6% UV:6.7%
x264 [info]: ref P L0: 42.1% 10.2% 16.6%  7.6%  5.7%  4.6%  3.8%  2.6%  2.3%  2.2%  2.1%  0.1%
x264 [info]: ref B L0: 80.3%  9.5%  3.6%  1.8%  1.4%  1.1%  0.9%  0.6%  0.5%  0.3%
x264 [info]: ref B L1: 96.6%  3.4%
x264 [info]: kb/s:2326.58
[16:57:26] mux: track 0, 5112 frames, 59477742 bytes, 2326.08 kbps, fifo 1024
[16:57:26] mux: track 1, 2130 frames, 18584602 bytes, 726.81 kbps, fifo 512
[16:57:26] libhb: work result = 0

# Encode Completed ...

manjeroque
Posts: 4
Joined: Thu May 03, 2018 3:02 pm

Re: Audio delay

Post by manjeroque »

Maybe MakeMKV adds something, that is being removed by HandBrake?

I made a conversion directly from DVD and from a file by MakeMKV. The audio tracks are the same! But these two audio tracks do not match the one inside the file by MakeMKV and the one extracted right from the DVD! :oops:

And this delay - now I am thinking, that MakeMKV changes video stream somehow - so it causes these delays :idea:
Post Reply