Skip to content

Automatic Audio Delay Correction #2528

Closed as duplicate
Closed as duplicate

Description

@AmBintroGoof99

The fewer issues I have to read, the more new features I will have time to implement, so I ask that you please try these things first

Description

Hi and thanks for this WONDERFUL app! I've been using it for close to 2 years and can safely say it's blown most of the "competition" out of the park. On Normal Cut mode, you get truly frame-accurate lossless cuts, with every codec, including some of the exotic ones, supported, which is something not all editors can do. It's also very fast. However, there's room for improvement, and one of the ways it can be made better is by the addition of this one feature, which most similar apps have. That's the automatic audio delay correction.

Usually, most of the cuts made using LosslessCut have very high "delay relative to video" values in the audio, and it can be so bad that the audio is behind by a whole second. The audio and video durations sometimes aren't the same. That is so even if the cuts are accurate. Remuxing the file using Avidemux or VDRD usually brings these values down or eliminates them, completely. This also makes the duration for all the tracks the same, even if the only thing done was a simple remux.

Here's an example. This file was cut using LosslessCut, and has the problem I am describing. MediaInfo:

General
ID                                       : 1 (0x1)
Format                                   : MPEG-TS
File size                                : 420 MiB
Duration                                 : 6 min 10 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 9 498 kb/s
Frame rate                               : 29.970 FPS

Video
ID                                       : 256 (0x100)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : 27
Duration                                 : 6 min 10 s
Bit rate mode                            : Variable
Bit rate                                 : 8 446 kb/s
Maximum bit rate                         : 18.1 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Active Format Description                : Full frame 16:9 image
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 0)
Bit depth                                : 8 bits
Scan type                                : MBAFF
Scan type, store method                  : Interleaved fields
Scan order                               : Top Field First
Bits/(Pixel*Frame)                       : 0.136
Time code of first frame                 : 00:00:00:00
Stream size                              : 373 MiB (89%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio #1
ID                                       : 257 (0x101)
Menu ID                                  : 1 (0x1)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : 129
Duration                                 : 6 min 11 s
Bit rate mode                            : Constant
Bit rate                                 : 384 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -245 ms
Stream size                              : 17.0 MiB (4%)
Language                                 : Portuguese
Service kind                             : Complete Main
Dialog Normalization                     : -23 dB
compr                                    : -0.28 dB
cmixlev                                  : -3.0 dB
surmixlev                                : -3 dB
dmixmod                                  : Lo/Ro
ltrtcmixlev                              : -3.0 dB
ltrtsurmixlev                            : -3.0 dB
lorocmixlev                              : -3.0 dB
lorosurmixlev                            : -3.0 dB
dialnorm_Average                         : -23 dB
dialnorm_Minimum                         : -23 dB
dialnorm_Maximum                         : -23 dB

Audio #2
ID                                       : 258 (0x102)
Menu ID                                  : 1 (0x1)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : 3
Duration                                 : 6 min 11 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Frame rate                               : 41.667 FPS (1152 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -261 ms
Stream size                              : 8.49 MiB (2%)
Language                                 : English

Menu
ID                                       : 4096 (0x1000)
Menu ID                                  : 1 (0x1)
Format                                   : AVC / AC-3 / MPEG Audio
Duration                                 : 6 min 10 s
List                                     : 256 (0x100) (AVC) / 257 (0x101) (AC-3, Portuguese) / 258 (0x102) (MPEG Audio, English)
Language                                 :  / Portuguese / English
Service name                             : Service01
Service provider                         : FFmpeg
Service type                             : digital television

Notice how the duration of the audio and video tracks isn't the same, and also the very high "delay relative to video" values on the audio tracks. Now, take a look at the MediaInfo log for the same file remuxed using Avidemux:

General
ID                                       : 1 (0x1)
Format                                   : MPEG-TS
File size                                : 422 MiB
Duration                                 : 6 min 10 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 9 547 kb/s
Frame rate                               : 29.970 FPS

Video
ID                                       : 256 (0x100)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : 27
Duration                                 : 6 min 10 s
Bit rate mode                            : Variable
Bit rate                                 : 8 493 kb/s
Maximum bit rate                         : 18.1 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Active Format Description                : Full frame 16:9 image
Frame rate                               : 29.970 (30000/1001) FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 0)
Bit depth                                : 8 bits
Scan type                                : MBAFF
Scan type, store method                  : Interleaved fields
Scan order                               : Top Field First
Bits/(Pixel*Frame)                       : 0.137
Time code of first frame                 : 00:00:00:00
Stream size                              : 375 MiB (89%)
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio #1
ID                                       : 257 (0x101)
Menu ID                                  : 1 (0x1)
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : 129
Duration                                 : 6 min 10 s
Bit rate mode                            : Constant
Bit rate                                 : 384 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Delay relative to video                  : 11 ms
Stream size                              : 17.0 MiB (4%)
Language                                 : Portuguese
Service kind                             : Complete Main
Dialog Normalization                     : -23 dB
compr                                    : -0.28 dB
cmixlev                                  : -3.0 dB
surmixlev                                : -3 dB
dmixmod                                  : Lo/Ro
ltrtcmixlev                              : -3.0 dB
ltrtsurmixlev                            : -3.0 dB
lorocmixlev                              : -3.0 dB
lorosurmixlev                            : -3.0 dB
dialnorm_Average                         : -23 dB
dialnorm_Minimum                         : -23 dB
dialnorm_Maximum                         : -23 dB

Audio #2
ID                                       : 258 (0x102)
Menu ID                                  : 1 (0x1)
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 2
Codec ID                                 : 3
Duration                                 : 6 min 10 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 kHz
Frame rate                               : 41.667 FPS (1152 SPF)
Compression mode                         : Lossy
Delay relative to video                  : 3 ms
Stream size                              : 8.48 MiB (2%)
Language                                 : English

Menu
ID                                       : 4096 (0x1000)
Menu ID                                  : 1 (0x1)
Format                                   : AVC / AC-3 / MPEG Audio
Duration                                 : 6 min 10 s
List                                     : 256 (0x100) (AVC) / 257 (0x101) (AC-3, Portuguese) / 258 (0x102) (MPEG Audio, English)
Language                                 :  / Portuguese / English
Service name                             : Service01
Service provider                         : FFmpeg
Service type                             : digital television

This made the duration for all the tracks the same, brought down the audio delay values. BUT, since Avidemux doesn't support the same wide range of codecs and formats that LosslessCut does, thanks to FFmpeg, this got rid of the DVB Subtitle present in the original file that LosslessCut had preserved from the original file. The same also applies to/for some other codecs like Dolby E, etc. that LosslessCut can work with, but Avidemux can't.

So, it'd be so wonderful if this feature was implemented in the upcoming build/release version for LosslessCut. It's such a vital and basic feature for video editing programs, and its addition to LosslessCut would truly set it apart from everything. Again THANKS, and best of wishes.

Activity

  1. AmBintroGoof99 commented on Sep 5, 2025

    @AmBintroGoof99
    Author

    Please, take a look at this. It's causing so many headaches. Also, sorting this out will make the app even better!

  2. mifi commented on Sep 6, 2025

    @mifi
    Owner

    Hi. Have you tried changing advanced settings like avoid_negative_ts and see if that makes any difference? see https://github.com/mifi/lossless-cut/blob/master/issues.md#cutting-times-are-not-accurate

    I'm suspecting the duration difference is a side-effect from the cutting process, and it could be a limitation or bug in ffmpeg. Does it happen with all files or only certain types?

    Whenever I cut files with normal mode, I always get a black portion of video before the first keyframe after the cut, so I'm not sure how you're seeing frame-accurate cuts in this mode?

  3. AmBintroGoof99 commented on Sep 7, 2025

    @AmBintroGoof99
    Author

    Thanks for responding! Yes, I've tried everything! The results are the same using every mode, and any file (except with Normal Cut mode, I've found that the cuts are actually frame-accurate like VDRD...done my testing and still doing).

    What I'd like to see implemented is LosslessCut automatically normalizing, handling audio delay the same way Avidemux does. I'm assuming it can be done using FFmpeg because Avidemux too uses FFmpeg's MPEG-TS muxer (this also works on Avidemux's other muxers).

  4. AmBintroGoof99 commented on Sep 7, 2025

    @AmBintroGoof99
    Author

    When you remux the files cut using Normal Cut mode with a program like Avidemux or VDRD, both fix the high audio delay values that LC's output came out with. And if you then play them back to back, side by side, you'll notice that LosslessCut's outputs are frame-accurate. I've tried this out by cutting the same file using the exact same cutpoints using VDRD-TVSuite and LosslessCut's Normal Cut mode. They are exactly the same with regards to the frame-accuracy. LC's outputs do the weird duration differences and the audio delay values, but you can tell it's almost exactly the same thing VDRD outputted.

    You just need it to deal with these high audio delay values and correct any abnormalities, so the frame-accurate cutting abilities are more "visible".

  5. AmBintroGoof99 commented on Sep 7, 2025

    @AmBintroGoof99
    Author

    @mifi If you want to, I can privately share some of the files I've tested these on, so you can see for yourself.

  6. mifi commented on Sep 12, 2025

    @mifi
    Owner

    Ok you can send to losslesscut@mifi.no

  7. mifi commented on Nov 1, 2025

    @mifi
    Owner

    Did you send a file? I forgot

  8. AmBintroGoof99 commented on Nov 3, 2025

    @AmBintroGoof99
    Author

    Did you send a file? I forgot

    Hi, and am soooo incredibly for forgetting about this. It's just a lot happened to me after I wrote in my last message, and this somewhat disappeared from my mind. I'll be sending them immediately after also submitting some more useful data about the files. I'll also be including an FFprobe log in addition to the MediaInfo ones. So, these are the logs for the faulty file.

    FFprobe:

    C:\Users\user01\Videos\ffmpeg\ffmpeg-8.0-full_build>ffprobe -hide_banner -i "C:\Users\user01\Videos\Captures\video cutting tests\faulty file.ts"
    [mpegts @ 0000024fae194f80] start time for stream 3 is not set in estimate_timings_from_pts
    Input #0, mpegts, from 'C:\Users\user01\Videos\Captures\video cutting tests\faulty file.ts':
      Duration: 00:06:11.13, start: 1.407000, bitrate: 9492 kb/s
      Program 1
        Metadata:
          service_name    : Service01
          service_provider: FFmpeg
      Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, start 1.668200
      Stream #0:1[0x101](por): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s, start 1.423000
      Stream #0:2[0x102](eng): Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s, start 1.407000
      Stream #0:3[0x103](leg): Subtitle: dvb_subtitle (dvbsub) ([6][0][0][0] / 0x0006), start 1.407000
    

    And the MediaInfo:

    General
    ID                                       : 1 (0x1)
    Complete name                            : C:\Users\user01\Videos\Captures\video cutting tests\faulty file.ts
    Format                                   : MPEG-TS
    File size                                : 420 MiB
    Duration                                 : 6 min 10 s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 9 498 kb/s
    Frame rate                               : 29.970 FPS
    
    Video
    ID                                       : 256 (0x100)
    Menu ID                                  : 1 (0x1)
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4
    Format settings                          : CABAC / 4 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, Reference frames        : 4 frames
    Codec ID                                 : 27
    Duration                                 : 6 min 10 s
    Bit rate mode                            : Variable
    Bit rate                                 : 8 446 kb/s
    Maximum bit rate                         : 18.1 Mb/s
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Active Format Description                : Full frame 16:9 image
    Frame rate                               : 29.970 (30000/1001) FPS
    Standard                                 : Component
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0 (Type 0)
    Bit depth                                : 8 bits
    Scan type                                : MBAFF
    Scan type, store method                  : Interleaved fields
    Scan order                               : Top Field First
    Bits/(Pixel*Frame)                       : 0.136
    Time code of first frame                 : 00:00:00:00
    Stream size                              : 373 MiB (89%)
    Color range                              : Limited
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    
    Audio #1
    ID                                       : 257 (0x101)
    Menu ID                                  : 1 (0x1)
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Commercial name                          : Dolby Digital
    Codec ID                                 : 129
    Duration                                 : 6 min 11 s
    Bit rate mode                            : Constant
    Bit rate                                 : 384 kb/s
    Channel(s)                               : 6 channels
    Channel layout                           : L R C LFE Ls Rs
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Compression mode                         : Lossy
    Delay relative to video                  : -245 ms
    Stream size                              : 17.0 MiB (4%)
    Language                                 : Portuguese
    Service kind                             : Complete Main
    Dialog Normalization                     : -23 dB
    compr                                    : -0.28 dB
    cmixlev                                  : -3.0 dB
    surmixlev                                : -3 dB
    dmixmod                                  : Lo/Ro
    ltrtcmixlev                              : -3.0 dB
    ltrtsurmixlev                            : -3.0 dB
    lorocmixlev                              : -3.0 dB
    lorosurmixlev                            : -3.0 dB
    dialnorm_Average                         : -23 dB
    dialnorm_Minimum                         : -23 dB
    dialnorm_Maximum                         : -23 dB
    
    Audio #2
    ID                                       : 258 (0x102)
    Menu ID                                  : 1 (0x1)
    Format                                   : MPEG Audio
    Format version                           : Version 1
    Format profile                           : Layer 2
    Codec ID                                 : 3
    Duration                                 : 6 min 11 s
    Bit rate mode                            : Constant
    Bit rate                                 : 192 kb/s
    Channel(s)                               : 2 channels
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 41.667 FPS (1152 SPF)
    Compression mode                         : Lossy
    Delay relative to video                  : -261 ms
    Stream size                              : 8.49 MiB (2%)
    Language                                 : English
    
    Menu
    ID                                       : 4096 (0x1000)
    Menu ID                                  : 1 (0x1)
    Format                                   : AVC / AC-3 / MPEG Audio
    Duration                                 : 6 min 10 s
    List                                     : 256 (0x100) (AVC) / 257 (0x101) (AC-3, Portuguese) / 258 (0x102) (MPEG Audio, English)
    Language                                 :  / Portuguese / English
    Service name                             : Service01
    Service provider                         : FFmpeg
    Service type                             : digital television
    

    And for the fixed file...FFprobe:

    C:\Users\user01\Videos\ffmpeg\ffmpeg-8.0-full_build>ffprobe -hide_banner -i "C:\Users\user01\Videos\Captures\video cutting tests\fixed file.ts"
    Input #0, mpegts, from 'C:\Users\user01\Videos\Captures\video cutting tests\fixed file.ts':
      Duration: 00:06:10.87, start: 0.204200, bitrate: 9546 kb/s
      Program 1
        Metadata:
          service_name    : Service01
          service_provider: FFmpeg
      Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, start 0.204200
      Stream #0:1[0x101](por): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s, start 0.215000
      Stream #0:2[0x102](eng): Audio: mp2 (mp3float) ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s, start 0.207000
    

    MediaInfo:

    General
    ID                                       : 1 (0x1)
    Complete name                            : C:\Users\user01\Videos\Captures\video cutting tests\fixed file.ts
    Format                                   : MPEG-TS
    File size                                : 422 MiB
    Duration                                 : 6 min 10 s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 9 547 kb/s
    Frame rate                               : 29.970 FPS
    
    Video
    ID                                       : 256 (0x100)
    Menu ID                                  : 1 (0x1)
    Format                                   : AVC
    Format/Info                              : Advanced Video Codec
    Format profile                           : High@L4
    Format settings                          : CABAC / 4 Ref Frames
    Format settings, CABAC                   : Yes
    Format settings, Reference frames        : 4 frames
    Codec ID                                 : 27
    Duration                                 : 6 min 10 s
    Bit rate mode                            : Variable
    Bit rate                                 : 8 493 kb/s
    Maximum bit rate                         : 18.1 Mb/s
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Active Format Description                : Full frame 16:9 image
    Frame rate                               : 29.970 (30000/1001) FPS
    Standard                                 : Component
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0 (Type 0)
    Bit depth                                : 8 bits
    Scan type                                : MBAFF
    Scan type, store method                  : Interleaved fields
    Scan order                               : Top Field First
    Bits/(Pixel*Frame)                       : 0.137
    Time code of first frame                 : 00:00:00:00
    Stream size                              : 375 MiB (89%)
    Color range                              : Limited
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709
    
    Audio #1
    ID                                       : 257 (0x101)
    Menu ID                                  : 1 (0x1)
    Format                                   : AC-3
    Format/Info                              : Audio Coding 3
    Commercial name                          : Dolby Digital
    Codec ID                                 : 129
    Duration                                 : 6 min 10 s
    Bit rate mode                            : Constant
    Bit rate                                 : 384 kb/s
    Channel(s)                               : 6 channels
    Channel layout                           : L R C LFE Ls Rs
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Compression mode                         : Lossy
    Delay relative to video                  : 11 ms
    Stream size                              : 17.0 MiB (4%)
    Language                                 : Portuguese
    Service kind                             : Complete Main
    Dialog Normalization                     : -23 dB
    compr                                    : -0.28 dB
    cmixlev                                  : -3.0 dB
    surmixlev                                : -3 dB
    dmixmod                                  : Lo/Ro
    ltrtcmixlev                              : -3.0 dB
    ltrtsurmixlev                            : -3.0 dB
    lorocmixlev                              : -3.0 dB
    lorosurmixlev                            : -3.0 dB
    dialnorm_Average                         : -23 dB
    dialnorm_Minimum                         : -23 dB
    dialnorm_Maximum                         : -23 dB
    
    Audio #2
    ID                                       : 258 (0x102)
    Menu ID                                  : 1 (0x1)
    Format                                   : MPEG Audio
    Format version                           : Version 1
    Format profile                           : Layer 2
    Codec ID                                 : 3
    Duration                                 : 6 min 10 s
    Bit rate mode                            : Constant
    Bit rate                                 : 192 kb/s
    Channel(s)                               : 2 channels
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 41.667 FPS (1152 SPF)
    Compression mode                         : Lossy
    Delay relative to video                  : 3 ms
    Stream size                              : 8.48 MiB (2%)
    Language                                 : English
    
    Menu
    ID                                       : 4096 (0x1000)
    Menu ID                                  : 1 (0x1)
    Format                                   : AVC / AC-3 / MPEG Audio
    Duration                                 : 6 min 10 s
    List                                     : 256 (0x100) (AVC) / 257 (0x101) (AC-3, Portuguese) / 258 (0x102) (MPEG Audio, English)
    Language                                 :  / Portuguese / English
    Service name                             : Service01
    Service provider                         : FFmpeg
    Service type                             : digital television
    

    Notice how the fixed file no longer has any errors, unlike the faulty one. Even though it lost the DVB subs. But still.

  9. mifi commented on Nov 4, 2025

    @mifi
    Owner

    Thanks for sending over. You probably already tried it, but I opened the faulty file in losslesscut and then simply remuxed it to .mov inside losslesscut. Then the output file no longer has the "Delay relative to video" metadata. I don't know if that did anything though wrt to the audio sync. I don't really know how to test for the audio sync either, because if it's just 245ms, it's so short that my eyes/ears cannot really notice it either

  10. AmBintroGoof99 commented on Nov 4, 2025

    @AmBintroGoof99
    Author

    Thanks for sending over. You probably already tried it, but I opened the faulty file in losslesscut and then simply remuxed it to .mov inside losslesscut. Then the output file no longer has the "Delay relative to video" metadata. I don't know if that did anything though wrt to the audio sync. I don't really know how to test for the audio sync either, because if it's just 245ms, it's so short that my eyes/ears cannot really notice it either

    Thank you so much for responding. Yes, but .mov isn't always ideal for storing HDTV captures, especially when they contain codecs/formats like DVB Subtitles, Teletext, or audio only encapsulated within transport streams.

    I don't know what I can do to help you out further with this, but it really would be so great if LosslssCut comes to be able to do this.

    I also have some other files with such problems that I can go into detail about, if you'd like.

  11. mifi commented on Nov 6, 2025

    @mifi
    Owner

    This is really ffmpeg-specific internals, so it's a bit out my league unfortunately. If someone can find an ffmpeg command that can auto correct these delays, then that would be something I could consider adding to LosslessCut but I'm quite clueless how to test this (especially how to verify whether or not the delay is fixed)

  12. AmBintroGoof99 commented on Nov 6, 2025

    @AmBintroGoof99
    Author

    This is really ffmpeg-specific internals, so it's a bit out my league unfortunately. If someone can find an ffmpeg command that can auto correct these delays, then that would be something I could consider adding to LosslessCut but I'm quite clueless how to test this (especially how to verify whether or not the delay is fixed)

    Thank you! The way I'd tell they are fixed is by either looking for the "delay relative to video" part to see if it's still there, or look at the value that's next to it. For example, on some of these files, the section and the values don't always disappear, but they're "normalized."

    What about LosslessCut's ability to "fix" errors within files, especially .ts? I have one .ts file with MPEG2 video, a few MP2 audio tracks and Dolby E audio. It initially had some errors unedited. I cut the redundant parts out of it with LosslessCut, and the cuts were frame-accurate (I used the Normal Cut mode). However, only about half of the Dolby E audio was preserved. I remuxed the uncut .ts file using VDRD, and got back to LosslessCut again to make the cuts again. This time, not only were the cuts frame-accurate like the first time, but also all the audio tracks, including the Dolby E were preserved in full length.

    There were also times when clips cut from that same file or other files using LosslessCut had lots of errors, including audio delay-related, and simply remuxing the files using Avidemux and/or VDRD got rid of the errors completely.

  13. AmBintroGoof99 commented on Nov 6, 2025

    @AmBintroGoof99
    Author

    Also, I don't mean to compare LosslessCut with other "competing" apps in a negative way when referencing them. LosslessCut was and is easily the best one around. A lot of well-known apps, and even VDRD most likely wouldn't stand a chance next to it if they were still in development today.

    It's just that LosslessCut would become truly untoppable if these features were figured out and added to it.

  14. mifi commented on Nov 7, 2025

    @mifi
    Owner

    Interesting. Hmm like I said I'm not really experienced with this, but if I run this command, it brings the delay (according to mediainfo) down to a few ms:

    ffmpeg -hide_banner -i '2528 faulty file.ts' -itsoffset 0 -i '2528 faulty file.ts' -map '0:0' '-c:0' copy -map '1:1' '-c:1' copy -map '1:2' '-c:2' copy -map '1:3' '-c:3' copy -map_metadata 0 -ignore_unknown -strict experimental -f mpegts -y '2528 faulty file-out.ts'

    Notice the -itsoffset 0 applied all the audio/subtitle tracks. Does that solve your problem?

    Probably related #216

  15. AmBintroGoof99 commented on Nov 7, 2025

    @AmBintroGoof99
    Author

    Interesting. Hmm like I said I'm not really experienced with this, but if I run this command, it brings the delay (according to mediainfo) down to a few ms:

    ffmpeg -hide_banner -i '2528 faulty file.ts' -itsoffset 0 -i '2528 faulty file.ts' -map '0:0' '-c:0' copy -map '1:1' '-c:1' copy -map '1:2' '-c:2' copy -map '1:3' '-c:3' copy -map_metadata 0 -ignore_unknown -strict experimental -f mpegts -y '2528 faulty file-out.ts'
    Notice the -itsoffset 0 applied all the audio/subtitle tracks. Does that solve your problem?

    Probably related #216

    Thank you soo very much for your help. However, that command only got me the following error:

    Trailing garbage after stream specifier: '0:0'
    Failed to set value ''0:0'' for option 'map': Invalid argument
    Error parsing options for output file '-c:0'.
    Error opening output files: Invalid argument
    

    I also tried with -map 0 but that didn't help, either.

    Sorry if am bugging you with this.

  16. AmBintroGoof99 commented on Nov 7, 2025

    @AmBintroGoof99
    Author

    Should the value for itsoffset be 0 for the audio delay values to go down automatically?

  17. mifi commented on Nov 7, 2025

    @mifi
    Owner

    are you on windows? if so, maybe you need to convert single quotes into double quotes. you can ask chatgpt also about these kinds of command errors

  18. AmBintroGoof99 commented on Nov 7, 2025

    @AmBintroGoof99
    Author

    are you on windows? if so, maybe you need to convert single quotes into double quotes. you can ask chatgpt also about these kinds of command errors

    Yes, on Windows 10. Will try that out tomorrow. Hopefully it'll work this time, and a more stable, straightforward solution will be found for this.

  19. AmBintroGoof99 commented on Nov 9, 2025

    @AmBintroGoof99
    Author

    @mifi Hello again, kind man! I just tested the command again with double quotes instead of single, and this time, it worked! THANK YOU SOO MUCH! It worked almost exactly as I expected. It even worked with some little-known, exotic format/codecs like Dolby E.

    However, it does seem to have a bit of a problem with DVB and Teletext [subs], in particular, it seems. Because, whenever I'd also map, include them to be carried over to the output, in the resulting file, the video would be unplayable. As soon as I modified the command to exclude the said track[s], it'd go back to normal. I'd really appreciate you "investigating" this, if possible, and also adding this to the app's GUI so that we don't have to run this command every single time for this specific task/operation, PLEASE! I guarantee you it's a touch EVERYONE would love added to their video.

    Let me know if you need additional sample files of what worked and didn't work with this command. Again, THANKS SOOO MUCH! You truly are wonderful!

  20. AmBintroGoof99 commented on Nov 9, 2025

    @AmBintroGoof99
    Author

    I'm testing this command on multiple files with different codecs and formats to see how it works on different stuff. On one file, it brings the value from -400 to 400ms, not to something like 1 or 20, for example. On others, it brings the value down from -300 to zero, or to 18ms. Some have the values fixed, but aren't played back by some media players. I would do my own research but I don't know where to post this to get a good answer. Hopefully, a solution will be found. This is working almost perfectly, with a few problems to be figured out and worked around.

  21. mifi commented on Nov 11, 2025

    @mifi
    Owner

    Ok so it's not a silver bullet. TBH I don't know exactly how that command works. I've tried chatgpt but i cannot figure out why -itsoffset 0 even makes a difference. this needs more research and knowledge to solve. I think it's basically the same as #216 (you want to adjust individual tracks offset, right?) - so i'll close this issue but discussion can continue here and in #216

  22. AmBintroGoof99 commented on Nov 11, 2025

    @AmBintroGoof99
    Author

    Thank you for your help! I will probably have to reach out to FFmpeg developers about this, or even to the Avidemux developers lol.

    I'm sure this is close to getting a solution. Thank you for your help. I will keep you updated on new info on this, and hopefully the fix will be added to LosslessCut once it becomes available.

    Also, just to clarify, will you be notified if a new comment/reply to this is posted?

    Again, thanks soooo much! You are awesome!

  23. AmBintroGoof99 commented on Nov 11, 2025

    @AmBintroGoof99
    Author

    Ok so it's not a silver bullet. TBH I don't know exactly how that command works. I've tried chatgpt but i cannot figure out why -itsoffset 0 even makes a difference. this needs more research and knowledge to solve. I think it's basically the same as #216 (you want to adjust individual tracks offset, right?) - so i'll close this issue but discussion can continue here and in #216

    And yes, I want the delay normalized/corrected/fixed, you name it! lol...on all tracks, basically, but all of that done automatically, with a simple remux. The way it's done with Avidemux and VideoReDo. Thank you very much!

  24. mifi commented on Nov 11, 2025

    @mifi
    Owner

    If you have a file that has a delay which is more noticeable, like 1 second, it would be much easier to test/debug it. Because the 200ms delay in the file you shared is not really visible to me. Especially due to the fact that it’s a concert recording (which could already have delays due to speed of sound propagation). And it’s hard to see lips moving at all.

  25. AmBintroGoof99 commented on Nov 11, 2025

    @AmBintroGoof99
    Author

    If you have a file that has a delay which is more noticeable, like 1 second, it would be much easier to test/debug it. Because the 200ms delay in the file you shared is not really visible to me. Especially due to the fact that it’s a concert recording (which could already have delays due to speed of sound propagation). And it’s hard to see lips moving at all.

    I'm pretty sure I have files with delay that severe. I'll look up and share a few with you.

    I have also tried looking at the logs produced by both Avidemux and VDRD to try and get an idea of what they did with the tracks to achieve what am after, but it's too complicated for me to understand.

  26. AmBintroGoof99 commented on Nov 11, 2025

    @AmBintroGoof99
    Author

    My understanding is that they are reconstructing the DTS/PTS in anything they're fed with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions