This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Audio out of sync after encode vfr
#1
I have some movies in variable frame rate mode.
When I encode it, the audio and the video are out of sync.
I tried the following methods but they did not work.
1. Enabling: "Config->Automation->On Load->Always extract time codes from input"
2. Enabling: "Config->Internals->Prefer Original->Frame rate"
How can I fix this problem?
Reply
#2
Note that "Config->Internals->Prefer Original->Frame rate" should normally not be enabled on vfr content if you plan to keep the vfr info.

If your source is a dvd extracted by MakeMKV or similar try:
  • Enabling Config->Internals->Handling->Ignore all input time codes
  • Enabling Config->Internals->Prefer Original->Frame rate"
If your source is something else, try:
  • Enabling Config->Internals->Prefer Original->Frame rate" in case the stream frame rate is the frame rate you aim for
  • Enabling Config->Input->Decoding->CFR output

If your content has broken headers or similar Hybrid can't properly deal with it.

Thats all I can think of with the information you gave.

Cu Selur
Reply
#3
The problem was not resolved.
This is one of my files that I have a problem with it.
If you can, please check it.

https://fr12.uploadboy.com/d/9bh8wgfkwo8...S19E01.zip
Reply
#4
got the file doing some test encodes to reproduce the issue.
Reply
#5
A simple remux to .mp4 of the file creates an unplayable file if MP4Box is used. :/
Remuxing to .mp4 with ffmpeg (Config->Container->Mp4 Settings->FFmpeg instead of MP4Box) as muxer creates a playable synch but laggy output.
When enabling 'Always extract time codes from input' Hybrid reports:
Adjusting frame count (70500) to time code entry count (70993).
which could be troublesome.

When enabling 'Always extract time codes from input' and remuxing to .mp4 with MP4Box, the muxing process crashes.
When enabling 'Always extract time codes from input' and remuxing to .mp4 with FFmpeg, the muxing process finishes and the output is sync.

Playing the file with ffplay one can see:
[h264 @ 0000020b0e6034c0] mmco: unref short failureq=    0B f=0/0
[h264 @ 0000020b0e6034c0] reference picture missing during reorder
[h264 @ 0000020b0e6034c0] Missing reference picture, default is 65695
[h264 @ 0000020b0e6038c0] mmco: unref short failureq=    0B f=0/0
[h264 @ 0000020b0eb4c480] Increasing reorder buffer to 2 0B f=0/0
[h264 @ 0000020b0e32c0c0] mmco: unref short failureq=    0B f=0/0
[h264 @ 0000020b0e52fc80] Increasing reorder buffer to 3 0B f=0/0
Also during playback I sometimes see:
number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
When calling:
ffmpeg -i c:\Users\Selur\Desktop\Grand.Designs.S19E01.1080p.HDTV.H264-LiNKLE.mkv -f null NUL
to look for decoder issues, ffmpeg outputs:
ffmpeg version N-106510-g3688b4a604-g21ca221068+1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 11.2.0 (Rev10, Built by MSYS2 project)
  configuration:  --pkg-config=pkgconf --cc='ccache gcc' --cxx='ccache g++' --ld='ccache g++' --disable-autodetect --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --enable-ffnvcodec --enable-nvdec --enable-cuda-llvm --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-libaom --disable-debug --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libxvid --enable-libopenmpt --enable-version3 --enable-librav1e --enable-libsrt --enable-libgsm --enable-libvmaf --enable-libsvtav1 --enable-mbedtls --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --disable-w32threads
  libavutil      57. 24.101 / 57. 24.101
  libavcodec     59. 25.100 / 59. 25.100
  libavformat    59. 20.101 / 59. 20.101
  libavdevice    59.  6.100 / 59.  6.100
  libavfilter     8. 30.100 /  8. 30.100
  libswscale      6.  6.100 /  6.  6.100
  libswresample   4.  6.100 /  4.  6.100
  libpostproc    56.  5.100 / 56.  5.100
Input #0, matroska,webm, from 'c:\Users\Selur\Desktop\Grand.Designs.S19E01.1080p.HDTV.H264-LiNKLE.mkv':
  Metadata:
    encoder         : no variable data
  Duration: 00:47:00.01, start: 0.000000, bitrate: 4812 kb/s
  Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn (default)
  Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'NUL':
  Metadata:
    encoder         : Lavf59.20.101
  Stream #0:0(eng): Video: wrapped_avframe, yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn (default)
    Metadata:
      encoder         : Lavc59.25.100 wrapped_avframe
  Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      encoder         : Lavc59.25.100 pcm_s16le
[h264 @ 000001411f55b040] mmco: unref short failure5 bitrate=N/A speed=28.4x
[h264 @ 000001411f55b040] reference picture missing during reorder
[h264 @ 000001411f55b040] Missing reference picture, default is 65695
[h264 @ 000001411f55ba00] mmco: unref short failure
[h264 @ 000001411e3da340] Increasing reorder buffer to 2
[h264 @ 000001411e412780] mmco: unref short failure
[h264 @ 000001411e413b80] Increasing reorder buffer to 3
[h264 @ 000001411e412b80] mmco: unref short failure9 bitrate=N/A speed=31.2x
[h264 @ 000001411e412b80] reference picture missing during reorder
[h264 @ 000001411e412b80] Missing reference picture, default is 65325
[h264 @ 000001411e411b80] mmco: unref short failure
[h264 @ 000001411e411b80] co located POCs unavailable
[h264 @ 000001411e413b80] co located POCs unavailable
[h264 @ 000001411f55ba00] reference picture missing during reorder
[h264 @ 000001411f55ba00] Missing reference picture, default is 65324
[h264 @ 000001411e5f0380] mmco: unref short failure
[null @ 000001411e9e7300] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 21890 >= 21656
[null @ 000001411e9e7300] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 21890 >= 21657
[null @ 000001411e9e7300] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 21895 >= 21658
[h264 @ 000001411e3da340] mmco: unref short failure1 bitrate=N/A speed=29.6x
[h264 @ 000001411e3da340] reference picture missing during reorder
[h264 @ 000001411e3da340] Missing reference picture, default is 65630
[h264 @ 000001411e9eaa00] mmco: unref short failure
[h264 @ 000001411e9eaa00] co located POCs unavailable
[h264 @ 000001411e308600] co located POCs unavailable
[h264 @ 000001411e413b80] reference picture missing during reorder
[h264 @ 000001411e413b80] Missing reference picture, default is 65629
[h264 @ 000001411e412f80] mmco: unref short failure
[h264 @ 000001411e411b80] mmco: unref short failure0 bitrate=N/A speed=29.5x
[h264 @ 000001411e411b80] reference picture missing during reorder
[h264 @ 000001411e411b80] Missing reference picture, default is 65386
[h264 @ 000001411e413b80] mmco: unref short failure
[h264 @ 000001411e413b80] co located POCs unavailable
[h264 @ 000001411e412f80] co located POCs unavailable
[h264 @ 000001411e5f0380] reference picture missing during reorder
[h264 @ 000001411e5f0380] Missing reference picture, default is 65385
[h264 @ 000001411e3da340] mmco: unref short failure
[null @ 000001411e9e7300] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 52456 >= 52282
[null @ 000001411e9e7300] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 52459 >= 52283
c:\Users\Selur\Desktop\Grand.Designs.S19E01.1080p.HDTV.H264-LiNKLE.mkv: corrupt decoded frame in stream 0
    Last message repeated 6 times
c:\Users\Selur\Desktop\Grand.Designs.S19E01.1080p.HDTV.H264-LiNKLE.mkv: corrupt decoded frame in stream 0
    Last message repeated 23 times
c:\Users\Selur\Desktop\Grand.Designs.S19E01.1080p.HDTV.H264-LiNKLE.mkv: corrupt decoded frame in stream 0
    Last message repeated 26 times
c:\Users\Selur\Desktop\Grand.Designs.S19E01.1080p.HDTV.H264-LiNKLE.mkv: corrupt decoded frame in stream 0
frame=70089 fps=729 q=-0.0 Lsize=N/A time=00:47:00.00 bitrate=N/A speed=29.3x
video:32307kB audio:528752kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
If this was a transport stream I would say there were some transmisson problems and running something like tsDoctor might help.
Since it's an mkv: Was this stream cut by change somehow?

When enabling 'Always extract time codes from input', reencoding to x264 and muxing to .mp4 with FFmpeg, the muxed output is async.

Problem is that the issues shown during decoding, will cause issues on reencoding and since Hybrid (unlike Handbrake or most FFMpeg based tools for example) doesn't process Audio&Video with the same tool at the same time additional sync compensation on broken streams isn't possible.


Looking at the Input with Vapoursynth + DGDecNV or LWLibAVSource there are 70500 frames undind FFmpegSource2 there are 70499, which conflicts with the number or time codes,...

Sorry, to say this, but Hybrid isn't really made to handle files with such errors in it.
You best bet is using some FFMpeg based tool for reencoding which does av-processing in one FFmpeg call.

That said, here's how I got a sync output, but which shows some artifacts when the decoding fails:
  • enable 'Config->Automation->Always extract time codes from input'
  • enable 'Filtering->Vapoursynth->Misc->Script->Always use Vapoursynth'
  • disable 'Filtering->Vapoursynth->Misc->Source->Prefer LWLibAVSource over FFmpegSource2'
  • enable 'Config->Container->Mp4 Settings->FFmpeg instead of MP4Box' (might not be necessary, )

Cu Selur
Reply
#6
Thank you for your help.
Let's see what I can do.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)