allow timestamps to be generated for video files other than the original youtube streams

This commit is contained in:
Adrian Edwards 2025-09-18 20:21:52 +00:00 • committed by Robert Wright
commit b7f1302bc0
6 changed files with 527 additions and 1 deletions

View file

@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
python-ffmpeg = "*"
numpy = "*"
scipy = "*"
sponsorblock = "*"
yt-dlp = "*"
[dev-packages]
[requires]
python_version = "3.12"

312
scripts/timestamps/Pipfile.lock generated Normal file
View file

@ -0,0 +1,312 @@
{
"_meta": {
"hash": {
"sha256": "ddd20fb7c871925ebc32d70f2e725fdef4aea68cbcfe2c996d9a736920bcb987"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.12"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"certifi": {
"hashes": [
"sha256:0a816057ea3cdefcef70270d2c515e4506bbc954f417fa5ade2021213bb8f0c6",
"sha256:30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3"
],
"markers": "python_version >= '3.6'",
"version": "==2025.4.26"
},
"charset-normalizer": {
"hashes": [
"sha256:005fa3432484527f9732ebd315da8da8001593e2cf46a3d817669f062c3d9ed4",
"sha256:046595208aae0120559a67693ecc65dd75d46f7bf687f159127046628178dc45",
"sha256:0c29de6a1a95f24b9a1aa7aefd27d2487263f00dfd55a77719b530788f75cff7",
"sha256:0c8c57f84ccfc871a48a47321cfa49ae1df56cd1d965a09abe84066f6853b9c0",
"sha256:0f5d9ed7f254402c9e7d35d2f5972c9bbea9040e99cd2861bd77dc68263277c7",
"sha256:18dd2e350387c87dabe711b86f83c9c78af772c748904d372ade190b5c7c9d4d",
"sha256:1b1bde144d98e446b056ef98e59c256e9294f6b74d7af6846bf5ffdafd687a7d",
"sha256:1c95a1e2902a8b722868587c0e1184ad5c55631de5afc0eb96bc4b0d738092c0",
"sha256:1cad5f45b3146325bb38d6855642f6fd609c3f7cad4dbaf75549bf3b904d3184",
"sha256:21b2899062867b0e1fde9b724f8aecb1af14f2778d69aacd1a5a1853a597a5db",
"sha256:24498ba8ed6c2e0b56d4acbf83f2d989720a93b41d712ebd4f4979660db4417b",
"sha256:25a23ea5c7edc53e0f29bae2c44fcb5a1aa10591aae107f2a2b2583a9c5cbc64",
"sha256:289200a18fa698949d2b39c671c2cc7a24d44096784e76614899a7ccf2574b7b",
"sha256:28a1005facc94196e1fb3e82a3d442a9d9110b8434fc1ded7a24a2983c9888d8",
"sha256:32fc0341d72e0f73f80acb0a2c94216bd704f4f0bce10aedea38f30502b271ff",
"sha256:36b31da18b8890a76ec181c3cf44326bf2c48e36d393ca1b72b3f484113ea344",
"sha256:3c21d4fca343c805a52c0c78edc01e3477f6dd1ad7c47653241cf2a206d4fc58",
"sha256:3fddb7e2c84ac87ac3a947cb4e66d143ca5863ef48e4a5ecb83bd48619e4634e",
"sha256:43e0933a0eff183ee85833f341ec567c0980dae57c464d8a508e1b2ceb336471",
"sha256:4a476b06fbcf359ad25d34a057b7219281286ae2477cc5ff5e3f70a246971148",
"sha256:4e594135de17ab3866138f496755f302b72157d115086d100c3f19370839dd3a",
"sha256:50bf98d5e563b83cc29471fa114366e6806bc06bc7a25fd59641e41445327836",
"sha256:5a9979887252a82fefd3d3ed2a8e3b937a7a809f65dcb1e068b090e165bbe99e",
"sha256:5baececa9ecba31eff645232d59845c07aa030f0c81ee70184a90d35099a0e63",
"sha256:5bf4545e3b962767e5c06fe1738f951f77d27967cb2caa64c28be7c4563e162c",
"sha256:6333b3aa5a12c26b2a4d4e7335a28f1475e0e5e17d69d55141ee3cab736f66d1",
"sha256:65c981bdbd3f57670af8b59777cbfae75364b483fa8a9f420f08094531d54a01",
"sha256:68a328e5f55ec37c57f19ebb1fdc56a248db2e3e9ad769919a58672958e8f366",
"sha256:6a0289e4589e8bdfef02a80478f1dfcb14f0ab696b5a00e1f4b8a14a307a3c58",
"sha256:6b66f92b17849b85cad91259efc341dce9c1af48e2173bf38a85c6329f1033e5",
"sha256:6c9379d65defcab82d07b2a9dfbfc2e95bc8fe0ebb1b176a3190230a3ef0e07c",
"sha256:6fc1f5b51fa4cecaa18f2bd7a003f3dd039dd615cd69a2afd6d3b19aed6775f2",
"sha256:70f7172939fdf8790425ba31915bfbe8335030f05b9913d7ae00a87d4395620a",
"sha256:721c76e84fe669be19c5791da68232ca2e05ba5185575086e384352e2c309597",
"sha256:7222ffd5e4de8e57e03ce2cef95a4c43c98fcb72ad86909abdfc2c17d227fc1b",
"sha256:75d10d37a47afee94919c4fab4c22b9bc2a8bf7d4f46f87363bcf0573f3ff4f5",
"sha256:76af085e67e56c8816c3ccf256ebd136def2ed9654525348cfa744b6802b69eb",
"sha256:770cab594ecf99ae64c236bc9ee3439c3f46be49796e265ce0cc8bc17b10294f",
"sha256:7a6ab32f7210554a96cd9e33abe3ddd86732beeafc7a28e9955cdf22ffadbab0",
"sha256:7c48ed483eb946e6c04ccbe02c6b4d1d48e51944b6db70f697e089c193404941",
"sha256:7f56930ab0abd1c45cd15be65cc741c28b1c9a34876ce8c17a2fa107810c0af0",
"sha256:8075c35cd58273fee266c58c0c9b670947c19df5fb98e7b66710e04ad4e9ff86",
"sha256:8272b73e1c5603666618805fe821edba66892e2870058c94c53147602eab29c7",
"sha256:82d8fd25b7f4675d0c47cf95b594d4e7b158aca33b76aa63d07186e13c0e0ab7",
"sha256:844da2b5728b5ce0e32d863af26f32b5ce61bc4273a9c720a9f3aa9df73b1455",
"sha256:8755483f3c00d6c9a77f490c17e6ab0c8729e39e6390328e42521ef175380ae6",
"sha256:915f3849a011c1f593ab99092f3cecfcb4d65d8feb4a64cf1bf2d22074dc0ec4",
"sha256:926ca93accd5d36ccdabd803392ddc3e03e6d4cd1cf17deff3b989ab8e9dbcf0",
"sha256:982bb1e8b4ffda883b3d0a521e23abcd6fd17418f6d2c4118d257a10199c0ce3",
"sha256:98f862da73774290f251b9df8d11161b6cf25b599a66baf087c1ffe340e9bfd1",
"sha256:9cbfacf36cb0ec2897ce0ebc5d08ca44213af24265bd56eca54bee7923c48fd6",
"sha256:a370b3e078e418187da8c3674eddb9d983ec09445c99a3a263c2011993522981",
"sha256:a955b438e62efdf7e0b7b52a64dc5c3396e2634baa62471768a64bc2adb73d5c",
"sha256:aa6af9e7d59f9c12b33ae4e9450619cf2488e2bbe9b44030905877f0b2324980",
"sha256:aa88ca0b1932e93f2d961bf3addbb2db902198dca337d88c89e1559e066e7645",
"sha256:aaeeb6a479c7667fbe1099af9617c83aaca22182d6cf8c53966491a0f1b7ffb7",
"sha256:aaf27faa992bfee0264dc1f03f4c75e9fcdda66a519db6b957a3f826e285cf12",
"sha256:b2680962a4848b3c4f155dc2ee64505a9c57186d0d56b43123b17ca3de18f0fa",
"sha256:b2d318c11350e10662026ad0eb71bb51c7812fc8590825304ae0bdd4ac283acd",
"sha256:b33de11b92e9f75a2b545d6e9b6f37e398d86c3e9e9653c4864eb7e89c5773ef",
"sha256:b3daeac64d5b371dea99714f08ffc2c208522ec6b06fbc7866a450dd446f5c0f",
"sha256:be1e352acbe3c78727a16a455126d9ff83ea2dfdcbc83148d2982305a04714c2",
"sha256:bee093bf902e1d8fc0ac143c88902c3dfc8941f7ea1d6a8dd2bcb786d33db03d",
"sha256:c72fbbe68c6f32f251bdc08b8611c7b3060612236e960ef848e0a517ddbe76c5",
"sha256:c9e36a97bee9b86ef9a1cf7bb96747eb7a15c2f22bdb5b516434b00f2a599f02",
"sha256:cddf7bd982eaa998934a91f69d182aec997c6c468898efe6679af88283b498d3",
"sha256:cf713fe9a71ef6fd5adf7a79670135081cd4431c2943864757f0fa3a65b1fafd",
"sha256:d11b54acf878eef558599658b0ffca78138c8c3655cf4f3a4a673c437e67732e",
"sha256:d41c4d287cfc69060fa91cae9683eacffad989f1a10811995fa309df656ec214",
"sha256:d524ba3f1581b35c03cb42beebab4a13e6cdad7b36246bd22541fa585a56cccd",
"sha256:daac4765328a919a805fa5e2720f3e94767abd632ae410a9062dff5412bae65a",
"sha256:db4c7bf0e07fc3b7d89ac2a5880a6a8062056801b83ff56d8464b70f65482b6c",
"sha256:dc7039885fa1baf9be153a0626e337aa7ec8bf96b0128605fb0d77788ddc1681",
"sha256:dccab8d5fa1ef9bfba0590ecf4d46df048d18ffe3eec01eeb73a42e0d9e7a8ba",
"sha256:dedb8adb91d11846ee08bec4c8236c8549ac721c245678282dcb06b221aab59f",
"sha256:e45ba65510e2647721e35323d6ef54c7974959f6081b58d4ef5d87c60c84919a",
"sha256:e53efc7c7cee4c1e70661e2e112ca46a575f90ed9ae3fef200f2a25e954f4b28",
"sha256:e635b87f01ebc977342e2697d05b56632f5f879a4f15955dfe8cef2448b51691",
"sha256:e70e990b2137b29dc5564715de1e12701815dacc1d056308e2b17e9095372a82",
"sha256:e8082b26888e2f8b36a042a58307d5b917ef2b1cacab921ad3323ef91901c71a",
"sha256:e8323a9b031aa0393768b87f04b4164a40037fb2a3c11ac06a03ffecd3618027",
"sha256:e92fca20c46e9f5e1bb485887d074918b13543b1c2a1185e69bb8d17ab6236a7",
"sha256:eb30abc20df9ab0814b5a2524f23d75dcf83cde762c161917a2b4b7b55b1e518",
"sha256:eba9904b0f38a143592d9fc0e19e2df0fa2e41c3c3745554761c5f6447eedabf",
"sha256:ef8de666d6179b009dce7bcb2ad4c4a779f113f12caf8dc77f0162c29d20490b",
"sha256:efd387a49825780ff861998cd959767800d54f8308936b21025326de4b5a42b9",
"sha256:f0aa37f3c979cf2546b73e8222bbfa3dc07a641585340179d768068e3455e544",
"sha256:f4074c5a429281bf056ddd4c5d3b740ebca4d43ffffe2ef4bf4d2d05114299da",
"sha256:f69a27e45c43520f5487f27627059b64aaf160415589230992cec34c5e18a509",
"sha256:fb707f3e15060adf5b7ada797624a6c6e0138e2a26baa089df64c68ee98e040f",
"sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a",
"sha256:fdb20a30fe1175ecabed17cbf7812f7b804b8a315a25f24678bcdf120a90077f"
],
"markers": "python_version >= '3.7'",
"version": "==3.4.2"
},
"idna": {
"hashes": [
"sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9",
"sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"
],
"markers": "python_version >= '3.6'",
"version": "==3.10"
},
"numpy": {
"hashes": [
"sha256:06d4fb37a8d383b769281714897420c5cc3545c79dc427df57fc9b852ee0bf58",
"sha256:0898c67a58cdaaf29994bc0e2c65230fd4de0ac40afaf1584ed0b02cd74c6fdd",
"sha256:0eba4a1ea88f9a6f30f56fdafdeb8da3774349eacddab9581a21234b8535d3d3",
"sha256:2393a914db64b0ead0ab80c962e42d09d5f385802006a6c87835acb1f58adb96",
"sha256:2e6a1409eee0cb0316cb64640a49a49ca44deb1a537e6b1121dc7c458a1299a8",
"sha256:33a5a12a45bb82d9997e2c0b12adae97507ad7c347546190a18ff14c28bbca12",
"sha256:389b85335838155a9076e9ad7f8fdba0827496ec2d2dc32ce69ce7898bde03ba",
"sha256:39b27d8b38942a647f048b675f134dd5a567f95bfff481f9109ec308515c51d8",
"sha256:43c55b6a860b0eb44d42341438b03513cf3879cb3617afb749ad49307e164edd",
"sha256:46d16f72c2192da7b83984aa5455baee640e33a9f1e61e656f29adf55e406c2b",
"sha256:48a2e8eaf76364c32a1feaa60d6925eaf32ed7a040183b807e02674305beef61",
"sha256:4d8d294287fdf685281e671886c6dcdf0291a7c19db3e5cb4178d07ccf6ecc67",
"sha256:4dc58865623023b63b10d52f18abaac3729346a7a46a778381e0e3af4b7f3beb",
"sha256:50080245365d75137a2bf46151e975de63146ae6d79f7e6bd5c0e85c9931d06a",
"sha256:54dfc8681c1906d239e95ab1508d0a533c4a9505e52ee2d71a5472b04437ef97",
"sha256:5754ab5595bfa2c2387d241296e0381c21f44a4b90a776c3c1d39eede13a746a",
"sha256:5814a0f43e70c061f47abd5857d120179609ddc32a613138cbb6c4e9e2dbdda5",
"sha256:581f87f9e9e9db2cba2141400e160e9dd644ee248788d6f90636eeb8fd9260a6",
"sha256:622a65d40d8eb427d8e722fd410ac3ad4958002f109230bc714fa551044ebae2",
"sha256:6295f81f093b7f5769d1728a6bd8bf7466de2adfa771ede944ce6711382b89dc",
"sha256:690d0a5b60a47e1f9dcec7b77750a4854c0d690e9058b7bef3106e3ae9117808",
"sha256:7729c8008d55e80784bd113787ce876ca117185c579c0d626f59b87d433ea779",
"sha256:80b46117c7359de8167cc00a2c7d823bdd505e8c7727ae0871025a86d668283b",
"sha256:81ae0bf2564cf475f94be4a27ef7bcf8af0c3e28da46770fc904da9abd5279b5",
"sha256:87717eb24d4a8a64683b7a4e91ace04e2f5c7c77872f823f02a94feee186168f",
"sha256:8b51ead2b258284458e570942137155978583e407babc22e3d0ed7af33ce06f8",
"sha256:9498f60cd6bb8238d8eaf468a3d5bb031d34cd12556af53510f05fcf581c1b7e",
"sha256:99224862d1412d2562248d4710126355d3a8db7672170a39d6909ac47687a8a4",
"sha256:a0be278be9307c4ab06b788f2a077f05e180aea817b3e41cebbd5aaf7bd85ed3",
"sha256:aaf81c7b82c73bd9b45e79cfb9476cb9c29e937494bfe9092c26aece812818ad",
"sha256:aba48d17e87688a765ab1cd557882052f238e2f36545dfa8e29e6a91aef77afe",
"sha256:b0f1f11d0a1da54927436505a5a7670b154eac27f5672afc389661013dfe3d4f",
"sha256:b9446d9d8505aadadb686d51d838f2b6688c9e85636a0c3abaeb55ed54756459",
"sha256:ba17f93a94e503551f154de210e4d50c5e3ee20f7e7a1b5f6ce3f22d419b93bb",
"sha256:bd8df082b6c4695753ad6193018c05aac465d634834dca47a3ae06d4bb22d9ea",
"sha256:c24bb4113c66936eeaa0dc1e47c74770453d34f46ee07ae4efd853a2ed1ad10a",
"sha256:c39ec392b5db5088259c68250e342612db82dc80ce044cf16496cf14cf6bc6f8",
"sha256:c3c9fdde0fa18afa1099d6257eb82890ea4f3102847e692193b54e00312a9ae9",
"sha256:c8738baa52505fa6e82778580b23f945e3578412554d937093eac9205e845e6e",
"sha256:d11fa02f77752d8099573d64e5fe33de3229b6632036ec08f7080f46b6649959",
"sha256:d344ca32ab482bcf8735d8f95091ad081f97120546f3d250240868430ce52555",
"sha256:d8fa264d56882b59dcb5ea4d6ab6f31d0c58a57b41aec605848b6eb2ef4a43e8",
"sha256:df470d376f54e052c76517393fa443758fefcdd634645bc9c1f84eafc67087f0",
"sha256:e017a8a251ff4d18d71f139e28bdc7c31edba7a507f72b1414ed902cbe48c74d",
"sha256:e43c3cce3b6ae5f94696669ff2a6eafd9a6b9332008bafa4117af70f4b88be6f",
"sha256:e651756066a0eaf900916497e20e02fe1ae544187cb0fe88de981671ee7f6270",
"sha256:e6648078bdd974ef5d15cecc31b0c410e2e24178a6e10bf511e0557eed0f2570",
"sha256:ee9d3ee70d62827bc91f3ea5eee33153212c41f639918550ac0475e3588da59f",
"sha256:ef6c1e88fd6b81ac6d215ed71dc8cd027e54d4bf1d2682d362449097156267a2",
"sha256:f14e016d9409680959691c109be98c436c6249eaf7f118b424679793607b5944",
"sha256:f420033a20b4f6a2a11f585f93c843ac40686a7c3fa514060a97d9de93e5e72b"
],
"index": "pypi",
"markers": "python_version >= '3.11'",
"version": "==2.3.0"
},
"pyee": {
"hashes": [
"sha256:48195a3cddb3b1515ce0695ed76036b5ccc2ef3a9f963ff9f77aec0139845498",
"sha256:b391e3c5a434d1f5118a25615001dbc8f669cf410ab67d04c4d4e07c55481c37"
],
"markers": "python_version >= '3.8'",
"version": "==13.0.0"
},
"python-ffmpeg": {
"hashes": [
"sha256:19ac80af5a064a2f53c245af1a909b2d7648ea045500d96d3bcd507b88d43dc7",
"sha256:d86697da8dfb39335183e336d31baf42fb217468adf5ac97fd743898240faae3"
],
"index": "pypi",
"markers": "python_version >= '3.7'",
"version": "==2.0.12"
},
"requests": {
"hashes": [
"sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c",
"sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422"
],
"markers": "python_version >= '3.8'",
"version": "==2.32.4"
},
"scipy": {
"hashes": [
"sha256:05dc6abcd105e1a29f95eada46d4a3f251743cfd7d3ae8ddb4088047f24ea477",
"sha256:06efcba926324df1696931a57a176c80848ccd67ce6ad020c810736bfd58eb1c",
"sha256:0a769105537aa07a69468a0eefcd121be52006db61cdd8cac8a0e68980bbb723",
"sha256:0bdd905264c0c9cfa74a4772cdb2070171790381a5c4d312c973382fc6eaf730",
"sha256:0ff17c0bb1cb32952c09217d8d1eed9b53d1463e5f1dd6052c7857f83127d539",
"sha256:14ed70039d182f411ffc74789a16df3835e05dc469b898233a245cdfd7f162cb",
"sha256:185cd3d6d05ca4b44a8f1595af87f9c372bb6acf9c808e99aa3e9aa03bd98cf6",
"sha256:18aaacb735ab38b38db42cb01f6b92a2d0d4b6aabefeb07f02849e47f8fb3594",
"sha256:1c832e1bd78dea67d5c16f786681b28dd695a8cb1fb90af2e27580d3d0967e92",
"sha256:263961f658ce2165bbd7b99fa5135195c3a12d9bef045345016b8b50c315cb82",
"sha256:271e3713e645149ea5ea3e97b57fdab61ce61333f97cfae392c28ba786f9bb49",
"sha256:2c620736bcc334782e24d173c0fdbb7590a0a436d2fdf39310a8902505008759",
"sha256:34716e281f181a02341ddeaad584205bd2fd3c242063bd3423d61ac259ca7eba",
"sha256:39cb9c62e471b1bb3750066ecc3a3f3052b37751c7c3dfd0fd7e48900ed52982",
"sha256:3ac07623267feb3ae308487c260ac684b32ea35fd81e12845039952f558047b8",
"sha256:3b0334816afb8b91dab859281b1b9786934392aa3d527cd847e41bb6f45bee65",
"sha256:40e54d5c7e7ebf1aa596c374c49fa3135f04648a0caabcb66c52884b943f02b4",
"sha256:50f9e62461c95d933d5c5ef4a1f2ebf9a2b4e83b0db374cb3f1de104d935922e",
"sha256:52092bc0472cfd17df49ff17e70624345efece4e1a12b23783a1ac59a1b728ed",
"sha256:5380741e53df2c566f4d234b100a484b420af85deb39ea35a1cc1be84ff53a5c",
"sha256:5e721fed53187e71d0ccf382b6bf977644c533e506c4d33c3fb24de89f5c3ed5",
"sha256:6487aa99c2a3d509a5227d9a5e889ff05830a06b2ce08ec30df6d79db5fcd5c5",
"sha256:6ac6310fdbfb7aa6612408bd2f07295bcbd3fda00d2d702178434751fe48e019",
"sha256:6cfd56fc1a8e53f6e89ba3a7a7251f7396412d655bca2aa5611c8ec9a6784a1e",
"sha256:6db907c7368e3092e24919b5e31c76998b0ce1684d51a90943cb0ed1b4ffd6c1",
"sha256:721d6b4ef5dc82ca8968c25b111e307083d7ca9091bc38163fb89243e85e3889",
"sha256:76ad1fb5f8752eabf0fa02e4cc0336b4e8f021e2d5f061ed37d6d264db35e3ca",
"sha256:79167bba085c31f38603e11a267d862957cbb3ce018d8b38f79ac043bc92d825",
"sha256:795c46999bae845966368a3c013e0e00947932d68e235702b5c3f6ea799aa8c9",
"sha256:7e11270a000969409d37ed399585ee530b9ef6aa99d50c019de4cb01e8e54e62",
"sha256:8c9ed3ba2c8a2ce098163a9bdb26f891746d02136995df25227a20e71c396ebb",
"sha256:993439ce220d25e3696d1b23b233dd010169b62f6456488567e830654ee37a6b",
"sha256:9d61e97b186a57350f6d6fd72640f9e99d5a4a2b8fbf4b9ee9a841eab327dc13",
"sha256:9db984639887e3dffb3928d118145ffe40eff2fa40cb241a306ec57c219ebbbb",
"sha256:9e2abc762b0811e09a0d3258abee2d98e0c703eee49464ce0069590846f31d40",
"sha256:a345928c86d535060c9c2b25e71e87c39ab2f22fc96e9636bd74d1dbf9de448c",
"sha256:ad3432cb0f9ed87477a8d97f03b763fd1d57709f1bbde3c9369b1dff5503b253",
"sha256:ae48a786a28412d744c62fd7816a4118ef97e5be0bee968ce8f0a2fba7acf3bb",
"sha256:aef683a9ae6eb00728a542b796f52a5477b78252edede72b8327a886ab63293f",
"sha256:b90ab29d0c37ec9bf55424c064312930ca5f4bde15ee8619ee44e69319aab163",
"sha256:c05045d8b9bfd807ee1b9f38761993297b10b245f012b11b13b91ba8945f7e45",
"sha256:c9deabd6d547aee2c9a81dee6cc96c6d7e9a9b1953f74850c179f91fdc729cb7",
"sha256:dde4fc32993071ac0c7dd2d82569e544f0bdaff66269cb475e0f369adad13f11",
"sha256:eae3cf522bc7df64b42cad3925c876e1b0b6c35c1337c93e12c0f366f55b0eaf",
"sha256:ed7284b21a7a0c8f1b6e5977ac05396c0d008b89e05498c8b7e8f4a1423bba0e",
"sha256:f77f853d584e72e874d87357ad70f44b437331507d1c311457bed8ed2b956126"
],
"index": "pypi",
"markers": "python_version >= '3.10'",
"version": "==1.15.3"
},
"sponsorblock": {
"hashes": [
"sha256:18fc7090e245e572c44251fe3619a5ca7a38913a1b4877549ac560652c4ab183",
"sha256:1d972f3b9a835ae9226ec23ab7b52731c203f217e763c04dec5eea7bc1ac67f8"
],
"index": "pypi",
"version": "==0.1.3"
},
"sponsorblock.py": {
"hashes": [
"sha256:050129046749d1c53458ffdefc04e04927464bd94d1696cdefdfef65db4d7a57",
"sha256:999617f38e10325207ab3902232f630c87235bd85cd76be7cf284b950a561eba"
],
"markers": "python_version >= '3.6'",
"version": "==0.2.3"
},
"typing-extensions": {
"hashes": [
"sha256:8676b788e32f02ab42d9e7c61324048ae4c6d844a399eebace3d4979d75ceef4",
"sha256:a1514509136dd0b477638fc68d6a91497af5076466ad0fa6c338e44e359944af"
],
"markers": "python_version >= '3.9'",
"version": "==4.14.0"
},
"urllib3": {
"hashes": [
"sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466",
"sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813"
],
"markers": "python_version >= '3.9'",
"version": "==2.4.0"
},
"yt-dlp": {
"hashes": [
"sha256:a49c4b76afeaded6254c3e2b759d8d5a13271aa963d5fccb51fe059d1c313151",
"sha256:ea73854c5dabc124f29a35a8fae9bc5d422ef3231bebeea2bdfa82ac191a9c29"
],
"index": "pypi",
"markers": "python_version >= '3.9'",
"version": "==2025.5.22"
}
},
"develop": {}
}

View file

@ -82,3 +82,23 @@ If no talk CSV file is provided, sequential names will be generated automaticall
0:47:55 Talk #2
[...]
```
### Usage with offline recordings
Some AV gear is capable of saving offline backup copies of the livestream in higher quality than those downloaded from YouTube.
If such files are available, the `--warp` option can be passed to this script. This will cause the generated output timestamps to be shifted relative to this supplied file (rather than being for the livestream). This allows you to drag the higher quality backup file (and the corresponding CSV file of segments) into LosslessCut, allowing you to generate higher quality uploads.
Notes for using this feature:
- Both the YouTube version of the recording and the offline backup copy MUST have INCREDIBLY similar audio tracks. This is how the offset detection is performed. This will not work if the offline copy has audio from a different microphone (such as one built into a camera).
- This feature will attempt to download the 480p version of the livestream using `yt-dlp` in order to be able to perform the offset detection. Please ensire you have space for this or pre-download a copy yourself with lower video resolution (the video component is not used for this process)
- This feature seems to cause temporary, but substantial RAM usage spike when performing the audio processing. Ensure you have a couple GB of spare memory for this to run (on a 32GiB system using ~16 GiB, peak usage was about 28GiB). This can be reduced with the `--lowmemory` flag as long as the backup recording starts no more than ~1hr relative to the time the corresponding livestream started.
- This feature expects that the original video clip used is at least an hour and 15 minutes long.
# Timewarp
This script is responsible for helping adjust calculations for video timestamps to account for differences between the livestream and corresponding sponsorblock timestamps as available from youtube , and any original source video clips that are of higher quality.
While this script includes a basic CLI, it is mainly just for testing and validation purposes. For processing videos, the timestamps script above should be used.

View file

@ -0,0 +1 @@
../transcode/helpers.py

View file

@ -8,6 +8,9 @@ from dataclasses import dataclass, field
from helpers import setup_logging, remap_dict_list
import logging
import sys
import yt_dlp
import subprocess
from timewarp import estimate_offset
logger = logging.getLogger(__name__)
@ -40,6 +43,23 @@ class VideoChunk:
def __repr__(self):
return f"VideoChunk(start={timedelta(seconds=self.start)}, end={timedelta(seconds=self.end)}, is_intermission={self.is_intermission}, title='{self.title}')"
def offset(self, offset):
return VideoChunk(
self.start + offset,
self.end + offset,
self.is_intermission,
self.title,
self.identifier
)
def contained_by(self, min_seconds, max_seconds):
overlaps_start = self.start < min_seconds and self.end > min_seconds
overlaps_end = self.start < max_seconds and self.end > max_seconds
return overlaps_end or overlaps_start
def youtube_format(self):
start_time = round_timedelta_for_yt(timedelta(seconds=self.start))
return f"{start_time} {self.title_or_intermission}"
@ -237,6 +257,58 @@ def write_to_losslesscut_file(video_chunks, include_intermissions=False):
with open('losslesscut.csv', 'w') as csvfile:
writer = csv.writer(csvfile)
writer.writerows([(c.start, c.end, c.identifier) for c in video_chunks])
def get_length(filename:str)-> float:
"""Returns the length of the specified video in seconds
Args:
filename (str): the filepath of the video to get the length of
Returns:
float: the number of seconds long the video is
"""
result = subprocess.run(["ffprobe", "-v", "error", "-show_entries",
"format=duration", "-of",
"default=noprint_wrappers=1:nokey=1", filename],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
return float(result.stdout)
def apply_warp(segments, source_url, target_file, lowmemory=False):
"""adjust the segments calculated so that they apply to target_file, rather than the livestream at source_url. This is useful if original recordings made from the livestreaming equipment, are available but dont perfectly match the times the stream was running.
Args:
segments (_type_): _description_
source_url (_type_): _description_
target_file (_type_): _description_
"""
# ensure youtube file is downloaded
yt_opts = {
'verbose': True,
'format': 'bestvideo[height<=480]+bestaudio/best[height<=480]' # limit to 480p video, we only need the audio
# "progress_hooks": [yt_dlp_monitor] # here's the function we just defined
}
ydl = yt_dlp.YoutubeDL(yt_opts)
dl = ydl.download(source_url)
source_filename = subprocess.getoutput(f'yt-dlp --print filename {source_url}').split("\n")[-1]
offset = estimate_offset(source_filename, target_file, lowmemory=lowmemory)
print(f"Offset detected: {offset} seconds")
offset_segs = [seg.offset(offset) for seg in list(segments)]
tgt_len = get_length(target_file)
# print_segments(offset_segs, full_format=args.full)
# filter to remove any segments with negative start time
offset_segs = list(filter(lambda s: s.start > 0 and s.start < tgt_len, offset_segs))
return offset_segs
if __name__ == "__main__":
@ -244,10 +316,13 @@ if __name__ == "__main__":
parser.add_argument('video', help='the url of the video to generate timestamps for')
parser.add_argument('--talks', help='the path to the CSV file containing the ordered data for the talk segments (in this video only)')
parser.add_argument('--full', action='store_true', help='output the timestamps in full-detail format')
parser.add_argument('--warp', help='whether to warp the timestamps to match the specified file instead (such as if an original copy of the recording at a higher quality is available) - File must have a near-identical audio track to the youtube livestream')
parser.add_argument('--lowmemory', action='store_true', help='instruct the audio processing for the warp calculation to operate in low memory mode. Has no effect on other flags.')
parser.add_argument('--titlekey', type=str, default="TalkName", help='The name of the heading used to look up the title of each talk. Defaults to "TalkName"')
parser.add_argument('-v', '--verbose', action='count', dest='verbosity', default=0, help="verbose output (repeat for increased verbosity)")
parser.add_argument('-q', '--quiet', action='store_const', const=-1, default=0, dest='verbosity', help="quiet output (show errors only)")
args = parser.parse_args()
setup_logging(args.verbosity)
@ -257,11 +332,17 @@ if __name__ == "__main__":
segments = combine_intermission_and_content_chunks(intermissions, talks, total_video_duration=total_video_duration)
if args.warp:
segments = apply_warp(segments, args.video, args.warp, lowmemory=args.lowmemory)
print_segments(segments, full_format=args.full)
identifiers = [c.identifier for c in segments]
if all(lambda c: c.is_intermission or c.identifier != "", segments) and len(set(identifiers)) == len(identifiers):
# validate that all segments are either intermissions or have an identifier
segments_valid = [c.is_intermission or c.identifier != "" for c in segments]
if args.warp or all(segments_valid) and len(set(identifiers)) == len(identifiers):
write_to_losslesscut_file(segments)
else:
logger.warning("Not printing losslesscut file because not every content line had a unique identifier value specified")

View file

@ -0,0 +1,96 @@
from ffmpeg import Progress, FFmpeg as FFmpegSync
import numpy as np
import scipy.signal
import scipy.io.wavfile
import os
import tempfile
from helpers2 import setup_ffmpeg_output
def extract_audio(video_path, out_path, sample_rate=16000, debug=True, duration=60 * 75):
extract = FFmpegSync()
if duration is not None:
extract = extract.input(video_path, t=duration) # Limit extraction to first `duration` seconds
else:
extract = extract.input(video_path)
extract = extract.output(out_path, ac=1, ar=sample_rate, format='wav')
setup_ffmpeg_output(extract, debug=debug)
extract.execute()
def read_audio_as_array(audio_path):
rate, data = scipy.io.wavfile.read(audio_path)
# Normalize to float32
if data.dtype != np.float32:
data = data.astype(np.float32) / np.max(np.abs(data))
return rate, data
def find_offset(signal1, signal2, rate):
corr = scipy.signal.correlate(signal2, signal1, mode='full')
lag = np.argmax(corr) - len(signal1) + 1
offset_seconds = lag / rate
return offset_seconds
def estimate_offset(reference_path, incoming_path, lowmemory=False):
"""given two downloaded videos, how much delay (seconds) needs to be added (positive or negative) to the video represented by incoming_path for its content to match the video specified by reference_path
Args:
reference_path (_type_): the reference video to base the offset on
incoming_path (_type_): the target video to determine the offset for
Raises:
ValueError: _description_
Returns:
float: how much delay (seconds) needs to be added to the video represented by incoming_path for its content to match the video specified by reference_path
"""
with tempfile.TemporaryDirectory() as tmpdir:
audio1_path = os.path.join(tmpdir, 'audio1.wav')
audio2_path = os.path.join(tmpdir, 'audio2.wav')
print("Extracting audio...")
# since the process of comparing the offsets uses memory proportional to
# how much audio data there is, we add a lowmemory flag.
# This which causes the script to use the same sample duration for
# the reference audio, versus the default of using the whole thing.
# If the audio is out of sync by more than this amount (at time of writing 1h 15m)
# then the script could fail to calculate a time.
if lowmemory:
extract_audio(reference_path, audio1_path)
else:
extract_audio(reference_path, audio1_path, duration=None)
extract_audio(incoming_path, audio2_path)
print("Reading audio...")
rate1, audio1 = read_audio_as_array(audio1_path)
rate2, audio2 = read_audio_as_array(audio2_path)
if rate1 != rate2:
raise ValueError("Sample rates do not match")
print("Calculating offset...")
offset = find_offset(audio1, audio2, rate1)
return offset
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='Estimate time offset between two videos via audio.')
parser.add_argument('video1', help='Path to reference video (e.g. livestream)')
parser.add_argument('video2', help='Path to second video (e.g. original recording)')
args = parser.parse_args()
offset = estimate_offset(args.video1, args.video2)
print(f"Estimated offset (in seconds): {offset:.2f}")
if offset > 0:
print("Video 2 starts after Video 1")
else:
print("Video 2 starts before Video 1")