quietvoid / dovi_tool

dovi_tool is a CLI tool combining multiple utilities for working with Dolby Vision.
MIT License
623 stars 59 forks source link

Audio Lag #134

Closed moonship98 closed 2 years ago

moonship98 commented 2 years ago

Hello I'm experiencing for audio lag issues for episodes

ffmpeg -i "dv.mkv" -c:v copy -vbsf hevc_mp4toannexb -f hevc - | dovi_tool -m 3 extract-rpu - -o RPU.bin
ffmpeg -i "hdr.mkv" -c:v copy -an -vbsf hevc_mp4toannexb -f hevc hdr.hevc
dovi_tool inject-rpu -i "hdr.hevc" --rpu-in RPU.bin -o output.hevc
ffmpeg -i hdr.mkv -map 0:a:0 -c copy aud.ac3
mkvmerge -o "final_out.mkv" "output.hevc" "aud.ac3"

these are the commands that i used to for working

lupinishost@lupinishost:~/Downloads/Video$ ffmpeg -i "hdr.mkv" -c:v copy -an -vbsf hevc_mp4toannexb -f hevc hdr.hevc
ffmpeg version 4.1.8-0+deb10u1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version=0+deb10u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Guessed Channel Layout for Input Stream #0.1 : 5.1

this guessing is being mostly

manuelrn commented 2 years ago

It is impossible for dovi_tool to cause you that problem, basically because dovi_tool has nothing to do with it.
The most likely thing that is happening is that the video track does not contain the FPS information, and then it is assigned in the MKV header.

So when you extract that HEVC from the MKV and then generate another MKV, as the HEVC does not contain FPS information the MKVToolNix will assign to the MKV the default FPS (25 FPS) and if the video was not originally 25 FPS then the audio and subtitles will be out of sync.

So to prevent this from happening, simply check the FPS of the original MKV and then when generating the new MKV with MKVToolNix you must manually set the same FPS in the video track properties.

moonship98 commented 2 years ago

ok will do

moonship98 commented 2 years ago

and let you know

quietvoid commented 2 years ago

As explained, this can't be caused by dovi_tool.