vantezzen / skip-silence

🔇 Browser extension to skip silent parts in videos and audio files on any webpage
https://vantezzen.io/get/skipsilence
MIT License
409 stars 42 forks source link

video and audio become asynchronous over time #28

Open iy7u6le2 opened 4 years ago

iy7u6le2 commented 4 years ago

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

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 commented 3 years ago

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 commented 3 years ago

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

skoll43 commented 3 years ago

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 commented 3 years ago

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", "debugvideoId": "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 commented 3 years ago

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 :+1:

v = document.querySelector('video');
setInterval(()=> {
    v.currentTime = v.currentTime - 0.01;
}, 60000);
aeseok commented 3 years ago

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 commented 3 years ago

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

lijovklm commented 3 years ago

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

WofWca commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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

vantezzen commented 3 years ago

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

lijovklm commented 3 years ago

@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

vantezzen commented 3 months ago

After almost 4 years, this will finally be fixed by the Chrome team - released with Chrome 128: https://issues.chromium.org/issues/40190553