vidify / old-audiosync

First implementation of the audio synchronization feature for Vidify, now obsolete
GNU Lesser General Public License v3.0
17 stars 3 forks source link

Larger pipe buffer in ffmpeg_pipe #26

Closed marioortizmanero closed 4 years ago

marioortizmanero commented 4 years ago

Currently it's reading byte to byte, which is terribly slow. Back when I tried enlarging it I was getting errors, but I should revisit it.

marioortizmanero commented 4 years ago

Benchmarks

The difference is very noticeable if you look at the CPU usage & system time (system calls).

[BUFSIZE = 1 (original)] 257.1 seconds, 51.44s user 43.14s system 36% cpu ``` >> Playing URI 08mG3Y1vljYA6bvDt4Wqkj (AC/DC - Back In Black) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=201122 down=288004 audiosync: -15497 frames of delay with a confidence of 0.880649 audiosync: next interval (1): cap=288000 down=2398888 audiosync: -15499 frames of delay with a confidence of 0.955027 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.500988245010376 seconds >> Playing URI 5EwwwdsQfKI8ZnFG93j5Zu (Martin Garrix - Forever) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=183033 down=288006 audiosync: 8336 frames of delay with a confidence of 0.996297 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.295570135116577 seconds >> Playing URI 4uLU6hMCjMI75M1A2tKUQC (Rick Astley - Never Gonna Give You Up) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=184886 down=288006 audiosync: -35946 frames of delay with a confidence of 0.292210 audiosync: next interval (1): cap=288019 down=2880000 audiosync: 217811 frames of delay with a confidence of 0.003962 audiosync: next interval (2): cap=480005 down=2880000 audiosync: 14036 frames of delay with a confidence of 0.098887 audiosync: next interval (3): cap=720004 down=2880000 audiosync: -36786 frames of delay with a confidence of 0.065802 audiosync: next interval (4): cap=960014 down=2880000 audiosync: -240047 frames of delay with a confidence of 0.072486 audiosync: next interval (5): cap=1440000 down=2880000 audiosync: -39181 frames of delay with a confidence of 0.030048 audiosync: finished run >> Took 30.698267698287964 seconds >> Playing URI 0Y1FLqg7c4YFCKP2F6HXsG (Blood Red Shoes - It's Getting Boring By The Sea) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=173037 down=288003 audiosync: -119661 frames of delay with a confidence of 0.007198 audiosync: next interval (1): cap=288005 down=2880000 audiosync: -54664 frames of delay with a confidence of 0.111710 audiosync: next interval (2): cap=480016 down=2880000 audiosync: 354990 frames of delay with a confidence of -0.018489 audiosync: next interval (3): cap=720004 down=2880000 audiosync: 355002 frames of delay with a confidence of -0.010594 audiosync: next interval (4): cap=960019 down=2880000 audiosync: 355002 frames of delay with a confidence of -0.062182 audiosync: next interval (5): cap=1440000 down=2880000 audiosync: -175517 frames of delay with a confidence of -0.042183 audiosync: finished run >> Took 30.561408281326294 seconds >> Playing URI 4qWCjHL1CtBV57uwdkhIXn (Mylky, KRAL & Refeci - Area 51) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=184709 down=288003 audiosync: 136583 frames of delay with a confidence of 0.605768 audiosync: next interval (1): cap=288006 down=2880000 audiosync: 136583 frames of delay with a confidence of 0.662240 audiosync: next interval (2): cap=480007 down=2880000 audiosync: 472765 frames of delay with a confidence of 0.322562 audiosync: next interval (3): cap=720004 down=2880000 audiosync: 520755 frames of delay with a confidence of 0.372310 audiosync: next interval (4): cap=960004 down=2880000 audiosync: 136755 frames of delay with a confidence of 0.668565 audiosync: next interval (5): cap=1440000 down=2880000 audiosync: 136745 frames of delay with a confidence of 0.699416 audiosync: finished run >> Took 30.71220111846924 seconds >> Playing URI 1mea3bSkSGXuIRvnydlB5b (Coldplay - Viva La Vida) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=183074 down=288022 audiosync: 20575 frames of delay with a confidence of -0.992889 audiosync: next interval (1): cap=288005 down=2880000 audiosync: 20574 frames of delay with a confidence of -0.989764 audiosync: next interval (2): cap=480019 down=2880000 audiosync: 20573 frames of delay with a confidence of -0.984939 audiosync: next interval (3): cap=720005 down=2880000 audiosync: 20572 frames of delay with a confidence of -0.976684 audiosync: next interval (4): cap=960016 down=2880000 audiosync: 20571 frames of delay with a confidence of -0.972162 audiosync: next interval (5): cap=1440000 down=2880000 audiosync: 20570 frames of delay with a confidence of -0.957572 audiosync: finished run >> Took 30.57729697227478 seconds >> Playing URI 2qC1sUo8xxRRqYsaYEdDuZ (Tycho - Awake) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=179503 down=288004 audiosync: 113012 frames of delay with a confidence of -0.089287 audiosync: next interval (1): cap=288000 down=2880000 audiosync: 14815 frames of delay with a confidence of 0.998846 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.586594581604004 seconds >> Playing URI 21T9lWigjSIMg9uD6ZfRnQ (Killing Joke - Eighties) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=174334 down=288004 audiosync: 32233 frames of delay with a confidence of -0.086853 audiosync: next interval (1): cap=288004 down=2880000 audiosync: 69037 frames of delay with a confidence of 0.067652 audiosync: next interval (2): cap=480005 down=2880000 audiosync: 69685 frames of delay with a confidence of 0.064727 audiosync: next interval (3): cap=720004 down=2880000 audiosync: 69101 frames of delay with a confidence of 0.063446 audiosync: next interval (4): cap=960003 down=2880000 audiosync: 69096 frames of delay with a confidence of 0.045299 audiosync: next interval (5): cap=1440000 down=2880000 audiosync: -126270 frames of delay with a confidence of 0.040961 audiosync: finished run >> Took 30.634681224822998 seconds >> Playing URI 25NCJC9DJ2FXJEz54wMHRp (Tom Grennan - Sober) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=181214 down=288005 audiosync: next interval (1): cap=288006 down=2880000 audiosync: 149906 frames of delay with a confidence of 0.961023 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.489603042602539 seconds >> Playing URI 2JtzwKuk3RmxDSeoY6LMMI (kiss - love gun) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=179253 down=288004 audiosync: 49448 frames of delay with a confidence of -0.040430 audiosync: next interval (1): cap=288020 down=2880000 audiosync: -11639 frames of delay with a confidence of 0.030123 audiosync: next interval (2): cap=480000 down=2880000 audiosync: 463174 frames of delay with a confidence of 0.024373 audiosync: next interval (3): cap=720004 down=2880000 audiosync: 459261 frames of delay with a confidence of 0.020347 audiosync: next interval (4): cap=960007 down=2880000 audiosync: -88721 frames of delay with a confidence of 0.024699 audiosync: next interval (5): cap=1440000 down=2880000 audiosync: -88703 frames of delay with a confidence of 0.020336 audiosync: finished run >> Took 30.648032188415527 seconds >> Playing URI 19503qDaxgCdPL2BhJngij (Maximo Park - Apply Some Pressure) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=174461 down=288048 audiosync: 22623 frames of delay with a confidence of -0.509685 audiosync: next interval (1): cap=288004 down=2880000 audiosync: 22601 frames of delay with a confidence of -0.354429 audiosync: next interval (2): cap=480014 down=2880000 audiosync: 296888 frames of delay with a confidence of -0.323733 audiosync: next interval (3): cap=720005 down=2880000 audiosync: -252072 frames of delay with a confidence of -0.163121 audiosync: next interval (4): cap=960002 down=2880000 audiosync: -389541 frames of delay with a confidence of -0.130089 audiosync: next interval (5): cap=1440000 down=2880000 audiosync: 20807 frames of delay with a confidence of 0.068821 audiosync: finished run >> Took 30.605311393737793 seconds >> Playing URI 7FIWs0pqAYbP91WWM0vlTQ (Godzilla (feat. Juice WRLD) [Official Audio]) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=172484 down=288001 audiosync: 11862 frames of delay with a confidence of 0.993277 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.150881767272949 seconds >> Playing URI 51NFxnQvaosfDDutk0tams (Billie Eilish - Bellyache) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=200096 down=288006 audiosync: -2551 frames of delay with a confidence of 0.943123 audiosync: next interval (1): cap=288002 down=2568523 audiosync: -2551 frames of delay with a confidence of 0.951872 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.489171028137207 seconds >> Playing URI 4VqPOruhp5EdPBeR92t6lQ (Muse - Uprising) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=173371 down=288001 audiosync: -3540 frames of delay with a confidence of 0.996646 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.091815948486328 seconds >> Playing URI 15V58YLX8jLoN7zlqPrObz (The Music - The People) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=168894 down=288004 audiosync: 17951 frames of delay with a confidence of 0.989403 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.0700366497039795 seconds >> Total: 257.11186027526855 seconds python dev/benchmark.py 51.44s user 43.14s system 36% cpu 4:22.29 total ```
[BUFSIZE = 4096] 269.4 seconds, 29.78s user 5.04s system 12% cpu ``` >> Playing URI 08mG3Y1vljYA6bvDt4Wqkj (AC/DC - Back In Black) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=186124 down=288648 audiosync: -12614 frames of delay with a confidence of 0.902030 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=289089 down=2880000 audiosync: -12615 frames of delay with a confidence of 0.953004 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.645871162414551 seconds >> Playing URI 5EwwwdsQfKI8ZnFG93j5Zu (Martin Garrix - Forever) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=171316 down=288648 audiosync: 3287 frames of delay with a confidence of 0.996427 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.13820219039917 seconds >> Playing URI 4uLU6hMCjMI75M1A2tKUQC (Rick Astley - Never Gonna Give You Up) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=195835 down=288648 audiosync: -35824 frames of delay with a confidence of 0.292828 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288967 down=2880000 audiosync: 217926 frames of delay with a confidence of 0.003657 audiosync: next interval (2): cap=480096 down=2880000 audiosync: 14150 frames of delay with a confidence of 0.098866 audiosync: next interval (3): cap=720292 down=2880000 audiosync: -36672 frames of delay with a confidence of 0.065731 audiosync: next interval (4): cap=961081 down=2880000 audiosync: -239933 frames of delay with a confidence of 0.072433 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: -39067 frames of delay with a confidence of 0.030029 audiosync: finished run >> Took 35.86176037788391 seconds >> Playing URI 0Y1FLqg7c4YFCKP2F6HXsG (Blood Red Shoes - It's Getting Boring By The Sea) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=168417 down=288648 audiosync: -117292 frames of delay with a confidence of 0.006415 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288196 down=2880000 audiosync: -52295 frames of delay with a confidence of 0.108899 audiosync: next interval (2): cap=481627 down=2880000 audiosync: 357369 frames of delay with a confidence of -0.010716 audiosync: next interval (3): cap=720637 down=2880000 audiosync: 357371 frames of delay with a confidence of -0.010375 audiosync: next interval (4): cap=961164 down=2880000 audiosync: 357371 frames of delay with a confidence of -0.062172 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: -173149 frames of delay with a confidence of -0.042404 audiosync: finished run >> Took 30.694061279296875 seconds >> Playing URI 4qWCjHL1CtBV57uwdkhIXn (Mylky, KRAL & Refeci - Area 51) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=175079 down=288648 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288151 down=2880000 audiosync: 150846 frames of delay with a confidence of 0.674738 audiosync: next interval (2): cap=480427 down=2880000 audiosync: 463034 frames of delay with a confidence of 0.249187 audiosync: next interval (3): cap=720060 down=2880000 audiosync: 535034 frames of delay with a confidence of 0.361023 audiosync: next interval (4): cap=960294 down=2880000 audiosync: 151018 frames of delay with a confidence of 0.669487 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: 151018 frames of delay with a confidence of 0.699829 audiosync: finished run >> Took 31.0556640625 seconds >> Playing URI 1mea3bSkSGXuIRvnydlB5b (Coldplay - Viva La Vida) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=186126 down=288648 audiosync: 23317 frames of delay with a confidence of -0.990945 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=289026 down=2880000 audiosync: 23317 frames of delay with a confidence of -0.989937 audiosync: next interval (2): cap=480171 down=2880000 audiosync: 23316 frames of delay with a confidence of -0.985560 audiosync: next interval (3): cap=721286 down=2880000 audiosync: 23315 frames of delay with a confidence of -0.976979 audiosync: next interval (4): cap=960728 down=2880000 audiosync: 23314 frames of delay with a confidence of -0.972522 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: 23313 frames of delay with a confidence of -0.957498 audiosync: finished run >> Took 30.8123676776886 seconds >> Playing URI 2qC1sUo8xxRRqYsaYEdDuZ (Tycho - Awake) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=180685 down=288648 audiosync: 93943 frames of delay with a confidence of -0.261884 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=289054 down=2880000 audiosync: 12159 frames of delay with a confidence of 0.998930 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.562877893447876 seconds >> Playing URI 21T9lWigjSIMg9uD6ZfRnQ (Killing Joke - Eighties) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=164765 down=288648 audiosync: 33923 frames of delay with a confidence of -0.087133 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=289204 down=2880000 audiosync: 70727 frames of delay with a confidence of 0.068295 audiosync: next interval (2): cap=480027 down=2880000 audiosync: 70792 frames of delay with a confidence of 0.054654 audiosync: next interval (3): cap=720669 down=2880000 audiosync: 70790 frames of delay with a confidence of 0.063496 audiosync: next interval (4): cap=960704 down=2880000 audiosync: 70786 frames of delay with a confidence of 0.045326 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: -124581 frames of delay with a confidence of 0.040874 audiosync: finished run >> Took 30.762922286987305 seconds >> Playing URI 25NCJC9DJ2FXJEz54wMHRp (Tom Grennan - Sober) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=169197 down=288648 audiosync: -137215 frames of delay with a confidence of 0.040929 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288836 down=2880000 audiosync: 150785 frames of delay with a confidence of 0.961203 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.6270716190338135 seconds >> Playing URI 2JtzwKuk3RmxDSeoY6LMMI (kiss - love gun) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=204688 down=288768 audiosync: -65477 frames of delay with a confidence of 0.028471 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288551 down=2880000 audiosync: -12997 frames of delay with a confidence of 0.030813 audiosync: next interval (2): cap=480744 down=2880000 audiosync: -161045 frames of delay with a confidence of 0.026022 audiosync: next interval (3): cap=720066 down=2880000 audiosync: 407346 frames of delay with a confidence of 0.018752 audiosync: next interval (4): cap=960044 down=2880000 audiosync: -90079 frames of delay with a confidence of 0.024681 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: -90061 frames of delay with a confidence of 0.020323 audiosync: finished run >> Took 30.664989471435547 seconds >> Playing URI 19503qDaxgCdPL2BhJngij (Maximo Park - Apply Some Pressure) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=160708 down=288648 audiosync: 25354 frames of delay with a confidence of -0.515139 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288658 down=2880000 audiosync: 25352 frames of delay with a confidence of -0.365404 audiosync: next interval (2): cap=480708 down=2880000 audiosync: 299639 frames of delay with a confidence of -0.331897 audiosync: next interval (3): cap=721092 down=2880000 audiosync: -249320 frames of delay with a confidence of -0.160853 audiosync: next interval (4): cap=960119 down=2880000 audiosync: -386790 frames of delay with a confidence of -0.127554 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: 23559 frames of delay with a confidence of 0.068941 audiosync: finished run >> Took 30.78415846824646 seconds >> Playing URI 7FIWs0pqAYbP91WWM0vlTQ (Godzilla (feat. Juice WRLD) [Official Audio]) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=166131 down=288648 audiosync: 11958 frames of delay with a confidence of 0.991153 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.059057950973511 seconds >> Playing URI 51NFxnQvaosfDDutk0tams (Billie Eilish - Bellyache) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=188030 down=288648 audiosync: 1071 frames of delay with a confidence of 0.942939 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288151 down=2880000 audiosync: 1071 frames of delay with a confidence of 0.951596 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 11.541225671768188 seconds >> Playing URI 4VqPOruhp5EdPBeR92t6lQ (Muse - Uprising) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=190658 down=288648 audiosync: -2826 frames of delay with a confidence of 0.996667 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.546878814697266 seconds >> Playing URI 15V58YLX8jLoN7zlqPrObz (The Music - The People) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=201988 down=288648 audiosync: 14320 frames of delay with a confidence of 0.989094 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.6693501472473145 seconds >> Total: 269.4264590740204 seconds python3 dev/benchmark.py 29.78s user 5.04s system 12% cpu 4:35.05 total ```
[BUFSIZE = 8192] 289 seconds, 30.39s user 6.13s system 12% cpu ``` >> Playing URI 08mG3Y1vljYA6bvDt4Wqkj (AC/DC - Back In Black) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=193456 down=288648 audiosync: -13189 frames of delay with a confidence of 0.890783 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288000 down=2880000 audiosync: -13190 frames of delay with a confidence of 0.957809 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.617764711380005 seconds >> Playing URI 5EwwwdsQfKI8ZnFG93j5Zu (Martin Garrix - Forever) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=167627 down=288648 audiosync: 9652 frames of delay with a confidence of 0.996575 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.068042516708374 seconds >> Playing URI 4uLU6hMCjMI75M1A2tKUQC (Rick Astley - Never Gonna Give You Up) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=186630 down=288648 audiosync: -36050 frames of delay with a confidence of 0.293593 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=289323 down=2880000 audiosync: 217699 frames of delay with a confidence of 0.003945 audiosync: next interval (2): cap=480889 down=2880000 audiosync: 13924 frames of delay with a confidence of 0.098883 audiosync: next interval (3): cap=720067 down=2880000 audiosync: -36898 frames of delay with a confidence of 0.065829 audiosync: next interval (4): cap=960384 down=2880000 audiosync: -240159 frames of delay with a confidence of 0.072516 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: -39293 frames of delay with a confidence of 0.030063 audiosync: finished run >> Took 30.929140329360962 seconds >> Playing URI 0Y1FLqg7c4YFCKP2F6HXsG (Blood Red Shoes - It's Getting Boring By The Sea) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=171510 down=288648 audiosync: -117501 frames of delay with a confidence of 0.006474 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288320 down=2880000 audiosync: -52504 frames of delay with a confidence of 0.108916 audiosync: next interval (2): cap=480105 down=2880000 audiosync: 357160 frames of delay with a confidence of -0.010765 audiosync: next interval (3): cap=720200 down=2880000 audiosync: 357162 frames of delay with a confidence of -0.010394 audiosync: next interval (4): cap=961426 down=2880000 audiosync: 357162 frames of delay with a confidence of -0.062175 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: -173358 frames of delay with a confidence of -0.042326 audiosync: finished run >> Took 30.58066439628601 seconds >> Playing URI 4qWCjHL1CtBV57uwdkhIXn (Mylky, KRAL & Refeci - Area 51) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=182912 down=288648 audiosync: 139500 frames of delay with a confidence of 0.673788 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288384 down=2880000 audiosync: 139500 frames of delay with a confidence of 0.666796 audiosync: next interval (2): cap=480746 down=2880000 audiosync: 475682 frames of delay with a confidence of 0.209850 audiosync: next interval (3): cap=720303 down=2880000 audiosync: 523672 frames of delay with a confidence of 0.368183 audiosync: next interval (4): cap=960088 down=2880000 audiosync: 139672 frames of delay with a confidence of 0.668836 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: 139662 frames of delay with a confidence of 0.699560 audiosync: finished run >> Took 30.59885263442993 seconds >> Playing URI 1mea3bSkSGXuIRvnydlB5b (Coldplay - Viva La Vida) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=198936 down=288648 audiosync: 23004 frames of delay with a confidence of -0.993108 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288092 down=2880000 audiosync: 23003 frames of delay with a confidence of -0.988244 audiosync: next interval (2): cap=480073 down=2880000 audiosync: 23003 frames of delay with a confidence of -0.986038 audiosync: next interval (3): cap=720149 down=2880000 audiosync: 23002 frames of delay with a confidence of -0.976754 audiosync: next interval (4): cap=960376 down=2880000 audiosync: 23001 frames of delay with a confidence of -0.972727 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: 22999 frames of delay with a confidence of -0.957208 audiosync: finished run >> Took 30.649744033813477 seconds >> Playing URI 2qC1sUo8xxRRqYsaYEdDuZ (Tycho - Awake) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=178855 down=288648 audiosync: 113273 frames of delay with a confidence of -0.086863 audiosync: next interval (1): cap=288598 down=1420488 audiosync: 15076 frames of delay with a confidence of 0.998927 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 11.239385604858398 seconds >> Playing URI 21T9lWigjSIMg9uD6ZfRnQ (Killing Joke - Eighties) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=170471 down=288648 audiosync: 37641 frames of delay with a confidence of -0.088876 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288214 down=2880000 audiosync: 74445 frames of delay with a confidence of 0.068647 audiosync: next interval (2): cap=480951 down=2880000 audiosync: 74510 frames of delay with a confidence of 0.054798 audiosync: next interval (3): cap=720563 down=2880000 audiosync: 74508 frames of delay with a confidence of 0.063578 audiosync: next interval (4): cap=961426 down=2880000 audiosync: 74504 frames of delay with a confidence of 0.045374 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: -120863 frames of delay with a confidence of 0.040811 audiosync: finished run >> Took 30.702921628952026 seconds >> Playing URI 25NCJC9DJ2FXJEz54wMHRp (Tom Grennan - Sober) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=170491 down=288648 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288096 down=2880000 audiosync: 150402 frames of delay with a confidence of 0.962084 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.594650030136108 seconds >> Playing URI 2JtzwKuk3RmxDSeoY6LMMI (kiss - love gun) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=177594 down=288768 audiosync: 51056 frames of delay with a confidence of 0.045613 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288297 down=2880000 audiosync: -9889 frames of delay with a confidence of 0.029802 audiosync: next interval (2): cap=481141 down=2880000 audiosync: -157936 frames of delay with a confidence of 0.026230 audiosync: next interval (3): cap=720623 down=2880000 audiosync: 410454 frames of delay with a confidence of 0.018555 audiosync: next interval (4): cap=960418 down=2880000 audiosync: -86970 frames of delay with a confidence of 0.024853 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: -86953 frames of delay with a confidence of 0.020340 audiosync: finished run >> Took 30.840004682540894 seconds >> Playing URI 19503qDaxgCdPL2BhJngij (Maximo Park - Apply Some Pressure) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=176073 down=288648 audiosync: 25102 frames of delay with a confidence of -0.513844 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288262 down=2880000 audiosync: 25100 frames of delay with a confidence of -0.364755 audiosync: next interval (2): cap=480268 down=2880000 audiosync: 299387 frames of delay with a confidence of -0.332107 audiosync: next interval (3): cap=720112 down=2880000 audiosync: -249573 frames of delay with a confidence of -0.161119 audiosync: next interval (4): cap=960379 down=2880000 audiosync: -387043 frames of delay with a confidence of -0.127608 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: 23306 frames of delay with a confidence of 0.068831 audiosync: finished run >> Took 30.593783617019653 seconds >> Playing URI 7FIWs0pqAYbP91WWM0vlTQ (Godzilla (feat. Juice WRLD) [Official Audio]) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=171561 down=288648 audiosync: 12489 frames of delay with a confidence of 0.992812 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.147977113723755 seconds >> Playing URI 51NFxnQvaosfDDutk0tams (Billie Eilish - Bellyache) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=197197 down=288648 audiosync: -3130 frames of delay with a confidence of 0.943000 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288153 down=2880000 audiosync: -3130 frames of delay with a confidence of 0.951906 audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 6.640789747238159 seconds >> Playing URI 4VqPOruhp5EdPBeR92t6lQ (Muse - Uprising) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=169227 down=288648 audiosync: -3967 frames of delay with a confidence of 0.996921 audiosync: read ABORT_ST, quitting... audiosync: read ABORT_ST, quitting... audiosync: finished run >> Took 4.104033470153809 seconds >> Playing URI 15V58YLX8jLoN7zlqPrObz (The Music - The People) audiosync: starting interval loop audiosync: obtained youtube-dl URL audiosync: next interval (0): cap=184422 down=288648 audiosync: 52764 frames of delay with a confidence of -0.903141 audiosync: finished ffmpeg loopaudiosync: next interval (1): cap=288295 down=2880000 audiosync: 52764 frames of delay with a confidence of -0.861504 audiosync: next interval (2): cap=480680 down=2880000 audiosync: 52764 frames of delay with a confidence of -0.844063 audiosync: next interval (3): cap=720007 down=2880000 audiosync: 52762 frames of delay with a confidence of -0.810682 audiosync: next interval (4): cap=960323 down=2880000 audiosync: 52760 frames of delay with a confidence of -0.713482 audiosync: finished ffmpeg loopaudiosync: next interval (5): cap=1440000 down=2880000 audiosync: 52755 frames of delay with a confidence of -0.586632 audiosync: finished run >> Took 30.710808038711548 seconds >> Total: 289.0185625553131 seconds python3 dev/benchmark.py 30.39s user 6.13s system 12% cpu 4:55.71 total ```

I think 4096 will be enough for now.