VideoHelp Forum




+ Reply to Thread
Results 1 to 25 of 25
  1. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    Hi. I have a very annoying problem with a video file: when I extract (demux) the original audio using Avidemux or ffmpeg, the resulting AAC duration is 06:09 instead of 06:12 (the duration of the video). Same thing (06:09) if I'm importing the video in Audacity.

    When I import that original video in DaVinci Resolve, the audio has gaps seemly random, so it stays in sync. Is this some non-standard AAC? How can I extract the original 06:12 in duration audio?

    The original file is fairly big 774MB: https://mega.nz/file/W0J3kSwA#kXavtGTVM8pFvdLSwkSwxRRm9rA2TgvSr-N8GSufk8E

    I need the original audio to remux it in a processed version of that video. Or at least a WAV with the correct duration and no gaps in it.
    Last edited by elektro; 19th Aug 2025 at 12:13.
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I encoded a new file from Avidemux (using wav/pcm audio into MKV) and the resulting file is normal,
    no sync problems start to finish.
    The original audio in your source does have some drop outs (approx 35 milliseconds) that are audible
    but they do not affect the length
    Image Attached Thumbnails Click image for larger version

Name:	dropouts.jpg
Views:	15
Size:	395.2 KB
ID:	88340  

    Quote Quote  
  3. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    Originally Posted by davexnet View Post
    I encoded a new file from Avidemux (using wav/pcm audio into MKV) and the resulting file is normal,
    no sync problems start to finish.
    The original audio in your source does have some drop outs (approx 35 milliseconds) that are audible
    but they do not affect the length
    Thanks. Perhaps those drop outs (the gaps that I mentioned when I imported the file in DaVinci Resolve) cause the audio to have a shorter duration when exporting with other programs. Is there a way to automatically fill in those gaps? Maybe with the app from your screenshot (iZotope RX).
    Quote Quote  
  4. Here are 2 audios I did with FFMPEG.
    They are the correct legnth.
    See if either or both will work for you.

    Code:
    ffmpeg -i Bring_Me_the_Horizon.mp4 -vn -sn -c:a aac_at -aac_at_quality 0 -aac_at_mode cbr -b:a 192k -ac 2 Bring_Me_the_Horizon.mka
    Just change to .mp4 if you want that format.
    Image Attached Files
    Quote Quote  
  5. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Something odd going on here. I did a Quick Stream Fix on the MP4 in VideoRedo. It removes a lot of video frames and the resulting file is 6min ~9 seconds long, still in sync. I used VDub to extract the audio into WAV from the VideoRedo QSF file. It's attached.

    I therefore think the Audacity audio is correct (6min 9sec) and the video is corrupted.
    Last edited by Alwyn; 19th Aug 2025 at 21:16.
    Quote Quote  
  6. Originally Posted by Alwyn View Post
    I therefore think the Audacity audio is correct (6min 9sec) and the video is corrupted.
    That was my conclusion too.
    Quote Quote  
  7. If you remux into mkv (e.g. mkvmerge, or mkvtoolnix), you can use eac3to to fix the aac gaps (eac3to does not support mp4) . The audio 06:12.117 in audacity after fixing gaps

    Code:
    command line: "eac3to"  "Bring Me the Horizon feat. Aurora - liMOusine (Summer Sonic Festival, Japan, 18-08-2024) original.mkv" 2: eac3to.aac
    ------------------------------------------------------------------------------
    MKV, 1 video track, 1 audio track, 0:06:13, 60i /1.001
    1: MPEG2, 1080i60 /1.001 (16:9)
    2: AAC, 2.0 channels, 48kHz, -100ms
    [a02] Extracting audio track number 2...
    [a02] Applying AAC delay...
    [a02] A remaining delay of +6ms could not be fixed.
    [a02] Creating file "eac3to.aac"...
    [a02] Audio has a gap of 21ms at playtime 0:00:02.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:07.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:08.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:09.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:10.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:11.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:12.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:13.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:14.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:15.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:18.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:19.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:20.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:00:20.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:21.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:22.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:24.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:00:26.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:00:28.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:30.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:31.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:36.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:37.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:00:40.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:46.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:48.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:48.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:00:51.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:52.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:00:53.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:01:02.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:05.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:01:12.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:14.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:01:19.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:23.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:26.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:28.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:28.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:29.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:29.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:32.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:01:34.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:35.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:01:35.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:36.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:43.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:01:51.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:52.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:52.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:56.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:57.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:01:57.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:58.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:59.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:01:59.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:00.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:05.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:08.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:10.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:02:12.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:14.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:15.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:02:15.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:16.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:18.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:02:20.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:21.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:23.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:25.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:02:26.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:28.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:02:29.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:30.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:02:33.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:02:34.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:34.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:36.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:41.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:02:59.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:03:07.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:13.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:14.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:16.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:18.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:20.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:22.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:03:34.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:35.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:35.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:03:38.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:38.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:39.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:03:40.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:42.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:03:57.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:59.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:03:59.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:07.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:04:16.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:17.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:04:21.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:22.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:04:23.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:29.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:29.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:04:32.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:37.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:41.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:04:44.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:46.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:48.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:49.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:54.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:54.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:04:56.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:04:59.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:09.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:14.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:05:16.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:17.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:18.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:19.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:05:20.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:21.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:23.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:25.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:26.  <WARNING>
    [a02] Audio has a gap of 22ms at playtime 0:05:29.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:30.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:31.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:32.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:33.  <WARNING>
    [a02] Audio has a gap of 21ms at playtime 0:05:35.  <WARNING>
    [a02] Starting 2nd pass...
    [a02] Extracting audio track number 2...
    [a02] Applying AAC delay...
    [a02] A remaining delay of +6ms could not be fixed.
    [a02] Realizing AAC gaps...
    [a02] Creating file "eac3to.aac"...
    Video track 1 contains 9582 frames.
    eac3to processing took 4 seconds.
    Done.
    Image Attached Files
    Quote Quote  
  8. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    That's interesting . Does eac3to remove the gaps and push the pieces together thus shortening the length?
    I noticed it'a almost a second shorter, 47875 samples
    Quote Quote  
  9. Any analysis of the two I posted in post#4 :
    It was funny that when all I did in FFMPEG was change the format to acc & the file was then 06:09.
    Using the code I posted.
    Quote Quote  
  10. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    I note the original file is MPEG 2. MPEG 2 and AAC in an MP4 container...
    Quote Quote  
  11. You can use clever FFmpeg-GUI to create a correct (in length) PCM audio file.

    1) Load your mp4 from post #1, click main page, click extract streams, set the aac audiostream and click extract.

    2) Go back to source and drag the extracted aac into the window.
    Click main page, click encode audio stream, select pcm as encoder, set length only (at change length & pitch), select preset custom, set all like in the pic, click OK and click encode. Done.

    Image
    [Attachment 88352 - Click to enlarge]


    3) If you want check the result, you can mux it with the videostream.
    To do so, click multiplex, drag your mp4 into the window, on the left deselect all streams, then select only the videostream and the new created wav (pcm) audiostream, set your output container and click multiplex. Done.
    Last edited by ProWo; 20th Aug 2025 at 12:03. Reason: sample added
    Quote Quote  
  12. Originally Posted by davexnet View Post
    T Does eac3to remove the gaps and push the pieces together thus shortening the length?
    I noticed it'a almost a second shorter, 47875 samples



    In 3.x versions, you can choose the behaviour for gap repair by using -silence or -loop

    https://www.videohelp.com/software/eac3to/version-history

    Code:
    v3.00
    .
    .
    .
    
    * for gaps, edits & repairs > 1000ms eac3to now inserts silence by default
    * for gaps, edits & repairs < 1000ms eac3to now loops audio by default
    * option "-silence" forces eac3to to insert silence instead of looping audio
    * option "-loop" forces eac3to to loop audio instead of inserting silence
    .
    .
    .



    The MP4 has variable timestamps - entries such as 14.985015 fps - they probably are related to the audio gaps . The average framerate is 25.732

    The content is actually 23.976 telecined . If you honor flags, IVTC, the duration is 06:12 and matches the fixed audio. That's the way I would do it so it plays back properly everywhere , progressively CFR. The OP mentioned remuxing with "processed version of that video", not sure how that was done

    The benefit of keeping AAC vs WAV is smaller filesize. There might be other types of gap repairs that are more advanced now (e.g. "AI", or machine learning) , but eac3to has been used for many years for gap repairs (BD streams, broadcast streams)
    Quote Quote  
  13. Originally Posted by poisondeathray View Post
    In 3.x versions, you can choose the behaviour for gap repair by using -silence or -loop
    * for gaps, edits & repairs > 1000ms eac3to now inserts silence by default
    * for gaps, edits & repairs < 1000ms eac3to now loops audio by default
    * option "-silence" forces eac3to to insert silence instead of looping audio
    * option "-loop" forces eac3to to loop audio instead of inserting silence
    There is no gap in the audio stream.
    If you export it and view it in an audio editor, you can see it.
    The whole problem is a failed mux of the two streams.
    If you simply mux the mp4 file to mkv, you will see that the video is a normal 29.97 fps stream and the audio stream is simply shorter.
    This mp4 monstrosity was created in an attempt to align the two.
    Quote Quote  
  14. Originally Posted by ProWo View Post
    There is no gap in the audio stream.
    To be clear, the eac3to "gaps" refer to the audio relationship with the video

    The whole problem is a failed mux of the two streams.
    Not really "failed" because the MP4 is in sync

    If you simply mux the mp4 file to mkv, you will see that the video is a normal 29.97 fps stream and the audio stream is simply shorter.
    This mp4 monstrosity was created in an attempt to align the two
    Yes the audio stream is shorter - that's the reason for this thread .

    If you remux with ffmpeg or mkvmerge, look at timestamps - they are variable. The average frame rate is ~25.736 FPS ie. the video slows down in sections to keep sync with the shorter audio . There are sections where it goes down to ~15fps

    There are differences in in stretching the audio linearly vs. gap repair at specific spots. The end duration will be the same (or very close), but the middle parts might be slightly more out of sync . You'd have to test which method is better in this case, and that would be dependent on the history of the stream, how it was created
    Quote Quote  
  15. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    I knew something is fishy with this file. I have another video with the same issues from the same TV station.

    Originally Posted by Alwyn View Post
    Something odd going on here. I did a Quick Stream Fix on the MP4 in VideoRedo. It removes a lot of video frames and the resulting file is 6min ~9 seconds long, still in sync. I used VDub to extract the audio into WAV from the VideoRedo QSF file. It's attached.

    I therefore think the Audacity audio is correct (6min 9sec) and the video is corrupted.
    Thanks for reply. I must process the video (deinterlace with QTGMC + normalize the audio), that's why I need both the video and audio. This fixed video you posted had the frame removal done in a lossless way?

    I note the original file is MPEG 2. MPEG 2 and AAC in an MP4 container...
    Indeed. A dumb idea. But if you mess with this video, even if you move it into a MKV container, the A/V sync is lost.
    Last edited by elektro; 20th Aug 2025 at 11:56.
    Quote Quote  
  16. Originally Posted by ProWo View Post
    If you simply mux the mp4 file to mkv, you will see that the video is a normal 29.97 fps stream and the audio stream is simply shorter.
    It looks like audio came from a 24 fps source and the video from a 23.976 fps source (24 fps film slowed to 23.976 fps and telecined). Then the timestamps were manipulated to make the audio running time match the video running time.
    Quote Quote  
  17. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    Originally Posted by poisondeathray View Post
    Originally Posted by davexnet View Post
    T Does eac3to remove the gaps and push the pieces together thus shortening the length?
    I noticed it'a almost a second shorter, 47875 samples



    In 3.x versions, you can choose the behaviour for gap repair by using -silence or -loop

    https://www.videohelp.com/software/eac3to/version-history

    Code:
    v3.00
    .
    .
    .
    
    * for gaps, edits & repairs > 1000ms eac3to now inserts silence by default
    * for gaps, edits & repairs < 1000ms eac3to now loops audio by default
    * option "-silence" forces eac3to to insert silence instead of looping audio
    * option "-loop" forces eac3to to loop audio instead of inserting silence
    .
    .
    .



    The MP4 has variable timestamps - entries such as 14.985015 fps - they probably are related to the audio gaps . The average framerate is 25.732

    The content is actually 23.976 telecined . If you honor flags, IVTC, the duration is 06:12 and matches the fixed audio. That's the way I would do it so it plays back properly everywhere , progressively CFR. The OP mentioned remuxing with "processed version of that video", not sure how that was done

    The benefit of keeping AAC vs WAV is smaller filesize. There might be other types of gap repairs that are more advanced now (e.g. "AI", or machine learning) , but eac3to has been used for many years for gap repairs (BD streams, broadcast streams)
    Basically I want to use Avisynth to deinterlace the video with QTGMC + amplify the audio level with Audacity and save the results as HEVC + ACC in a MKV container. That's why I need to demux both video and audio in the correct way. Simply demuxing V/A and remuxing them in MKV results in a heavy out of sync audio.

    Reading this thread made me confused a bit. I don't get what is actually wrong and needs fixing: the video, the audio or both?
    Quote Quote  
  18. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    Originally Posted by jagabo View Post
    Originally Posted by ProWo View Post
    If you simply mux the mp4 file to mkv, you will see that the video is a normal 29.97 fps stream and the audio stream is simply shorter.
    It looks like audio came from a 24 fps source and the video from a 23.976 fps source (24 fps film slowed to 23.976 fps and telecined). Then the timestamps were manipulated to make the audio running time match the video running time.
    Then what do you suggest to do in order to properly demux the A/V streams and edit the video in Avisynth? If I do IVTC to get 23.976fps and then AssumeFPS(24) the video duration is still only slightly lower than 06:12.
    Last edited by elektro; 20th Aug 2025 at 11:43.
    Quote Quote  
  19. Oops, sorry, my calculation was wrong. I accidentally used 3600+12 minutes instead of 360+12 minutes. So you're right adjusting the video to 24 fps doesn't reduce the running time by ~3 seconds.
    Quote Quote  
  20. Video - do not deinterlace the video, because the content is not interlaced . It's 23.976p content telecined . You should inverse telecine to get back the original unique frames

    Only the audio needs to be fixed, because it's shorter . eac3to is one way of doing it by adjusting gaps, stretching and resampling is another. Withing stretching, there are various algorithms, some are better than others. You'd have to test to see which is better for your source

    This uses the eac3to audio in post #8
    Code:
    ffVideoSource("Bring Me the Horizon feat. Aurora - liMOusine (Summer Sonic Festival, Japan, 18-08-2024) original.mp4",rffmode=1)
    tfm(pp=0)
    tdecimate()
    vid=last
    
    aud=bsaudiosource("eac3to.aac")
    
    audiodub(vid,aud)
    #info
    This is just to preview sync e.g. mpchc . Looks ok, sounds ok in terms of av sync, duration is correct

    If you're amplfying the audio in audacity, you're re-encoding anyways, unless you use a lossless metadata method like replaygain/aacgain . Not all players support that method
    https://www.videohelp.com/software/AACGain

    eac3to can be used to amplify audio as well in that 1st step
    Quote Quote  
  21. Member
    Join Date
    May 2011
    Location
    Sweden
    Search PM
    I finally picked a solution. I think Alwyn was right: the video is actually messed up and the audio is right. I used VideoRedo (like he recommended) to fix the video and remove the useless frames that made the video longer than the audio. Now both the audio and video are in sync. That's the Avisynth script I used to process the file and then convert it to HEVC + AAC.

    Code:
    SetFilterMTMode("QTGMC", 2)
    v=D2VSource("Bring Me the Horizon feat. Aurora - liMOusine (Summer Sonic Festival, Japan, 18-08-2024) original_track1_[und].d2v")
    a=LWLibavAudioSource("Bring Me the Horizon feat. Aurora - liMOusine (Summer Sonic Festival, Japan, 18-08-2024) original_track1_[und]_DELAY -31ms.wav")
    AudioDub(v, a).DelayAudio(-0.031) # in seconds
    AssumeTFF()
    AssumeFPS(29.970)
    TFM(slow=2, pp=7, clip2=QTGMC(preset="Slow", FPSDivisor=2, Sharpness=0.5)).TDecimate() # IVTC
    Deblock_QED(quant1=35, quant2=35)
    TTempSmooth() # light denoising
    Prefetch(4)
    And the result if you're interested to check it out: https://mega.nz/file/b5pSWCDZ#UaEhk63eMupAy4CQnUunZe3h_6yCFqet0k1cK5Pu0t4

    @poisondeathray: Thanks for trying to help but apparently the original audio didn't have gaps. Anyway, that's useful knowledge in case I have to deal with audio gaps (and I recently did and I fixed them by manually copy pasting small parts into the gaps using Audacity).
    Quote Quote  
  22. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    I ran this on the original MP4:

    Code:
    v=LSMASHVideoSource("H:\Videohelp\elektro\Bring Me the Horizon feat. VRD QSF Recode.mp4")
    a=LSMASHAudioSource("H:\Videohelp\elektro\Bring Me the Horizon feat. VRD QSF Recode.mp4")
    AudioDub(v,a)
    
    ConvertToYV12()
    TFM()
    Tdecimate()
    
    Prefetch(20)
    and the video came out at 6min 8seconds (at 23.976fps). That closely matches the Audacity length. Audio sync is good.
    Quote Quote  
  23. Originally Posted by elektro View Post
    I finally picked a solution. I think Alwyn was right: the video is actually messed up and the audio is right. I used VideoRedo (like he recommended) to fix the video and remove the useless frames that made the video longer than the audio. Now both the audio and video are in sync. That's the Avisynth script I used to process the file and then convert it to HEVC + AAC.

    Code:
    SetFilterMTMode("QTGMC", 2)
    v=D2VSource("Bring Me the Horizon feat. Aurora - liMOusine (Summer Sonic Festival, Japan, 18-08-2024) original_track1_[und].d2v")
    a=LWLibavAudioSource("Bring Me the Horizon feat. Aurora - liMOusine (Summer Sonic Festival, Japan, 18-08-2024) original_track1_[und]_DELAY -31ms.wav")
    AudioDub(v, a).DelayAudio(-0.031) # in seconds
    AssumeTFF()
    AssumeFPS(29.970)
    TFM(slow=2, pp=7, clip2=QTGMC(preset="Slow", FPSDivisor=2, Sharpness=0.5)).TDecimate() # IVTC
    Deblock_QED(quant1=35, quant2=35)
    TTempSmooth() # light denoising
    Prefetch(4)
    And the result if you're interested to check it out: https://mega.nz/file/b5pSWCDZ#UaEhk63eMupAy4CQnUunZe3h_6yCFqet0k1cK5Pu0t4
    The problem with that method is there are dropped frames, jumps in the motion; some stutters and duplicates when you compare it to the other method.

    There are single frame drops, but there are some obvious jumps where there are more than consecutive frame missing
    1697-1698 (2 frames missing)
    3246-3247 (2 frames missing)
    6082-6083 (2 frames missing)
    6083-6084 (2 frames missing)
    7025-7026 (2 frames missing)

    single drops
    3111-3112
    6389-6390
    6837-6838

    8842 missing

    duplicates
    650-651
    4429-4430
    5247-5248
    6080-6081
    6674-6675
    7024-7025
    7570-7571
    7840-7841

    This isn't the full list, but there should be 84 drops if you do the math, not including the duplicates



    @poisondeathray: Thanks for trying to help but apparently the original audio didn't have gaps. Anyway, that's useful knowledge in case I have to deal with audio gaps (and I recently did and I fixed them by manually copy pasting small parts into the gaps using Audacity).
    It's not "audio gaps" per se - the term is relative to the video timestamps . Since the audio is shorter , the timestamps dictate video speed changes (slows down in sections) to keep sync in the original video

    ie . Instead of fixing the audio, you're now shortening the video by dropping good frames to match the shorter audio . I don't know if eac3to method is the "best" way to handle the audio, but I personally wouldn't be dropping good frames and causing jumps and stutters
    Quote Quote  
  24. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    I did a dupe check using DupMC on my script in post #23 and it didn't come up with any dupes.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!