Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
Subtitles: on-demand speech pack (runtime wheel, English model, VAD, language gate) with licence...
Bowen Xuec62e83782c83
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.mdindex e8473b3..f52bd53 100644--- a/THIRD_PARTY_NOTICES.md+++ b/THIRD_PARTY_NOTICES.md@@ -13,6 +13,12 @@ FreeVideo code uses [Apache-2.0](LICENSE). Its dependencies and models retain th| [VDN-H3 and H3 model weights](https://huggingface.co/OpenVDN/vdn-minimax-h3-edge/blob/main/LICENSE) | MiniMax H3 Community License || [MiniMax H3 latent upscaler](https://huggingface.co/LBH-123-AI/Minimax_h3_latent_Upscaler) | [MIT](freevideo_engine/licenses/latent-upscaler-MIT.txt) || [FreeToken](https://github.com/FlashML-org/FreeToken) prompt VLM operators, [Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) optional weights | [Apache-2.0](freevideo_engine/licenses/FreeToken-Apache-2.0.txt) |+| [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) 1.13.8 speech runtime, built by FreeVideo without text-to-speech, ALSA and PortAudio (modified build; `__init__.py` edited; source snapshot 11afbd00 kept by FreeVideo; optional download for automatic subtitles, [build note](freevideo_engine/licenses/sherpa-onnx-build-NOTE.txt)). Includes statically linked kaldi-native-fbank, kaldi-decoder, kaldifst, OpenFst, simple-sentencepiece (Apache-2.0), KissFFT (BSD-3-Clause), pybind11 (BSD-3-Clause), nlohmann/json (MIT), hclust-cpp (BSD-2-Clause) | Apache-2.0 |+| [ONNX Runtime](https://github.com/microsoft/onnxruntime) 1.28.2 (CPU), © Microsoft Corporation; its third-party notices are shipped inside the sherpa-onnx wheel | MIT |+| [Eigen](https://gitlab.com/libeigen/eigen) 5.0.1, compiled into sherpa-onnx and ONNX Runtime; source: https://gitlab.com/libeigen/eigen/-/tree/5.0.1 | MPL-2.0 |+| [Silero VAD](https://github.com/snakers4/silero-vad) v5.0 voice-activity model, © 2020-present Silero Team (optional download; license file downloaded with the model) | [MIT](freevideo_engine/licenses/Silero-VAD-MIT.txt) |+| [NVIDIA NeMo stt_en_conformer_ctc_small](https://huggingface.co/nvidia/stt_en_conformer_ctc_small), © NVIDIA, exported to ONNX and quantized to int8 by the sherpa-onnx project, changed from the original; not endorsed by NVIDIA (optional download for English subtitles; [notice](freevideo_engine/licenses/NeMo-stt_en_conformer_ctc_small-NOTICE.txt)) | [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/) |+| [OpenAI Whisper tiny](https://github.com/openai/whisper), © 2022 OpenAI, exported to ONNX and quantized to int8 by the sherpa-onnx project (optional download for spoken-language detection) | [MIT](freevideo_engine/licenses/Whisper-MIT.txt) || [Lucide](https://lucide.dev) icons (image editor: eyedropper, hand, crop) | [ISC](freevideo_engine/licenses/Lucide-ISC.txt) || [Noto Sans CJK SC and Noto Sans Mono CJK SC](https://github.com/notofonts/noto-cjk) 2.004, © 2014-2021 Adobe: subsets renamed FreeVideo Sans SC and FreeVideo Mono SC (image editor text, editor text and subtitles / 剪辑视图的文字和字幕, share card, Linux launcher) | [SIL OFL 1.1](freevideo_engine/licenses/Noto-CJK-Sans-OFL.txt) || [Noto Serif CJK SC](https://github.com/notofonts/noto-cjk) 2.003, © 2017-2024 Adobe: subset renamed FreeVideo Serif SC (image editor text, editor text and subtitles / 剪辑视图的文字和字幕) | [SIL OFL 1.1](freevideo_engine/licenses/Noto-CJK-Serif-OFL.txt) |diff --git a/freevideo_engine/licenses/NeMo-stt_en_conformer_ctc_small-NOTICE.txt b/freevideo_engine/licenses/NeMo-stt_en_conformer_ctc_small-NOTICE.txtnew file mode 100644index 0000000..de14054--- /dev/null+++ b/freevideo_engine/licenses/NeMo-stt_en_conformer_ctc_small-NOTICE.txt@@ -0,0 +1,14 @@+English speech recognition model for automatic subtitles++Original work: NVIDIA NeMo "stt_en_conformer_ctc_small"+https://huggingface.co/nvidia/stt_en_conformer_ctc_small+Copyright (c) NVIDIA Corporation+Licensed under the Creative Commons Attribution 4.0 International licence (CC-BY-4.0)+https://creativecommons.org/licenses/by/4.0/++Changes: the model was exported to ONNX and quantized to int8 by the sherpa-onnx+project (csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-small). FreeVideo uses that+file unchanged.++The model is provided as is, without warranty of any kind. This is not an official+NVIDIA release and NVIDIA does not endorse FreeVideo.diff --git a/freevideo_engine/licenses/Silero-VAD-MIT.txt b/freevideo_engine/licenses/Silero-VAD-MIT.txtnew file mode 100644index 0000000..0bf5e90--- /dev/null+++ b/freevideo_engine/licenses/Silero-VAD-MIT.txt@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2020-present Silero Team++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.\ No newline at end of filediff --git a/freevideo_engine/licenses/Whisper-MIT.txt b/freevideo_engine/licenses/Whisper-MIT.txtnew file mode 100644index 0000000..d255525--- /dev/null+++ b/freevideo_engine/licenses/Whisper-MIT.txt@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2022 OpenAI++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/freevideo_engine/licenses/sherpa-onnx-build-NOTE.txt b/freevideo_engine/licenses/sherpa-onnx-build-NOTE.txtnew file mode 100644index 0000000..eb1e23f--- /dev/null+++ b/freevideo_engine/licenses/sherpa-onnx-build-NOTE.txt@@ -0,0 +1,20 @@+sherpa-onnx speech runtime built by FreeVideo++Based on sherpa-onnx 1.13.8 (https://github.com/k2-fsa/sherpa-onnx, Apache-2.0),+source snapshot 11afbd009a7f8c08f4bcf2fc1b265d0df4670fbf, built by FreeVideo.++Changes (Apache-2.0 section 4(b)): built with text-to-speech, ALSA, PortAudio and+the WebSocket server turned off; `sherpa_onnx/__init__.py` no longer imports the two+classes that this configuration does not build (`GenerationConfig`,+`OfflineTtsSupertonicModelConfig`) and records `__version__`. The compiled code is+otherwise built from the unmodified upstream source. This is not the official+sherpa-onnx distribution.++Included components keep their own licences, shipped inside the wheel's+`*.dist-info/licenses` folder: ONNX Runtime 1.28.2 (MIT, (c) Microsoft Corporation,+with its third-party notices), Eigen 5.0.1 (MPL-2.0; source:+https://gitlab.com/libeigen/eigen/-/tree/5.0.1, and the copy inside ONNX Runtime:+https://github.com/microsoft/onnxruntime/tree/v1.28.2), kaldi-native-fbank,+kaldi-decoder, kaldifst, OpenFst, simple-sentencepiece (Apache-2.0), KissFFT and+pybind11 (BSD-3-Clause), nlohmann/json (MIT), hclust-cpp and Darts-clone (BSD-2-Clause),+ThreadPool (Zlib).diff --git a/freevideo_engine/subtitle_ears.py b/freevideo_engine/subtitle_ears.pyindex 71ae5e7..a814339 100644--- a/freevideo_engine/subtitle_ears.py+++ b/freevideo_engine/subtitle_ears.py@@ -35,7 +35,7 @@ MAX_LINE_CHARS = 2000MAX_JOBS = 200_JOB_ID = re.compile(r's-[0-9a-f]{32}')_LANGUAGE = re.compile(r'auto|[a-z]{2,3}(-[A-Za-z0-9]{2,8})?')-_REASONS = ('no_engine', 'no_sound', 'too_long', 'source_missing', 'unreadable', 'disk_full', 'failed')+_REASONS = ('no_engine', 'no_sound', 'language', 'too_long', 'source_missing', 'unreadable', 'disk_full', 'failed')class EarsError(Exception):@@ -482,3 +482,40 @@ def register():return web.json_response({'reason': 'failed'}, status=404)except (ValueError, TypeError):return web.json_response({'reason': 'failed'}, status=400)++ from . import subtitle_pack+ installer = subtitle_pack.Installer()+ server._freevideo_subtitle_pack = installer++ def pack_state():+ return dict(subtitle_pack.status(), install=installer.state())++ @server.routes.get('/freevideo/editor/subtitle-pack')+ async def pack_status(request):+ value = await asyncio.to_thread(pack_state)+ return web.json_response(value, headers={'Cache-Control': 'no-store'})++ @server.routes.post('/freevideo/editor/subtitle-pack')+ async def pack_install(request):+ try:+ body = await request.json()+ if not isinstance(body, dict) or set(body) - {'action', 'language'}:+ raise ValueError('Invalid request')+ action = body.get('action')+ if action == 'cancel':+ installer.cancel()+ elif action == 'install':+ value = await asyncio.to_thread(subtitle_pack.status)+ if not value['supported']:+ return web.json_response({'reason': 'unsupported'}, status=409)+ if not value['published']:+ return web.json_response({'reason': 'not_published'}, status=409)+ groups = ('runtime', 'speech', 'language') if body.get('language') is True else ('runtime', 'speech')+ if body.get('language') not in (None, True, False):+ raise ValueError('Invalid request')+ installer.start(groups)+ else:+ raise ValueError('Invalid request')+ except (ValueError, TypeError):+ return web.json_response({'reason': 'failed'}, status=400)+ return web.json_response(await asyncio.to_thread(pack_state), headers={'Cache-Control': 'no-store'})diff --git a/freevideo_engine/subtitle_pack.json b/freevideo_engine/subtitle_pack.jsonnew file mode 100644index 0000000..1f0c838--- /dev/null+++ b/freevideo_engine/subtitle_pack.json@@ -0,0 +1,83 @@+{+ "format": 1,+ "repo": "OpenVDN/vdn-minimax-h3-edge",+ "prefix": "subtitles-v1",+ "revision": null,+ "python": "cp312",+ "groups": {+ "speech": [+ {+ "file": "en/model.int8.onnx",+ "bytes": 46419854,+ "sha256": "66cfde4ce0b6da9e1a4352e58f0c968f87da23070cf229c81ae0d520cddad2a2"+ },+ {+ "file": "en/tokens.txt",+ "bytes": 11611,+ "sha256": "1adce7866285e6a4aac6208b120d5b8e4302b7cae5f2ae541c343097773fd988"+ },+ {+ "file": "silero_vad_v5.onnx",+ "bytes": 2313101,+ "sha256": "6b99cbfd39246b6706f98ec13c7c50c6b299181f2474fa05cbc8046acc274396"+ },+ {+ "file": "licenses/NeMo-stt_en_conformer_ctc_small-NOTICE.txt",+ "bytes": 653,+ "sha256": "d46e410b4d9a90c52b1f8731d961a537032094b4f894dfb54cb4f65225049693"+ },+ {+ "file": "licenses/Silero-VAD-MIT.txt",+ "bytes": 1075,+ "sha256": "2e63e9a38b6e8fc0c7bc37ce174caca1862870856c6daf5697cfb785e925520b"+ }+ ],+ "language": [+ {+ "file": "lid/tiny-encoder.int8.onnx",+ "bytes": 12937772,+ "sha256": "d24fb083ae3b1041fc24e97971d60e280c9342201fbb67b0ab428a8b4a51a434"+ },+ {+ "file": "lid/tiny-decoder.int8.onnx",+ "bytes": 89855401,+ "sha256": "d2fece8dd42771f1df975c6c0445770d0c292bf7547c2cae04a6c0cc57540925"+ },+ {+ "file": "licenses/Whisper-MIT.txt",+ "bytes": 1063,+ "sha256": "b5d65a59060e68c4ff940e1eddfa6f94b2d68fdf58ed7f4dd57721c997e35e9d"+ }+ ],+ "runtime": [+ {+ "file": "licenses/sherpa-onnx-build-NOTE.txt",+ "bytes": 1194,+ "sha256": "27099ee57a0cc3118daa1613532b94ac2c029b05995d212e9000bff5888eb337"+ }+ ]+ },+ "wheels": {+ "linux-x86_64": {+ "file": "runtime/linux-x86_64/sherpa_onnx-1.13.8-cp312-cp312-linux_x86_64.whl",+ "bytes": 10419063,+ "sha256": "1955198c6345be58515a91c918b02ceb857cd6ea9eb9d09831834cbcd011fe76"+ },+ "macos-arm64": {+ "file": "runtime/macos-arm64/sherpa_onnx-1.13.8-cp312-cp312-macosx_11_0_arm64.whl",+ "bytes": 9527932,+ "sha256": "faab3e8500a113b95863a5bd8500bc64831f52d61db8d5643804852c9b1f2592"+ },+ "macos-x86_64": {+ "file": "runtime/macos-x86_64/sherpa_onnx-1.13.8-cp312-cp312-macosx_10_15_x86_64.whl",+ "bytes": 10815895,+ "sha256": "04e65d27130051a88abeb521b8a94878cf2d23d11e9a630ab85792e1057e98ac"+ },+ "windows-x64": null+ },+ "origin": {+ "speech": "csukuangfj/sherpa-onnx-nemo-ctc-en-conformer-small (NVIDIA NeMo stt_en_conformer_ctc_small, CC-BY-4.0); snakers4/silero-vad v5.0 (MIT)",+ "language": "csukuangfj/sherpa-onnx-whisper-tiny (OpenAI Whisper tiny, MIT)",+ "runtime": "k2-fsa/sherpa-onnx 1.13.8 built by FreeVideo without text-to-speech (source 11afbd009a7f8c08f4bcf2fc1b265d0df4670fbf)"+ }+}diff --git a/freevideo_engine/subtitle_pack.py b/freevideo_engine/subtitle_pack.pynew file mode 100644index 0000000..310896a--- /dev/null+++ b/freevideo_engine/subtitle_pack.py@@ -0,0 +1,316 @@+"""On-demand download of the automatic-subtitle models and speech runtime.++Nothing here ships in the installer. The catalog (`subtitle_pack.json`) lists+every file with its size and sha256; a file is used only after it matched.+Layout under `<model_root>/subtitles/`: `en/` and `silero_vad_v5.onnx` (speech),+`lid/` (spoken-language detection), `licenses/`, `runtime/<platform>/` (the wheel as+downloaded) and `unpacked/<sha12>/` where that wheel is unpacked and put on `sys.path` before `import sherpa_onnx`.++A catalog without a `revision` is not published yet: `status()` says so and+`available()` of the speech engine stays False, so subtitles remain manual.+"""+import json+import os+from pathlib import Path+import platform+import shutil+import sys+import threading+import time+import zipfile++from . import disk_space++GROUPS = ('runtime', 'speech', 'language')+RESERVE = 256 * 2**20+MAX_UNPACKED = 256 * 2**20+LEDGER = 'download-verified.json'+COMPLETE = 'complete.json'+++class PackError(Exception):+ def __init__(self, reason):+ super().__init__(reason)+ self.reason = reason+++def catalog():+ return json.loads(Path(__file__).with_name('subtitle_pack.json').read_text(encoding='utf-8'))+++def platform_key():+ machine = platform.machine().lower()+ if sys.platform == 'win32':+ return 'windows-x64' if machine in ('amd64', 'x86_64') else None+ if sys.platform == 'darwin':+ return 'macos-arm64' if machine in ('arm64', 'aarch64') else 'macos-x86_64' if machine == 'x86_64' else None+ if sys.platform.startswith('linux'):+ return 'linux-x86_64' if machine in ('x86_64', 'amd64') else None+ return None+++def base(root=None):+ if root is None:+ from .paths import model_root+ root = model_root()+ return Path(root) / 'subtitles'+++def wheel_row(spec=None):+ """This machine's runtime wheel row, or None (other platform, Python or not built yet)."""+ spec = spec or catalog()+ tag = 'cp%d%d' % sys.version_info[:2]+ if spec.get('python') != tag:+ return None+ return (spec.get('wheels') or {}).get(platform_key())+++def rows(group, spec=None):+ spec = spec or catalog()+ found = list(spec['groups'][group])+ if group == 'runtime':+ wheel = wheel_row(spec)+ if wheel:+ found.append(wheel)+ return found+++def runtime_folder(root=None, spec=None):+ wheel = wheel_row(spec)+ return base(root) / 'unpacked' / wheel['sha256'][:12] if wheel else None+++def _ledger(folder):+ try:+ value = json.loads((folder / LEDGER).read_text(encoding='utf-8'))+ return value if isinstance(value, dict) else {}+ except (OSError, ValueError):+ return {}+++def _intact(folder, row, ledger):+ """Size and the stamp recorded after the last hash match; no hashing here."""+ from . import provision+ path = folder / row['file']+ try:+ if not path.is_file() or path.stat().st_size != row['bytes']:+ return False+ prior = ledger.get(str(path))+ return isinstance(prior, dict) and all(+ prior.get(key) == value for key, value in provision.file_identity(path, row).items())+ except OSError:+ return False+++def _unpacked(root, spec=None):+ folder = runtime_folder(root, spec)+ if folder is None:+ return False+ try:+ receipt = json.loads((folder / COMPLETE).read_text(encoding='utf-8'))+ return receipt.get('sha256') == wheel_row(spec)['sha256'] and (folder / 'sherpa_onnx' / '__init__.py').is_file()+ except (OSError, ValueError, KeyError, TypeError):+ return False+++def ready(group, root=None, spec=None):+ spec = spec or catalog()+ folder = base(root)+ if group == 'runtime' and wheel_row(spec) is None:+ return False+ ledger = _ledger(folder)+ if not all(_intact(folder, row, ledger) for row in rows(group, spec)):+ return False+ return _unpacked(root, spec) if group == 'runtime' else True+++def missing_bytes(group, root=None, spec=None):+ spec = spec or catalog()+ folder = base(root)+ ledger = _ledger(folder)+ return sum(row['bytes'] for row in rows(group, spec) if not _intact(folder, row, ledger))+++def status(root=None):+ """What a page may show: whether the pack can be installed here and what is already in place."""+ spec = catalog()+ runtime_here = wheel_row(spec) is not None+ published = bool(spec.get('revision'))+ state = {}+ for group in GROUPS:+ state[group] = dict(ready=ready(group, root, spec), bytes=missing_bytes(group, root, spec))+ return dict(+ supported=runtime_here, published=published,+ installable=runtime_here and published,+ ready=state['runtime']['ready'] and state['speech']['ready'],+ language_ready=state['language']['ready'],+ bytes=sum(item['bytes'] for item in state.values()), groups=state)+++def activate(root=None):+ """Put the unpacked runtime on sys.path (once). True when sherpa_onnx can be imported from it."""+ try:+ spec = catalog()+ if not _unpacked(root, spec):+ return False+ folder = runtime_folder(root, spec)+ if str(folder) not in sys.path:+ sys.path.insert(0, str(folder))+ if sys.platform == 'win32' and hasattr(os, 'add_dll_directory'):+ for item in {folder} | {path.parent for path in folder.rglob('*.dll')}:+ os.add_dll_directory(str(item))+ return True+ except (OSError, ValueError, KeyError, TypeError):+ return False+++def _unpack(root, row, check):+ """Extract the verified wheel into unpacked/<sha12>/ and drop older unpacked runtimes."""+ folder = runtime_folder(root)+ wheel = base(root) / row['file']+ parent = folder.parent+ parent.mkdir(parents=True, exist_ok=True)+ work = parent / ('.unpack-' + row['sha256'][:12])+ shutil.rmtree(work, ignore_errors=True)+ total = 0+ try:+ with zipfile.ZipFile(wheel) as archive:+ for item in archive.infolist():+ check()+ name = item.filename+ parts = Path(name).parts+ if (name.startswith('/') or '\\' in name or ':' in name or not parts or '..' in parts+ or (item.external_attr >> 16) & 0o170000 == 0o120000):+ raise PackError('failed')+ total += item.file_size+ if total > MAX_UNPACKED:+ raise PackError('failed')+ target = work.joinpath(*parts)+ if item.is_dir():+ target.mkdir(parents=True, exist_ok=True)+ continue+ target.parent.mkdir(parents=True, exist_ok=True)+ with archive.open(item) as source, target.open('wb') as stream:+ shutil.copyfileobj(source, stream, 1024 * 1024)+ if not (work / 'sherpa_onnx' / '__init__.py').is_file():+ raise PackError('failed')+ (work / COMPLETE).write_text(json.dumps(dict(sha256=row['sha256'], bytes=total)), encoding='utf-8')+ shutil.rmtree(folder, ignore_errors=True)+ os.replace(work, folder)+ finally:+ shutil.rmtree(work, ignore_errors=True)+ for other in parent.iterdir():+ if other.is_dir() and other != folder and not other.name.startswith('.unpack-'):+ shutil.rmtree(other, ignore_errors=True)+++def install(groups=GROUPS, root=None, progress=None, check=None):+ """Download and verify the missing files of the groups; unpack the runtime. Resumable."""+ from . import network, provision+ from .adaln_assets import _download_plan+ from .monitoring import save+ spec = catalog()+ progress = progress or (lambda value: None)+ check = check or (lambda: None)+ if not spec.get('revision'):+ raise PackError('not_published')+ if 'runtime' in groups and wheel_row(spec) is None:+ raise PackError('unsupported')+ folder = base(root)+ folder.mkdir(parents=True, exist_ok=True)+ ledger = _ledger(folder)+ # A file without a stamp (a copied folder) is hashed once here and stamped.+ todo = [row for group in groups for row in rows(group, spec)+ if not provision.verified(folder / row['file'], row, ledger)]+ save(folder / LEDGER, ledger)+ total = sum(row['bytes'] for row in todo)+ retained = 0+ for row in todo:+ partial = (folder / row['file']).with_suffix((Path(row['file']).suffix) + '.partial')+ if partial.is_file() and partial.stat().st_size < row['bytes']:+ retained += partial.stat().st_size+ if total and disk_space.free_bytes(folder) < total - retained + RESERVE:+ raise PackError('disk_space')+ plan = _download_plan(root)+ # No verified ModelScope pair exists for this prefix; never guess a mirror revision.+ plan['sources'] = dict(plan.get('sources', {}), models=[+ row for row in plan.get('sources', {}).get('models', []) if row['id'] in ('official', 'hf-mirror')])+ if not plan['sources']['models']:+ plan['sources']['models'] = [{'id': 'official'}, {'id': 'hf-mirror'}]+ plan.update(quiet=True, resource_check=check)+ done = 0+ try:+ for row in todo:+ check()+ path = folder / row['file']+ remote = dict(repo=spec['repo'], revision=spec['revision'], file=spec['prefix'] + '/' + row['file'])++ def moved(current, size, speed, **kwargs):+ progress(dict(phase='download', done=done + current, total=total))+ network.download(network.model_urls(plan, remote), path, row['sha256'], moved,+ network=plan, size=row['bytes'], keep_partial=True, stall_seconds=30)+ ledger[str(path)] = provision.file_identity(path, row)+ save(folder / LEDGER, ledger)+ done += row['bytes']+ if 'runtime' in groups and not _unpacked(root, spec):+ progress(dict(phase='unpack', done=total, total=total))+ _unpack(root, wheel_row(spec), check)+ except PackError:+ raise+ except InterruptedError:+ raise+ except ValueError as error:+ raise PackError('disk_space' if str(error) == 'disk_space' else 'download_failed') from error+ except Exception as error:+ raise PackError('download_failed') from error+++class Installer:+ """One background installation at a time; a page polls `state()`."""++ def __init__(self, root=None):+ self.root = root+ self.lock = threading.Lock()+ self.stop = threading.Event()+ self.thread = None+ self.value = dict(state='idle', done=0, total=0, reason=None)++ def state(self):+ with self.lock:+ return dict(self.value)++ def _set(self, **kwargs):+ with self.lock:+ self.value.update(kwargs)++ def start(self, groups=GROUPS):+ with self.lock:+ if self.thread is not None and self.thread.is_alive():+ return dict(self.value)+ self.stop = threading.Event()+ self.value = dict(state='running', done=0, total=0, reason=None, started=time.time())+ self.thread = threading.Thread(target=self._run, args=(tuple(groups), self.stop),+ name='freevideo-subtitle-pack', daemon=True)+ self.thread.start()+ return dict(self.value)++ def cancel(self):+ self.stop.set()+ return self.state()++ def _run(self, groups, stop):+ def check():+ if stop.is_set():+ raise InterruptedError('cancelled')++ def progress(value):+ self._set(done=value.get('done', 0), total=value.get('total', 0))+ try:+ install(groups, self.root, progress, check)+ self._set(state='done', reason=None)+ except InterruptedError:+ self._set(state='cancelled', reason=None)+ except PackError as error:+ self._set(state='failed', reason=error.reason)+ except Exception:+ self._set(state='failed', reason='failed')diff --git a/freevideo_engine/subtitle_sherpa.py b/freevideo_engine/subtitle_sherpa.pyindex 03ca47a..927d4c1 100644--- a/freevideo_engine/subtitle_sherpa.py+++ b/freevideo_engine/subtitle_sherpa.py@@ -12,6 +12,13 @@ engine reports "not installed" and the ears stay off.An optional shared `subtitles/silero_vad_v5.onnx` gates words by speech time.It leaves the CTC windows intact; without the verified VAD file the enginecontinues with unfiltered recognition. No models are downloaded at runtime.++Recognition with `auto` first names the spoken language (Whisper-tiny language+identification, `subtitles/lid/`, size and SHA-256 pinned). A speech language+without an installed model is refused with the `language` reason; without the+verified identification files `auto` is refused as `no_engine`, so a sound in+another language never becomes a track of wrong words. An explicit language+needs its own model, never another one."""import hashlibimport logging@@ -21,7 +28,7 @@ import threadingimport unicodedatafrom .paths import model_root-from .subtitle_ears import Cancelled, register_engine+from .subtitle_ears import Cancelled, EarsError, register_engineRATE = 16000CORE = 24.0 # seconds each window owns@@ -35,6 +42,15 @@ VAD_MODEL = 'silero_vad_v5.onnx'# incompatible exports (including faster-whisper's v6); verify before loading.VAD_SHA256 = '6b99cbfd39246b6706f98ec13c7c50c6b299181f2474fa05cbc8046acc274396'VAD_BYTES = 2313101+# Whisper-tiny int8 export (HF csukuangfj/sherpa-onnx-whisper-tiny): only the+# language-identification pass is used. Verified before the native loader sees it.+LID_FOLDER = 'lid'+LID_FILES = {+ 'tiny-encoder.int8.onnx': (12937772, 'd24fb083ae3b1041fc24e97971d60e280c9342201fbb67b0ab428a8b4a51a434'),+ 'tiny-decoder.int8.onnx': (89855401, 'd2fece8dd42771f1df975c6c0445770d0c292bf7547c2cae04a6c0cc57540925'),+}+LID_SECONDS = 30. # speech handed to the identifier (its own window)+LID_MIN_SECONDS = .5 # less speech than this is "nobody said anything"VAD_PAD = .4 # include soft onsets and the delay of CTC token peaks_LOG = logging.getLogger(__name__)@@ -326,16 +342,95 @@ class Engine:self._vad = Noneself._vad_signature = Noneself._vad_lock = threading.Lock()+ self._lid_folder = next(iter(directories.values())).parent / LID_FOLDER+ self._lid = None+ self._lid_signature = None+ self._lid_lock = threading.Lock()def languages(self):return sorted(self._directories)def _pick(self, language, text=''):+ """The model for a language that is already known (named, or read from given lines)."""if language in self._directories:return language- # auto, or a language without a model: judge by the script when there is one- wanted = ('zh' if _CJK.search(text) else 'en') if text.strip() else 'zh'- return wanted if wanted in self._directories else sorted(self._directories)[0]+ if language == 'auto' and text.strip():+ wanted = 'zh' if _CJK.search(text) else 'en'+ if wanted in self._directories:+ return wanted+ raise EarsError('no_engine')++ def _lid_ready(self):+ """The identification files, verified by size and SHA-256, or None."""+ try:+ for name, (size, digest) in LID_FILES.items():+ path = self._lid_folder / name+ if path.stat().st_size != size:+ return None+ signature = tuple((self._lid_folder / name).stat().st_mtime_ns for name in LID_FILES)+ if signature != self._lid_signature:+ self._lid = None+ self._lid_signature = None+ for name, (size, digest) in LID_FILES.items():+ if hashlib.sha256((self._lid_folder / name).read_bytes()).hexdigest() != digest:+ _LOG.warning('Subtitle language identification model is unverified')+ return None+ self._lid_signature = signature+ return self._lid_folder+ except OSError:+ return None++ def _identify(self, audio, cancelled):+ """Spoken language code of the first stretch of speech; None when nobody speaks."""+ import numpy as np+ pieces, total = [], 0.+ for first, last, own_from, own_to in windows(audio.size):+ if cancelled and cancelled():+ raise Cancelled('cancelled')+ spans = self._speech_spans(audio[first:last], cancelled)+ if spans is None:+ spans = [(0., (last - first) / RATE)]+ for begin, end in spans:+ take = min(end - begin, LID_SECONDS - total)+ if take > 0:+ start = first + int(begin * RATE)+ pieces.append(audio[start:start + int(take * RATE)])+ total += take+ if total >= LID_SECONDS:+ break+ if total < LID_MIN_SECONDS:+ return None+ with self._lid_lock:+ folder = self._lid_ready()+ if folder is None:+ raise EarsError('no_engine')+ try:+ if self._lid is None:+ import sherpa_onnx+ whisper = sherpa_onnx.SpokenLanguageIdentificationWhisperConfig(+ encoder=str(folder / 'tiny-encoder.int8.onnx'),+ decoder=str(folder / 'tiny-decoder.int8.onnx'))+ self._lid = sherpa_onnx.SpokenLanguageIdentification(+ sherpa_onnx.SpokenLanguageIdentificationConfig(+ whisper=whisper, num_threads=min(2, self._threads), provider='cpu'))+ stream = self._lid.create_stream()+ stream.accept_waveform(RATE, np.concatenate(pieces).astype('float32', copy=False))+ return str(self._lid.compute(stream)).strip().lower()+ except Exception:+ self._lid = None+ _LOG.warning('Subtitle language identification failed', exc_info=True)+ raise EarsError('no_engine') from None++ def _spoken(self, audio, language, cancelled):+ """Model language for recognition; `auto` asks the identifier and refuses what it cannot read."""+ if language != 'auto':+ return self._pick(language)+ code = self._identify(audio, cancelled)+ if code is None:+ return sorted(self._directories)[0]+ if code not in self._directories:+ raise EarsError('language')+ return codedef _recognizer(self, language):with self._lock:@@ -421,7 +516,7 @@ class Engine:return resultdef transcribe(self, audio, language, progress, cancelled):- language = self._pick(language)+ language = self._spoken(audio, language, cancelled)words = self._listen(audio, language, lambda f: progress(f * .98), cancelled)limit = LINE_UNITS[language]lines, current = [], []@@ -459,6 +554,12 @@ def folders(root=None):def factory():"""The ears engine, or None while the models or the runtime are not installed."""+ try:+ from . import subtitle_pack+ # The speech runtime is downloaded on demand; put it on the path before the import.+ subtitle_pack.activate()+ except Exception:+ passtry:import sherpa_onnx # noqa: F401import numpy # noqa: F401diff --git a/pyproject.toml b/pyproject.tomlindex 74c62c1..0b0a3b9 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -32,4 +32,4 @@ include = ["freevideo_engine*"][tool.setuptools.package-data]"freevideo_engine.prompt_vlm" = ["model.json"]-freevideo_engine = ["stage_estimate_params.json", "build-version.txt", "build-identity.json", "release_notes.json", "dependencies.json", "model_files.json", "model_shares.json", "prepared_models.json", "macos_reference_catalog.json", "superseded_tables.json", "bootstrap_versions.json", "curl_windows.json", "git_linux.json", "uv_downloads.json", "torch_downloads.json", "test_prompts.json", "windows_bootstrap.ps1", "assets/*.png", "assets/*.ico", "launcher/*.qml", "launcher/licenses/*.txt", "licenses/*.txt", "licenses/runtime/*.txt"]+freevideo_engine = ["stage_estimate_params.json", "build-version.txt", "build-identity.json", "release_notes.json", "dependencies.json", "model_files.json", "model_shares.json", "prepared_models.json", "macos_reference_catalog.json", "superseded_tables.json", "bootstrap_versions.json", "curl_windows.json", "git_linux.json", "uv_downloads.json", "torch_downloads.json", "test_prompts.json", "windows_bootstrap.ps1", "assets/*.png", "assets/*.ico", "launcher/*.qml", "launcher/licenses/*.txt", "licenses/*.txt", "licenses/runtime/*.txt", "subtitle_pack.json"]diff --git a/web/editor.js b/web/editor.jsindex 41b4d27..f9bd12e 100644--- a/web/editor.js+++ b/web/editor.js@@ -537,6 +537,38 @@ export function openEditor({api, app, from = null, panel = {}, components: givenstate.settle(record => model.settle(record, ids, 'queued')); if (job) { await deliverChain(job); watchJob(id); }},async retry(id) { if (!store.generationAvailable) return; state.select({kind: 'clip', ids: [id]}); const clip = model.find(state.record, id); if (clip.job) { mostRecentJob = clip.job; await actions.resume(); } else await actions.generate({text: clip.text || panel.text || ''}); },+ // Subtitles from speech hear the saved project, so it is saved first; a project never saved has nothing in it to hear.+ speech: {+ async start() {+ await queue.flush();+ if (queue.dirty) return null;+ if (!state.record.id) return {state: 'failed', reason: 'no_sound'};+ for (let attempt = 0; ; attempt++) {+ try { return await store.startEars(state.record.id, state.record.revision); }+ catch (value) {+ if (value.status !== 409 || attempt >= 2) throw value;+ queue.enqueue(state.record); await queue.flush();+ if (queue.dirty) return null;+ }+ }+ },+ watch: (id, fn) => store.watchEars(id, fn),+ cancel: id => store.cancelEars(id),+ // Whether speech can be recognised here now, and how many bytes must be downloaded first.+ async ability() {+ const [ears, pack] = await Promise.all([store.ears(), store.earsPack().catch(() => null)]);+ return {available: ears?.transcribe === true, need: pack?.installable === true && pack.bytes > 0 ? pack.bytes : 0};+ },+ download: report => new Promise((resolve, reject) => {+ const step = value => {+ const install = value?.install;+ if (install?.state !== 'running') { resolve(install?.state === 'done'); return false; }+ report(install.total > 0 ? install.done / install.total : 0); return true;+ };+ store.installEars().then(value => { if (step(value)) store.watchEarsPack(step); }, reject);+ }),+ cancelDownload: () => store.cancelEarsPack(),+ },async export(options) {if (['running', 'queued'].includes(exportStatus?.state)) return;if (exportStatus?.state === 'done' && exportMatches()) { await viewExport(exportStatus); return; }@@ -609,6 +641,7 @@ export function openEditor({api, app, from = null, panel = {}, components: givenconst transportControls = createEditorTransport({element, preview, transport, toolbar, editTools, zoomHost, state, player, t, notify});toolbar.append(adjust.toggleButton);const textTools = createEditorText({element, state, t, actions, adjust, player, toolbar, exportBox, tracksHost});+ actions.speech.ability().then(value => { if (!disposed) textTools.speech(value); }).catch(() => {});const audio = createAudioIntegration({state, player, t, error, adjust, library: libraryHost, store});registerEditorShortcuts(AUDIO_SHORTCUTS, speedShortcuts);adjust.register('speed', createSpeedComponent({state, t, onError: error}));diff --git a/web/editor_store.js b/web/editor_store.jsindex f41fde4..dcf1040 100644--- a/web/editor_store.js+++ b/web/editor_store.js@@ -480,6 +480,16 @@ export function createEditorStore(api, {t = en => en, notify = () => {}, onGener},watchExport(id, fn) { return watch(async () => (await json('/freevideo/editor/export?' + new URLSearchParams({id})))?.export || null, fn); },cancelExport: id => json('/freevideo/editor/export/cancel', post({id})),+ // Subtitles from speech. What this computer can recognise; null where it cannot or the server is older.+ async ears() { return (await json('/freevideo/editor/ears'))?.available || null; },+ async startEars(id, revision) { return (await json('/freevideo/editor/ears', post({kind: 'transcribe', id, revision})))?.job || null; },+ watchEars(id, fn) { return watch(async () => (await json('/freevideo/editor/ears?' + new URLSearchParams({id})))?.job || null, fn); },+ cancelEars: id => json('/freevideo/editor/ears/cancel', post({id})),+ // What recognising speech needs is downloaded on first use; null where the server has no such download.+ earsPack: () => json('/freevideo/editor/subtitle-pack'),+ installEars: () => json('/freevideo/editor/subtitle-pack', post({action: 'install', language: true})),+ cancelEarsPack: () => json('/freevideo/editor/subtitle-pack', post({action: 'cancel'})),+ watchEarsPack(fn) { return watch(() => json('/freevideo/editor/subtitle-pack'), fn); },dispose() { disposed = true; session.dispose(); for (const poller of pollers) poller.dispose(); pollers.clear(); watchers.clear();for (const upload of [...uploads]) { upload.release(); upload.xhr.abort(); upload.reject(new Error('editor_closed')); } },};diff --git a/web/editor_text.js b/web/editor_text.jsindex 825216f..2da5d69 100644--- a/web/editor_text.js+++ b/web/editor_text.js@@ -3,7 +3,7 @@import * as model from './editor_model.js';import {FONT_KEYS} from './fonts.js';import {row, button, slider, number, segmented, toggle} from './editor_adjust.js';-import {isText, isTextTrack, addText, changeText, changeSubtitleStyle, styleOf, activeText, setTextTrack, parseSRT, importSRT, defaults} from './editor_text_model.js';+import {isText, isTextTrack, addText, changeText, changeSubtitleStyle, styleOf, activeText, setTextTrack, parseSRT, importSRT, addSubtitles, defaults} from './editor_text_model.js';import {loadCoverage, loadTextFonts, textFontStack, missingGlyphs, missingHint, overTwoHint, textLayout, drawText} from './editor_text_layout.js';import {createSelectionActions, isTyping} from './editor_select.js';import {plan} from './editor_geometry.js';@@ -47,6 +47,46 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,if(preview){try{draft={record:change(state.record),change};render();updateWarnings();}catch(e){report(e);}return;}apply(t('Content','内容'),change);}+ // Subtitles from the speech on the timeline. One press starts, the next cancels; the lines replace the subtitle track in one step.+ // `need` is what has to be downloaded before the first use, in bytes; the same press downloads it and goes on.+ const speech={buttons:new Set(),available:false,need:0,busy:false,loading:false,shown:null,job:null,stop:null,run:0};+ function speechLabel(fraction){speech.shown=fraction;const p=Math.round(Math.min(1,Math.max(0,Number(fraction)||0))*100),size=Math.max(1,Math.round(speech.need/1e6)),text=fraction==null?(speech.need?t(`Auto subtitles · Download ${size} MB`,`自动字幕 · 下载 ${size} MB`):t('Auto subtitles','自动字幕')):speech.loading?t(`Cancel · Downloading ${p}%`,`取消 · 下载 ${p}%`):t(`Cancel · ${p}%`,`取消 · ${p}%`);for(const b of speech.buttons){b.textContent=text;b.hidden=!(speech.available||speech.need);}}+ function speechEnd(text){speech.stop?.();speech.stop=null;speech.job=null;speech.busy=false;speech.loading=false;speechLabel(null);if(text)actions.notify?.(text);}+ const speechFailed=()=>t('Could not create subtitles','没能生成字幕'),speechSilent=()=>t('No speech found','没有听到说话声');+ const speechReason=reason=>reason==='no_sound'?speechSilent():reason==='language'?t('English only for now','暂时只能识别英语'):speechFailed();+ function speechResult(job){+ if(job.state==='running'){speechLabel(job.fraction);return true;}+ if(job.state!=='done'){speechEnd(job.state==='cancelled'?null:speechReason(job.reason));return false;}+ const cues=(Array.isArray(job.result?.lines)?job.result.lines:[]).filter(l=>typeof l?.text==='string'&&l.text.trim()&&l.end>l.start).map(l=>({start:l.start,frames:l.end-l.start,text:l.text.trim()}));+ speechEnd();if(!cues.length){actions.notify?.(speechSilent());return false;}+ finishInline();commitDraft();+ if(!apply(t('Auto subtitles','自动字幕'),r=>addSubtitles(r,cues,{replace:true})))actions.notify?.(speechFailed());+ else{const missing=projectMissing(state.record);if(missing.length)actions.notify?.(missingHint([...new Set(missing.flatMap(r=>r.chars))],t));}+ return false;+ }+ async function toggleSpeech(){+ if(speech.busy){const id=speech.job,loading=speech.loading;speech.run++;speechEnd();if(loading)Promise.resolve(actions.speech.cancelDownload()).catch(()=>{});else if(id)Promise.resolve(actions.speech.cancel(id)).catch(()=>{});return;}+ const run=++speech.run;speech.busy=true;+ try{+ if(speech.need){+ speech.loading=true;speechLabel(0);+ const done=await actions.speech.download(fraction=>{if(run===speech.run)speechLabel(fraction);});+ if(run!==speech.run)return;+ const ability=done?await actions.speech.ability():null;+ if(run!==speech.run)return;+ if(ability){speech.available=ability.available;speech.need=ability.need;}+ if(!done||speech.need){speechEnd(t('Could not download','没能下载'));return;}+ if(!speech.available){speechEnd(speechFailed());return;}+ speech.loading=false;+ }+ speechLabel(0);+ const job=await actions.speech.start();+ if(run!==speech.run){if(job?.id)Promise.resolve(actions.speech.cancel(job.id)).catch(()=>{});return;}+ if(!job){speechEnd(speechFailed());return;}+ speech.job=job.id??null;+ if(speechResult(job))speech.stop=actions.speech.watch(job.id,value=>{if(run!==speech.run)return false;if(!value){speechEnd(speechFailed());return false;}return speechResult(value);});+ }catch{if(run===speech.run)speechEnd(speech.loading?t('Could not download','没能下载'):speechFailed());}+ }function commitDraft(){if(draft){const change=draft.change;apply(t('Text','文字'),change);const c=selectedText();if(c?.text_kind==='text')lastStyle={...styleOf(state.record,c)};}}// Editing a text ended. One left without words is taken away; one that never had any leaves no step behind.function endEditing(id){@@ -106,7 +146,10 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,const importButton=button(t('Import subtitle file','导入字幕文件'),{onClick:()=>file.click()});importButton.classList.add('fv-ed-import-srt');// Only a file that cannot be read says so; a refused edit (a locked track) flashes red like any other.file.onchange=async()=>{const f=file.files?.[0];if(!f)return;let text;try{if(f.size>4*1024*1024)throw new Error();text=await f.text();parseSRT(text);}catch{actions.notify?.(t('Could not read this subtitle file','读不出这个字幕文件'));return;}finally{file.value='';}- if(apply(t('Import subtitle file','导入字幕文件'),r=>importSRT(r,text))){const missing=projectMissing(state.record);if(missing.length)actions.notify?.(missingHint([...new Set(missing.flatMap(r=>r.chars))],t));}};host.append(importButton,file);+ if(apply(t('Import subtitle file','导入字幕文件'),r=>importSRT(r,text))){const missing=projectMissing(state.record);if(missing.length)actions.notify?.(missingHint([...new Set(missing.flatMap(r=>r.chars))],t));}};+ // Shown only where this computer can recognise speech.+ const hear=button(t('Auto subtitles','自动字幕'),{onClick:toggleSpeech});hear.classList.add('fv-ed-auto-subtitles');for(const b of speech.buttons)if(!b.isConnected)speech.buttons.delete(b);speech.buttons.add(hear);speechLabel(speech.busy?speech.shown:null);+ host.append(importButton,hear,file);}content.oninput=()=>{const c=selectedText();if(c)updateContent(c,content.value,true);};content.onchange=finishContent;content.onfocus=()=>{typing=selectedText()?.id??null;};@@ -283,9 +326,9 @@ export function createEditorText({element,state,t,actions,adjust,player,toolbar,const stop=isolateDialogKeys(dialog,(e)=>{if(e.type==='keydown'&&e.key==='Escape'){e.preventDefault();dialog.close();}else if(e.type==='keydown'&&e.key==='Enter'){e.preventDefault();dialog.close();}});dialog.onclose=()=>{stop();dialog.remove();jumpMissing();};dialog.showModal();close.focus();return false;}- return {get ready(){return ensureFonts();},beforeExport,flush(){finishInline();commitDraft();},keyboard(e){+ return {get ready(){return ensureFonts();},beforeExport,speech(value){speech.available=value?.available===true;speech.need=Number(value?.need)||0;if(!speech.busy)speechLabel(null);},flush(){finishInline();commitDraft();},keyboard(e){if(isTyping(e.target)||e.ctrlKey||e.metaKey||e.altKey||e.isComposing)return false;if(e.key.toLowerCase()==='t'){e.preventDefault();e.stopPropagation();add('text');return true;}if(e.key==='Escape'&&(drag||!menu.hidden)){e.preventDefault();if(drag)endDrag(e,true);menu.hidden=true;return true;}return false;- },dispose(){disposed=true;player.setTextRenderer?.(null);unsubscribe();resize?.disconnect();cancelAnimationFrame(raf);tracksHost.removeEventListener('contextmenu',contextMenu);element.removeEventListener('pointerdown',outside);frame.removeEventListener('seeked',seeked,true);frame.removeEventListener('loadeddata',seeked,true);canvas.remove();boundsLayer.remove();buttons.remove();notice.remove();menu.remove();}};+ },dispose(){disposed=true;if(speech.busy){const id=speech.job;speech.run++;speechEnd();if(id)Promise.resolve(actions.speech.cancel(id)).catch(()=>{});}speech.buttons.clear();player.setTextRenderer?.(null);unsubscribe();resize?.disconnect();cancelAnimationFrame(raf);tracksHost.removeEventListener('contextmenu',contextMenu);element.removeEventListener('pointerdown',outside);frame.removeEventListener('seeked',seeked,true);frame.removeEventListener('loadeddata',seeked,true);canvas.remove();boundsLayer.remove();buttons.remove();notice.remove();menu.remove();}};}