Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video and audio become asynchronous over time #28

Open
iy7u6le2 opened this issue Oct 21, 2020 · 14 comments
Open

video and audio become asynchronous over time #28

iy7u6le2 opened this issue Oct 21, 2020 · 14 comments

Comments

@iy7u6le2
Copy link

This bug can be reproduced on youtube.com with the following setup:

  • newest version of chrome and skip silence from chrome web store
  • playback speed: 1,75x; silence speed: 4x; volume threshold: 2%;
    duration threshold: 10 samples; pre-buffer time: 100ms

Thank you for this extension. It is extremely useful. I have seen carykh's video about his python program and eagerly waited for someone to program it exactly this way.

@WofWca
Copy link

WofWca commented Oct 22, 2020

Seems to be a Chromium bug. Same happens if you just rapidly change speed between values other than 1.

v = document.querySelector('video');
setInterval(() => v.playbackRate = 2, 200);
setTimeout(() => setInterval(() => v.playbackRate = 1.1, 200), 100);

@iy7u6le2
Copy link
Author

Manually skipping back synchronises video and audio. This may lead to a workaround. Maybe skip back 0.01s every minute?

@skoll43
Copy link

skoll43 commented Oct 30, 2020

Manually skipping back synchronises video and audio. This may lead to a workaround. Maybe skip back 0.01s every minute?

thanks, i was searching for a solution 👍

@1nd1g0
Copy link

1nd1g0 commented Nov 7, 2020

Encountered the same bug on several videos (360p30fps..1080p60fps). The longer the video, the more obvious it gets. The machine is quite fast (intel core i3 gen8 CPU, OS on Samsung EVO m.2 SSD, 32 Gb DDR4, no background processes etc., real 100mbit unrestricted internet connection). Silence is muted, silence speed is 10x, playback speed is 2x. Playback is HW accelerated with Intel integrated video decoder. Technically, for desktop mode of YouTube and Chrome audio and video are separate streams with independent decoding threads. Maybe there are some lost speed change messages, some rounding error, time quant difference or plain inability of video decoding thread to rewind at 10x speed starting at any frame due to the nature of key-frame based video coding. Example of first 24 minutes of 2 hour long video with very little action on the screen

Pinging r11.sn-axq7sn7s.googlevideo.com [173.194.2.29] with 32 bytes of data:
Reply from 173.194.2.29: bytes=32 time=3ms TTL=117
Reply from 173.194.2.29: bytes=32 time=3ms TTL=117
Reply from 173.194.2.29: bytes=32 time=3ms TTL=117
Reply from 173.194.2.29: bytes=32 time=3ms TTL=117

{
"ns": "yt",
"el": "detailpage",
"cpn": "A791vgEuk-9UNtXL",
"docid": "YTO2MUhc60k",
"ver": 2,
"cmt": "1463.7",
"ei": "O6mX97mGtDu7QTusYjAAg",
"fmt": "134",
"fs": "0",
"rt": "894.94",
"of": "eBImB9Wb6x_yRRaarTXduQ",
"euri": "",
"lact": 4,
"cl": "340742324",
"mos": 0,
"state": "4",
"vm": "CAEQABgEKixOR1IwWVFWTXNFa0ljR2hYN3VvX1d6Wm1DTUZRanlKYV9pV1ZKWW5haVpRPToyQU9HdF9PSmFhY3ZCNHJHcDBiRHZpcWJ5N2tMRC1lNWpES1hwcXluaWs5Y1lWN3AwU2c",
"volume": 100,
"subscribed": "1",
"cbr": "Chrome",
"cbrver": "86.0.4240.183",
"c": "WEB",
"cver": "2.20201105.01.01",
"cplayer": "UNIPLAYER",
"cos": "Windows",
"cosver": "10.0",
"hl": "en_US",
"cr": "RU",
"len": "6775.041",
"fexp": "23744176,23748147,23804281,23827035,23839597,23856950,23857950,23868334,23880043,23880831,23882685,23884386,23885574,23890959,23895671,23911055,23914749,23915990,23918597,23927767,23927767,23928668,23934970,23935844,23940247,23942338,23942633,23944779,23945479,23946420,23948841,23951139,23951620,23954761,23954978,23958692,23959472,23960824,23961733,23961842,23963515,23963925,23964304,23964949,23965226,23966142,23966476,23966583,23967042,23967192,23967669,24590290,24631715,3300116,3300131,3300164,3313321,3316793,3318699,3318774,3318889,3319220,3319684,3320540,3329008,3329303,3329345,9449243",
"afmt": "251",
"vct": "1463.700",
"vd": "6775.041",
"vpl": "0.000-1463.700",
"vbu": "378.521-1585.000",
"vpa": "1",
"vsk": "0",
"ven": "0",
"vpr": "2",
"vrs": "4",
"vns": "2",
"vec": "null",
"vemsg": "",
"vvol": "1",
"vdom": "1",
"vsrc": "1",
"vw": 1261,
"vh": 709,
"creationTime": 895279.5750000004,
"totalVideoFrames": 43614,
"droppedVideoFrames": 6086,
"corruptedVideoFrames": 0,
"lct": "1463.700",
"lsk": false,
"lmf": false,
"lbw": "3663078.170",
"lhd": "0.073",
"lst": "0.000",
"laa": "itag=251,type=3,seg=158,time=1580.0-1590.0,off=0,len=115704,end=1",
"lva": "itag=134,type=3,seg=316,time=1580.0-1585.0,off=0,len=290615,end=1",
"lar": "itag=251,type=3,seg=158,time=1580.0-1590.0,off=0,len=132263.75,end=1",
"lvr": "itag=134,type=3,seg=316,time=1580.0-1585.0,off=0,len=436175,end=1",
"lab": "378.521-1590.001",
"lvb": "0.000-1585.000",
"ismb": 10900000,
"relative_loudness": "-17.270",
"optimal_format": "360p",
"user_qual": "hd1080",
"debug_videoId": "YTO2MUhc60k",
"0sz": false,
"op": "",
"yof": false,
"dis": "",
"gpu": "ANGLE
(Intel(R)_UHD_Graphics_630_Direct3D11_vs_5_0_ps_5_0)",
"cgr": true,
"debug_playbackQuality": "medium",
"debug_date": "Sat Nov 07 2020 22:16:11 GMT+0300 (Moscow Standard Time)"
}

@pixelchai
Copy link

I am also experiencing this issue. I tried the workaround @iy7u6le2 mentioned using the following code and I can confirm that it works as a temporary workaround 👍

v = document.querySelector('video');
setInterval(()=> {
	v.currentTime = v.currentTime - 0.01;
}, 60000);

@aeseok
Copy link

aeseok commented Jun 5, 2021

I am also experiencing this issue. I tried the workaround @iy7u6le2 mentioned using the following code and I can confirm that it works as a temporary workaround 👍

v = document.querySelector('video');
setInterval(()=> {
	v.currentTime = v.currentTime - 0.01;
}, 60000);

Hey, I am a total newbie and have been experiencing this same problem, do you know where i can paste this code into or if i can install your skip silence extension with this setting.

@WofWca
Copy link

WofWca commented Jun 5, 2021

@aeseok open developer tools in the browser (F12), paste it in the console.

@lijovklm
Copy link

lijovklm commented Jul 1, 2021

@WofWca Thanks, is there a way to set this up happen automatically whenever I play a YouTube video

@WofWca
Copy link

WofWca commented Jul 1, 2021

@lijovklm Can't think of a reasonable way.
You could modify the source code of this extension (see https://github.com/vantezzen/skip-silence#development)

@vantezzen
Copy link
Owner

vantezzen commented Jul 1, 2021

@lijovklm You could try using a script extension like Tampermonkey to execute this automatically.
I don't currently have much time but I will try to implement a fix into Skip Silence itself for this in the future.

@vantezzen
Copy link
Owner

vantezzen commented Jul 20, 2021

I am also experiencing this issue. I tried the workaround @iy7u6le2 mentioned using the following code and I can confirm that it works as a temporary workaround 👍

v = document.querySelector('video');
setInterval(()=> {
	v.currentTime = v.currentTime - 0.01;
}, 60000);

@pixelzery If my tests are correct, it looks like we don't even need to change the time so doing this also works:

setInterval(()=> {
    v.currentTime = v.currentTime;
}, 60000);

This requires Chrome to recalculate the current position and allows the desync to disapear

Could you tests this too? I might want to implement something like this into Skip Silence and it would be good if we don't skip back every time.

@starkle
Copy link

starkle commented Jul 22, 2021

Good news for Firefox users: synchronization doesn't seem to be a problem like it is in Chrome, at least in my tests.

@vantezzen
Copy link
Owner

vantezzen commented Jul 23, 2021

Option is implemented as "Keep Audio in Sync" but will be hidden on Firefox to not confuse users there. It will automatically execute the code metioned above every 5s.

image

The feature will be released with Skip Silence 4.

I couldn't find a Chromium bug report yet so I opened a new report as well so this bug will hopefully be fixed at the root instead of needing the script: https://bugs.chromium.org/p/chromium/issues/detail?id=1231093

@vantezzen vantezzen pinned this issue Jul 23, 2021
@lijovklm
Copy link

lijovklm commented Jul 23, 2021

@vantezzen I tested a bit with the suggested code.
setInterval(()=> { v.currentTime = v.currentTime; }, 60000);
I could feel the audio skipping back with multiple videos. e.g.: https://www.youtube.com/watch?v=8eeUV1RHkmw
There was a lip sync issue, but when this script is running audio skips back multiple times.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants