Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: yetanotherlogin on February 07, 2021, 06:40:49 PM

Title: [SOLVED] [2.7.6] Cut at keyframes, audio slightly out of sync in sliced video
Post by: yetanotherlogin on February 07, 2021, 06:40:49 PM
Hello,

Maybe an expert can venture a guess...

After slicing an MP4 video at keyframes using AviDemux, I notice the audio in the sliced video is about 200ms out of sync.

FWIW, here's what ffprobe says about the 1) full input video, and 2) the sliced  video:

ffprobe input.mp4
Duration: 00:52:44.56, start: 0.000000, bitrate: 6179 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 5986 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
    Metadata:
      creation_time  : 2020-12-17T18:47:59.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id      : [0][0][0][0]
      encoder        : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time  : 2020-12-17T18:47:59.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler
      vendor_id      : [0][0][0][0]
    Stream #0:2(und): Data: none (mp4s / 0x7334706D), 0 kb/s (default)
    Metadata:
      creation_time  : 2021-01-26T08:52:08.000000Z
      handler_name    : GPAC MPEG-4 OD Handler
    Stream #0:3(und): Data: none (mp4s / 0x7334706D), 0 kb/s (default)
    Metadata:
      creation_time  : 2021-01-26T08:52:08.000000Z
      handler_name    : GPAC MPEG-4 Scene Description Handler
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3

ffprobe sliced.input.mp4
Duration: 00:25:07.68, start: 0.000000, bitrate: 6186 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 5993 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
    Metadata:
      creation_time  : 2021-02-07T17:48:58.000000Z
      vendor_id      : [0][0][0][0]
      encoder        : JVT/AVC Coding
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time  : 2021-02-07T17:48:59.000000Z
      vendor_id      : [0][0][0][0]

And here's a screenshot when slicing the video:
(https://i.postimg.cc/htfbK0FK/image.png)

Thank you.
Title: Re: [2.7.6] Cut at keyframes, audio slightly out of sync in sliced video
Post by: eumagga0x2a on February 07, 2021, 09:29:40 PM
0. Please use the latest nightly, the 2.7.6 release is very old. Of course, if you are on Windows XP (not just a W2K theme), you are out of luck.

1. Please don't use the obsolete MP4v2 muxer, use the MP4 one.

2. If a H.264 stream contains B-frames, Avidemux needs to delay the video track by the number of reference frames. It should not cause any loss of sync, however.
Title: Re: [2.7.6] Cut at keyframes, audio slightly out of sync in sliced video
Post by: yetanotherlogin on February 07, 2021, 09:35:20 PM
Thanks.

I'm indeed running Win32, so it looks I'm outta luck :-/

http://www.avidemux.org/nightly/win32/
Title: Re: [2.7.6] Cut at keyframes, audio slightly out of sync in sliced video
Post by: eumagga0x2a on February 07, 2021, 09:46:39 PM
Install Linux (Fedora / Debian 10 / Ubuntu 20.x), make sure you have at least 5 GB free storage, install MXE deps https://mxe.cc/#requirements, follow the howto (https://github.com/mean00/avidemux2/blob/master/cross-compiling.txt), run your own win32 build.

edit: The build will require Windows 7 at least.
Title: Re: [2.7.6] Cut at keyframes, audio slightly out of sync in sliced video
Post by: yetanotherlogin on February 07, 2021, 09:49:23 PM
I don't mind Windows, but I do mind having to upgrade all the apps to move to a 64-bit Win10 host, hence the procrastinating :-)

Upgrading to the latest Win32 release (2.7.7) and using the "MP4 Muxer" made no difference. I did solve the problem by checking the "Shift" option and adding 200ms.

Thank you.
Title: Re: [SOLVED] [2.7.6] Cut at keyframes, audio slightly out of sync in sliced video
Post by: eumagga0x2a on February 07, 2021, 09:57:42 PM
Was A/V in the source in sync when played in Avidemux?

Was A/V in a cut-out in sync when played in Avidemux?

Else a sample may help.

By the way, unless you experience crashes, you really should select the "DXVA2" (actually DirectX) video display rather than unaccelerated "Qt" / "RGB" one.