VideoHelp Forum




+ Reply to Thread
Results 1 to 11 of 11
  1. Hello, everyone!

    I have a question that I hope you can help me out with. So I have a few files, most of them .ts, that were cut using LosslessCut and FFmpeg-CLI. So, most of these files have audio delay issues. But after cutting/trimming or simply remuxing them using Avidemux, the issue seems to go away automatically. Here's a MediaInfo log of one file with the issue, and then I will post the log for the file fixed by Avidemux. So, for the file with the problem:

    Code:
    Complete name                            : C:\Users\Videos\cuts\video with audio delay issue.ts
    Format                                   : MPEG-TS
    File size                                : 203 MiB
    Duration                                 : 4 min 18 s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 6 589 kb/s
    Frame rate                               : 25.000 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                                 : 4 min 18 s
    Bit rate                                 : 5 810 kb/s
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Active Format Description                : Letterbox 16:9 image, with alternative 14:9 center
    Frame rate                               : 25.000 FPS
    Standard                                 : Component
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : MBAFF
    Scan type, store method                  : Separated fields
    Scan order                               : Top Field First
    Bits/(Pixel*Frame)                       : 0.112
    Stream size                              : 179 MiB (88%)
    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                                 : 4 min 19 s
    Bit rate mode                            : Constant
    Bit rate                                 : 192 kb/s
    Channel(s)                               : 2 channels
    Channel layout                           : L R
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Compression mode                         : Lossy
    Delay relative to video                  : -1 s 296 ms
    Stream size                              : 5.94 MiB (3%)
    Language                                 : English
    Service kind                             : Complete Main
    Dialog Normalization                     : -23 dB
    compr                                    : -0.28 dB
    dsurmod                                  : Not Dolby Surround encoded
    mixlevel                                 : 281 dB
    roomtyp                                  : 3
    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                                 : 4 min 19 s
    Bit rate mode                            : Constant
    Bit rate                                 : 256 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                  : -1 s 320 ms
    Stream size                              : 7.92 MiB (4%)
    Language                                 : nar
    So, as you can see, the duration for the video track and the two audio tracks aren't the same. Also, the "Delay relative to video" value on this file is over 1 seconds. Now, look at what Avidemux brought that value down to:

    Code:
    ID                                       : 1 (0x1)
    Complete name                            : C:\Users\Videos\cuts\video with audio delay issues fixed by Avidemux.ts
    Format                                   : MPEG-TS
    File size                                : 204 MiB
    Duration                                 : 4 min 18 s
    Overall bit rate mode                    : Variable
    Overall bit rate                         : 6 613 kb/s
    Frame rate                               : 25.000 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                                 : 4 min 18 s
    Bit rate                                 : 5 834 kb/s
    Width                                    : 1 920 pixels
    Height                                   : 1 080 pixels
    Display aspect ratio                     : 16:9
    Active Format Description                : Letterbox 16:9 image, with alternative 14:9 center
    Frame rate                               : 25.000 FPS
    Standard                                 : Component
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : MBAFF
    Scan type, store method                  : Separated fields
    Scan order                               : Top Field First
    Bits/(Pixel*Frame)                       : 0.113
    Stream size                              : 180 MiB (88%)
    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                                 : 4 min 18 s
    Bit rate mode                            : Constant
    Bit rate                                 : 192 kb/s
    Channel(s)                               : 2 channels
    Channel layout                           : L R
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Compression mode                         : Lossy
    Delay relative to video                  : 48 ms
    Stream size                              : 5.91 MiB (3%)
    Language                                 : English
    Service kind                             : Complete Main
    Dialog Normalization                     : -23 dB
    compr                                    : -0.28 dB
    dsurmod                                  : Not Dolby Surround encoded
    mixlevel                                 : 281 dB
    roomtyp                                  : 3
    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                                 : 4 min 18 s
    Bit rate mode                            : Constant
    Bit rate                                 : 256 kb/s
    Channel(s)                               : 2 channels
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 41.667 FPS (1152 SPF)
    Compression mode                         : Lossy
    Stream size                              : 7.88 MiB (4%)
    Language                                 : nar
    This is after simply remuxing the file to .ts. Look at how all the tracks are of the same length now. Also, the audio delay value is much better in comparison to the whole second it previously was. The second track doesn't even have any delay issues anymore.

    So, I was wondering, that since Avidemux relies heavily on FFmpeg for its operations, and the fact it used FFmpeg's MPEG-TS muxer, if there's an FFmpeg command I can apply to such files to automatically correct any issues? A command would especially be useful since it would allow me to preserve data that Avidemux currently doesn't support but FFmpeg does, like DVB and Teletext Subtitles.

    Avidemux's ability to handle audio delay problems is very much like VideoRedo's ability to do so. I wish other programs like LosslessCut too had this, or maybe they will have soon if the specific way is figured out and proposed to their developers.

    Thanks in advance, and hope you all have a wonderful day!
    Quote Quote  
  2. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Post a sample.
    Quote Quote  
  3. Originally Posted by rgr View Post
    Post a sample.
    Sure, but I wonder if a sample would help. This is typical with all files.

    P.S. These videos contain a musical performance, which may have copyright, so fingers crossed, I don't get flagged, as this might actually be grounds for fair use.
    Image Attached Files
    Quote Quote  
  4. Your sample video has some errors, e.g. the video stream is defective and all other streams are longer than the video stream and have to be shortened by 1300ms at the beginning.
    The Avidemux remux improves things a little, but is not perfect either.
    You should check your video handling.
    Quote Quote  
  5. Originally Posted by ProWo View Post
    Your sample video has some errors, e.g. the video stream is defective and all other streams are longer than the video stream and have to be shortened by 1300ms at the beginning.
    The Avidemux remux improves things a little, but is not perfect either.
    You should check your video handling.
    Could you clarify what you mean by the video stream being defective? I have a hunch that it might not be the source of the issue, but I could be mistaken.

    I've noticed that the other streams are generally longer than the video, probably because they were edited using FFmpeg or a related GUI. This tends to happen with a lot of files processed using FFmpeg. However, I’ve seen that when using Avidemux, this problem is either minimal or doesn’t occur as often. And when it does happen, a quick remux usually resolves it. I'm really curious about how Avidemux handles this. It looks like it depends on FFmpeg and its MPEG-TS muxer, so maybe there's a specific command or filter within FFmpeg that could achieve the same result. If Avidemux supported DVB and Teletext subtitles, or Dolby E—which I work with a lot and FFmpeg handles easily—I would definitely use it for all my editing needs.
    Quote Quote  
  6. Originally Posted by simon744 View Post
    Could you clarify what you mean by the video stream being defective? I have a hunch that it might not be the source of the issue, but I could be mistaken.
    It seems to be messed up by Losslesscut. The source file was 50fps and at the cut there was recoded a bunch of frames with 25fps.
    The file can't be remuxed to mkv or mp4 with ffmpeg
    Quote Quote  
  7. Originally Posted by ProWo View Post
    Originally Posted by simon744 View Post
    Could you clarify what you mean by the video stream being defective? I have a hunch that it might not be the source of the issue, but I could be mistaken.
    It seems to be messed up by Losslesscut. The source file was 50fps and at the cut there was recoded a bunch of frames with 25fps.
    The file can't be remuxed to mkv or mp4 with ffmpeg
    Isn’t that the field rate since this video is interlaced? The result is the same even with VideoReDo and Avidemux. I am testing out on LosslessCut and FFmpeg CLI because I know I can’t rely on VDRD for long, and Avidemux currently doesn’t support some common stuff I work with.

    I just want to find the filter or command that automatically works the audio delay values out to an acceptable number.
    Quote Quote  
  8. You can open the log file under AppData\Local\avidemux , and tells you what it does.

    It's not a single filter or command . It's a bunch of calculations and adjustments and it tries to fix the timestamp errors
    Quote Quote  
  9. Originally Posted by poisondeathray View Post
    You can open the log file under AppData\Local\avidemux , and tells you what it does.

    It's not a single filter or command . It's a bunch of calculations and adjustments and it tries to fix the timestamp errors
    Too bad there isn't (?) a simple solution. I'd post the log, but I'm not sure if it provides a good answer to this question.
    Quote Quote  
  10. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Are the TS files from some recorder? Such files are often difficult to convert, I suppose they have a lot of "glitches" in the timecodes.

    You can first "fix" them, e.g. with ffmpeg, and only then cut them with Lossless Cut.
    Or the best is to simply convert/edit them in some video editor.
    Quote Quote  



Similar Threads

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