VideoHelp Forum
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. Another very frustrating issue that doesn't seem to have an apparent cause.

    I am having audio/video desync issues where the video seems to lag behind the audio by a split second. It seems to occur after I encode the video. The encoded video file plays fine on VLC and a little out of sync on WMP. However, when I upload to Youtube or Vimeo, it gets much worse (particularly on Firefox, though Chrome isn't too much better).

    https://vimeo.com/91603896

    I have tried many tests, but nothing seems to fix it. I did notice however that Mediainfo is saying my compressed video has a variable bit rate, yet I specified constant bit rate (320kbs). When I look in Premiere at the length, the audio appears slightly longer than the video, Mediainfo says 8:15 video vs 8:16 audio. This occurs when I encode with X264/AAC using Avisynth/Megui or Handbrake and even straight from Premiere using H.264/AAC. If I try encoding with WMV or using AC-3 or MP3 as audio codecs, it stays solid CBR and it seems more in sync.

    While this suggests that something is wrong, I still have no idea what is causing the audio/video desync and it is extremely frustrating.

    Details below:

    Original source: 1280x720, 120fps from a video game, audio is from a range of sources (mostly 44100 khz but some higher/lower sample rates)

    Premiere sequence settings: 1280x720, 59.97 fps, progressive, square pixels, 48000khz, stereo

    Export settings: Uncompressed AVI, 1280x720, progressive, square pixels, 59.97 fps (for downloadable copy) or 29.97 fps (for Youtube/Vimeo), 48000khz, stereo, 16 bit sample type

    Avisynth script:

    AVISource("J:\Final Render\59.94 fps\Vimeo\Part 1\Film Sequence Part 1.avi", audio=false).AssumeFPS(30000,1001)
    #deinterlace
    #crop
    #resize
    #denoise
    ConvertToYV12(matrix="rec601")

    Final encode settings (disregard the 59.94 fps folder name, the movie was encoded at 29.97):

    General
    Complete name : J:\Final Render\59.94 fps\Vimeo\Part 1\SWR Ep1 P1.mp4
    Format : MPEG-4
    Format profile : Base Media
    Codec ID : isom
    File size : 434 MiB
    Duration : 8mn 16s
    Overall bit rate mode : Variable
    Overall bit rate : 7 344 Kbps
    Encoded date : UTC 2014-04-09 05:54:02
    Tagged date : UTC 2014-04-09 05:54:02

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4.1
    Format settings, CABAC : Yes
    Format settings, ReFrames : 5 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 8mn 15s
    Bit rate : 7 000 Kbps
    Maximum bit rate : 29.7 Mbps
    Width : 1 280 pixels
    Height : 720 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 29.970 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.253
    Stream size : 415 MiB (96%)
    Writing library : x264 core 138 r2358 9e941d1
    Encoding settings : cabac=1 / ref=5 / deblock=1:-1:0 / analyse=0x3:0x113 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=4 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=30 / keyint_min=15 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=2pass / mbtree=1 / bitrate=7000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
    Encoded date : UTC 2014-04-09 05:48:58
    Tagged date : UTC 2014-04-09 05:54:02

    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : 40
    Duration : 8mn 16s
    Bit rate mode : Variable
    Bit rate : 320 Kbps
    Maximum bit rate : 328 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Stream size : 18.9 MiB (4%)
    Encoded date : UTC 2014-04-09 05:50:04
    Tagged date : UTC 2014-04-09 05:54:02


    What I've tried (all without success):

    -- Tried exporting at 30 fps
    -- Tried resampling some clips at 44100khz and exporting at 44100khz
    -- Tried different sample types
    -- Tried encoding with Handbrake instead of Megui

    I'm looking for a solution to this problem, no matter how tedious. The release of this movie has completely stalled and I'm quite concerned because I have no idea what the cause of the problem is to fix it.
    Quote Quote  
  2. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    This has been discussed in other threads. Basically lossy compressed audio places padding at the beginning. Typically about 20-40ms. That's why premiere "thinks" the audio is longer. So when you encode to AAC, you incur ~40ms , and when vimeo/YT or whatever site re-encodes it again, another 20-40ms is added. Certain encoders place more padding (e.g. neroAAC is typically about 40ms, but qaac is a bit less about 20ms) , certain profiles (HE-AAC) are worse , VBR is worse, and certain containers are worse (e.g. the delay in MKV is better than Mp4) . Some decoders and software compensate for the padding better than others

    There is no perfect solution (unless you use your own hosting), because obviously you have no control over 3rd party handling (e.g. how vimeo or YT re-encodes) , but you can mininize that delay on your end by using uncompressed audio, with MKV container. Certain AAC encoders have control over delay or negative delay options to cut some padding (e.g. qaac)
    Quote Quote  
  3. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Originally Posted by Skysaberer View Post


    I am having audio/video desync issues where the video seems to lag behind the audio by a split second.
    Actually disregard the last post. Your issue is different. Your observed shift is the opposite direction - this is likely some issue with playback / browser/ flash

    If you download the video from vimeo, and play it locally in a software media player - is it in sync ? How about with a local HTML page ?
    Quote Quote  
  4. Originally Posted by poisondeathray View Post
    Originally Posted by Skysaberer View Post


    I am having audio/video desync issues where the video seems to lag behind the audio by a split second.
    Actually disregard the last post. Your issue is different. Your observed shift is the opposite direction - this is likely some issue with playback / browser/ flash

    If you download the video from vimeo, and play it locally in a software media player - is it in sync ? How about with a local HTML page ?
    I downloaded the video from vimeo and played it in VLC and WMP and it's more in sync. It feels slightly off on the occasion (more so in WMP than VLC) like the encoded video would play on my system before I uploaded, but it's at least a bit more watchable.

    I know you said my issue may be a bit different, but would your suggestion of encoding with x264, leaving audio uncompressed and muxing into a mkv help at all?
    Quote Quote  
  5. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Yes, your issue is different.

    It's definitely a playback /browser/configuration issue . The downloaded file is fine locally in a media player.

    The video is better on vimeo in IE, terrible in firefox. It might have something to do with the recent Adobe updates, maybe they broke something in certain browsers

    Those other suggestions in post#2 shouldn't help for your problem - that's a problem present even in the downloaded file (the actual file has the added padding)
    Quote Quote  
  6. Originally Posted by poisondeathray View Post
    Yes, your issue is different.

    It's definitely a playback /browser/configuration issue . The downloaded file is fine locally in a media player.

    The video is better on vimeo in IE, terrible in firefox. It might have something to do with the recent Adobe updates, maybe they broke something in certain browsers

    Those other suggestions in post#2 shouldn't help for your problem - that's a problem present even in the downloaded file (the actual file has the added padding)
    So there's no solution at this point? I did a test upload on Youtube as WMV. It is pretty in sync, but the quality is not comparable to x264 and the colours are a bit dark (can't correct rec/tv values like I can in Avisynth):

    https://www.youtube.com/watch?v=mXCFDnQbU1g&feature=youtu.be

    And I don't even know if I'll be able to upload/play it on Vimeo. This is totally not how I want to release the video, is there nothing else I can try?

    Also does this explain why my video is showing VBR audio on Mediainfo when I encode with Nero AAC instead of the CBR 320 bitrate I plugged into the encoder (this happens on Megui, Handbrake and Premiere)? If the audio was constant bit rate like I asked, maybe the video would be in sync? Still seems a mystery to me.
    Quote Quote  
  7. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Originally Posted by Skysaberer View Post
    So there's no solution at this point? I did a test upload on Youtube as WMV. It is pretty in sync, but the quality is not comparable to x264 and the colours are a bit dark (can't correct rec/tv values like I can in Avisynth):

    https://www.youtube.com/watch?v=mXCFDnQbU1g&feature=youtu.be

    And I don't even know if I'll be able to upload/play it on Vimeo. This is totally not how I want to release the video, is there nothing else I can try?

    Well that' s an interesting observation, but your test setup is flawed - it's only a short sample . For example, the length might have something to do with it

    Test the same short sample using the regular routine, upload that to YT (or maybe you already did that? )

    You can encode wmv using avisynth + wmnicenc . If you use enough bitrate, it will be the same quality on vimeo or youtube. (just the filesize larger to upload) . Unless you enable downloading of the ORIGINAL file on vimeo, you're not "releasing" it as wmv. The end user can only access the re-encoded versions on YT and vimeo


    Also does this explain why my video is showing VBR audio on Mediainfo when I encode with Nero AAC instead of the CBR 320 bitrate I plugged into the encoder (this happens on Megui, Handbrake and Premiere)? If the audio was constant bit rate like I asked, maybe the video would be in sync? Still seems a mystery to me.
    mediainfo is often incorrect about relaying some parameters, but if you use something like AC3 audio, uncompressed audio, those will always be true CBR . It's true that CBR audio will cause fewer problems in many scenarios and applications
    Quote Quote  
  8. Originally Posted by poisondeathray View Post
    Originally Posted by Skysaberer View Post
    So there's no solution at this point? I did a test upload on Youtube as WMV. It is pretty in sync, but the quality is not comparable to x264 and the colours are a bit dark (can't correct rec/tv values like I can in Avisynth):

    https://www.youtube.com/watch?v=mXCFDnQbU1g&feature=youtu.be

    And I don't even know if I'll be able to upload/play it on Vimeo. This is totally not how I want to release the video, is there nothing else I can try?

    Well that' s an interesting observation, but your test setup is flawed - it's only a short sample . For example, the length might have something to do with it

    Test the same short sample using the regular routine, upload that to YT (or maybe you already did that? )

    You can encode wmv using avisynth + wmnicenc . If you use enough bitrate, it will be the same quality on vimeo or youtube. (just the filesize larger to upload) . Unless you enable downloading of the ORIGINAL file on vimeo, you're not "releasing" it as wmv. The end user can only access the re-encoded versions on YT and vimeo


    Also does this explain why my video is showing VBR audio on Mediainfo when I encode with Nero AAC instead of the CBR 320 bitrate I plugged into the encoder (this happens on Megui, Handbrake and Premiere)? If the audio was constant bit rate like I asked, maybe the video would be in sync? Still seems a mystery to me.
    mediainfo is often incorrect about relaying some parameters, but if you use something like AC3 audio, uncompressed audio, those will always be true CBR . It's true that CBR audio will cause fewer problems in many scenarios and applications
    https://vimeo.com/91687990

    Same settings as my long video in first post, but using handbrake instead of megui. It is a bit off sync, particularly in the cuts toward the end. I've been using this section from the video for a lot of my tests as the cuts are bang on the beat.

    Interestingly when I did an earlier encode using Ac3 audio it showed as CBR audio on Mediainfo.

    Thanks for the WM link.
    Quote Quote  
  9. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Yes that's an ok test clip for sync testing.

    Sorry to be a PITA, but that last one was vimeo, not yt . Yes, there are differences between them. It's important to eliminate all the other variables and be methodical in your testing .

    Also, did you use CFR in handbrake, or VFR ? Post mediainfo (view=>text) report of the file you uploaded from handbrake

    I'm curious about your WMV observations, because they throw a partial wrench into the "oh it must be browser playback issue" . But there is definitely a browser/flash playback component to your issue
    Quote Quote  
  10. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Weird. If I take your out of sync on vimeo clip (it's fine when played locally), upload that to YT, it's fine on YT even in firefox

    Definitely some weird browser/flash issues
    Quote Quote  
  11. Originally Posted by poisondeathray View Post
    Yes that's an ok test clip for sync testing.

    Sorry to be a PITA, but that last one was vimeo, not yt . Yes, there are differences between them. It's important to eliminate all the other variables and be methodical in your testing .

    Also, did you use CFR in handbrake, or VFR ? Post mediainfo (view=>text) report of the file you uploaded from handbrake

    I'm curious about your WMV observations, because they throw a partial wrench into the "oh it must be browser playback issue" . But there is definitely a browser/flash playback component to your issue
    Posted the Handbrake tests below, it's definitely CFR. I've found that Youtube is more in sync than Vimeo, but still not entirely. I'm trying to use that WMEnc program at the moment, but not having much luck. Trying some Avisynth scripts, but I'm just getting an audio file without video. Guess I'll have to play around a bit more.


    General
    Complete name : J:\SyncTest\HandbrakeTest.mp4
    Format : MPEG-4
    Format profile : Base Media / Version 2
    Codec ID : mp42
    File size : 16.9 MiB
    Duration : 22s 123ms
    Overall bit rate mode : Variable
    Overall bit rate : 6 399 Kbps
    Recorded date : 2014-04-11T14:00:39.00459+10:00
    Encoded date : UTC 2014-04-11 06:04:02
    Tagged date : UTC 2014-04-11 06:04:34
    Writing application : HandBrake 0.9.9 2013052900

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L3.1
    Format settings, CABAC : Yes
    Format settings, ReFrames : 5 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 22s 122ms
    Bit rate : 6 000 Kbps
    Width : 1 280 pixels
    Height : 720 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 29.970 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.217
    Stream size : 16.1 MiB (95%)
    Writing library : x264 core 130 r2273 b3065e6
    Encoding settings : cabac=1 / ref=5 / deblock=1:-1:0 / analyse=0x3:0x113 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=4 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=300 / keyint_min=30 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=6000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
    Encoded date : UTC 2014-04-11 06:04:02
    Tagged date : UTC 2014-04-11 06:04:34
    Color primaries : BT.709
    Transfer characteristics : BT.709
    Matrix coefficients : BT.709

    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : 40
    Duration : 22s 123ms
    Bit rate mode : Variable
    Bit rate : 303 Kbps
    Maximum bit rate : 350 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Stream size : 818 KiB (5%)
    Encoded date : UTC 2014-04-11 06:04:02
    Tagged date : UTC 2014-04-11 06:04:33
    Quote Quote  
  12. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Originally Posted by Skysaberer View Post


    I'm trying to use that WMEnc program at the moment, but not having much luck. Trying some Avisynth scripts, but I'm just getting an audio file without video. Guess I'll have to play around a bit more.
    In the first post, the avs script where it says audio=false. Change that to audio=true . I'm assuming you exported audio & video together in the AVI. Make sure both "use audio" and "use video" check boxes are checked. I would use wmv9 advanced profile (that's the same as wvc1, which is the higher quality version). VBR video shouldn't matter (you can use VBR quality 100), but you should use CBR audio. Make sure the sample rate matches e.g. 192kb/s 48Khz stereo CBR . Also make sure you enter the frame rate correctly (29.97, not "30")

    Expression encoder can accept avs input as well . It's more of a GUI with more features. WMNicEnc is very minimalistic as you can see - but it's all you really need
    http://www.videohelp.com/tools/Microsoft-Expression-Encoder
    Last edited by poisondeathray; 11th Apr 2014 at 10:54.
    Quote Quote  
  13. Originally Posted by poisondeathray View Post
    Originally Posted by Skysaberer View Post


    I'm trying to use that WMEnc program at the moment, but not having much luck. Trying some Avisynth scripts, but I'm just getting an audio file without video. Guess I'll have to play around a bit more.
    In the first post, the avs script where it says audio=false. Change that to audio=true . I'm assuming you exported audio & video together in the AVI. Make sure both "use audio" and "use video" check boxes are checked. I would use wmv9 advanced profile (that's the same as wvc1, which is the higher quality version). VBR video shouldn't matter (you can use VBR quality 100), but you should use CBR audio. Make sure the sample rate matches e.g. 192kb/s 48Khz stereo CBR . Also make sure you enter the frame rate correctly (29.97, not "30")

    Expression encoder can accept avs input as well . It's more of a GUI with more features. WMNicEnc is very minimalistic as you can see - but it's all you really need
    http://www.videohelp.com/tools/Microsoft-Expression-Encoder
    I've been able to make a video, but I can only do a single-pass (multi-pass crashes it), I have to have VBR on or it won't work and it will only play in WMP. It's messed up in VLC, but works on Youtube. On Firefox it is a bit choppy, the quality doesn't look as good as expected on HD and toward the end it gets a little bit off, but on Chrome it seems solid all-round. I'm starting to think that Adobe Flash is absolutely revolting.

    https://www.youtube.com/watch?v=_C3-rGdRwKc&feature=youtu.be

    AVISOURCE("J:\SyncTest\Mkv mux\UncomVidAud.avi", audio=true).AssumeFPS(30000,1001)
    #deinterlace
    #crop
    #resize
    #denoise
    ConvertToYV12(matrix="rec601")

    Program settings:

    Use Audio
    WMA10 Professional
    384 kbps, 48khz, 2 channel 24 bit CBR

    Use Video
    WMV9 Advanced Profile
    Bitrate - 10000
    Quality -- 100
    FPS -- 29.97
    Secs/KF -- 15 (I presume this means keyframe interval, which I set at half the frame rate as directed by Youtube?)
    Resolution -- Use input size
    Use VBR Quality

    I left all the advanced options on Default and put Buffer Window to 0. I don't know what half of the options mean as I'm used to x264 terminology, but will investigate further tomorrow.

    The 20 second clip was almost 40 mb, but don't mind larger size for quality.
    Quote Quote  
  14. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    secs/kf is seconds per keyframe. 15 would mean 15*29.97 FPS = 450 frames. That's too long for most material. If you wanted 1 second keyframe intervals, you would set it to "1". Similar to x264, in general , longer keyframe intervals increase the GOP size, increase the encoding efficiency - but there are diminishing returns . You can actually can impair efficiency and quality at high values with some encoders

    Don't use WMA10Pro for audio, because there are decoding issues with ffmpeg/libav opensource decoders (which YT uses, and I think vimeo does as well)

    Multipass encoding isn't necessary when you are doing unconstrained quailty based encoding. Only when you have target bitrates and filesizes , or if you have constrained bandwith considerations (where you would set max limits as well) . In your case, the file is being re-encoded by YT/vimeo , so it's not really relevant

    I'm starting to think that Adobe Flash is absolutely revolting.
    Terrible platform. So many issues and compatibility issues between browsers/OS's. Even when they "fix" some of the issues, they tend to break it the next day
    Last edited by poisondeathray; 11th Apr 2014 at 11:47.
    Quote Quote  
  15. Done more testing today and still no improvement.

    I've tried messing with VBV settings (though I don't know how to properly calculate so it was mostly guess work), doing 30 encode instead of 29.97 and a few other tests. Then I tried some WMV encodes using WMEnc. And just like before, it seems well on sync on my computer and on Youtube, but on Vimeo it's slightly out of sync (although Vimeo requests 320kbs and 9.2 doesn't give me that option):

    http://www.youtube.com/watch?v=YYvyOzdNkIs
    https://vimeo.com/91785406

    Windows Media Audio 9.2
    192kbs, 48khz, stereo CBR,
    Windows Media Video 9 Advanced Profile
    10000 Bitrate, 29.97 FPS, 100 quality, 1 secs/kf
    Use VBR, quality, 100

    So why don't I just forget about Vimeo and upload to Youtube? Well, if you saw one of my previous topics on the forums, camera movement (particularly pans or cranes) in the videos appears choppy/stutters for some of my viewers (including me), while others find it smooth. I've done almost as many tests for that issue as the audio desync and nothing seems to improve it. If I play the file through VLC/WMP or download and play in VLC/WMP, it's smooth. People reckon it is a client-side or flash/browser issue, which again gives me nothing to fix...

    http://forum.videohelp.com/threads/363096-Embedded-video-smoother-than-actual-Youtube?...60#post2308460
    http://forums.afterdawn.com/t.cfm/f-4/youtube_video_choppy_during_playback_for_some_viewers-973920/

    So, in summary, choppy camera movement on Youtube, but audio in sync.

    Smooth camera movement on Vimeo, but audio out of sync.


    I've got a 20 minute video with a beautiful 59.97 fps/high quality downloadable version that works fine for everyone who has seen it, but no way to stream the 29.97 fps version without issues. Frustrating wouldn't even describe the feeling at the moment...
    Quote Quote  
  16. vanished El Heggunte's Avatar
    Join Date: Jun 2009
    Location: Misplaced Childhood
    Search Comp PM
    Originally Posted by Skysaberer View Post
    (.....Vimeo requests 320kb/s and 9.2 doesn't give me that option):
    Actually it does, BUT it's for 44.1kHz only

    Anyway, IF your WMV is «100% constant framerate», you can easily remux it to an AVI and replace the WMA stream with MP3 or AC3 audio via VirtualDub
    Last edited by El Heggunte; 12th Apr 2014 at 12:41. Reason: disambiguation
    Quote Quote