Files
ArtPlayer/index.html
糖猫猫andrionzhao 0896841d23 feat: batch video upscaling with folder upload, directory save, and result comparison (#1051)
* feat: support batch video upscaling with folder upload and directory save

- Add multi-file selection and entire folder upload (webkitdirectory)
- Support drag & drop of both files and folders via FileSystemEntry API
- Add save directory picker using File System Access API (showDirectoryPicker)
- Process videos sequentially with per-file progress and status tracking
- Add right-side result list with click-to-compare functionality
- Add per-video duration and total batch duration display
- Add retry button for failed items with error detail display
- Remove auto-play on comparison viewer load
- Fix worker error handling: handle "error" command to reject stale promises
- Fix event listener accumulation in video comparison (AbortController)
- Fix XSS risk by escaping HTML in all innerHTML injections
- Fix URL revocation timing in download to prevent large file truncation
- Extract writeToSaveDirectory and truncateName helpers to reduce duplication
- Add Usage Guide panel explaining single/multiple/folder upload options

Files changed:
  docs/upscaler/index.html  (+1110/-181)
  docs/upscaler/upscaler.js (+110)

* fix: prevent auto-play and resource consumption during upscaling

- Set preload="metadata" on preview and comparison video elements
- Explicitly pause preview video after setting src in showVideoPreview
- Remove preview video seek sync from batch processing progress callbacks
  (was causing continuous decode during upscaling, wasting GPU resources)
- Remove preview video seek sync from retry progress callback
- All videos now require manual play; no background resource usage

* fix: improve upscaled video quality with higher bitrate and codec support

- Raise base bitrate from 2.5 Mbps (25e5) to 8 Mbps (8e6) for standard and
  firefox processors, preventing quality loss when source videos have high
  bitrates (e.g. 720p @ 16.7 Mbps was producing 1440p @ 10 Mbps, smaller
  than the original file)
- Double the bitrate for mediabunny processor (X.n1 * 2) to account for the
  4x pixel increase from 2x upscaling
- Add H.264 Level 5.1 (avc1.640033) and Level 5.2 (avc1.640034) codecs to
  the fallback lists, since Level 4.0 (avc1.640028, ~24.6 Mbps) cannot
  support the higher bitrates for 1440p+ outputs
- Add latencyMode: "quality" to VideoEncoder configs for both standard and
  firefox processors, prioritizing encoding quality over latency (suitable
  for offline processing)

* feat: add video data comparison panel for original vs upscaled metrics

- Add a comparison data table below the file info bar showing 6 metrics:
  Resolution, File Size, Duration, Est. Bitrate, Pixels, Process Time
- Display per-metric change percentage with color-coded indicators:
  green (↑) for improvements, red (↓) for regressions, gray for neutral
- Estimated bitrate calculated from file size × 8 / video duration
- Table renders after both original and upscaled video metadata loads
- Auto-hide panel on reset

* fix: make video data comparison panel full-width and responsive

- Move comparison data table from inside the left column to the full-width
  area below the left/right layout, so it is no longer constrained by the
  comparison viewer column width
- Remove table-fixed colgroup and overflow-x-auto that caused horizontal
  scrolling on smaller screens
- Table now uses w-full auto-layout, displaying all 4 columns (Metric,
  Original, Upscaled, Change) without requiring horizontal scrolling

---------

Co-authored-by: rionzhao <rionzhao@tencent.com>
2026-09-10 17:19:38 +08:00

277 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>ArtPlayer.js - Modern HTML5 Video Player</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="google-adsense-account" content="ca-pub-8579453810848662">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<meta name="keywords" content="artplayer, artplayer.js, html5 video player, javascript video player, hls, dash, flv, webtorrent" />
<meta name="description" content="ArtPlayer.js is a modern, full featured, open-source HTML5 video player for the web with plugin ecosystem, HLS/DASH support, danmaku and more." />
<link rel="canonical" href="https://artplayer.org/" />
<!-- Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:title" content="ArtPlayer.js - Modern HTML5 Video Player" />
<meta property="og:description" content="ArtPlayer.js is a modern, full featured, open-source HTML5 video player for the web with plugin ecosystem, HLS/DASH support, danmaku and more." />
<meta property="og:url" content="https://artplayer.org/" />
<meta property="og:site_name" content="ArtPlayer.js" />
<meta property="og:image" content="https://artplayer.org/assets/img/screenshot.png" />
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="ArtPlayer.js - Modern HTML5 Video Player" />
<meta name="twitter:description" content="ArtPlayer.js is a modern, full featured, open-source HTML5 video player for the web with plugin ecosystem, HLS/DASH support, danmaku and more." />
<meta name="twitter:image" content="https://artplayer.org/assets/img/screenshot.png" />
<!-- Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "ArtPlayer.js",
"applicationCategory": "Multimedia",
"operatingSystem": "Web",
"url": "https://artplayer.org/",
"image": "https://artplayer.org/assets/img/screenshot.png",
"description": "ArtPlayer.js is a modern, full featured, open-source HTML5 video player for the web with plugin ecosystem, HLS/DASH support, danmaku and more.",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
}
}
</script>
<link rel="shortcut icon" href="./assets/img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./assets/css/normalize.css" />
<link rel="stylesheet" href="./assets/css/style.css" />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8579453810848662"
crossorigin="anonymous"></script>
</head>
<body>
<header class="header">
<a href="./" class="logo">
<img src="./assets/img/logo.png" height="20" alt="ArtPlayer.js logo">
Artplayer.js
</a>
<div class="menus">
<div class="item has-sub-menu">
Ecosystem
<div class="sub-menu">
<ul>
<li class="title">Libraries</li>
<li style="display: inline-block;margin-right: 10px;">
<a
href="/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.5.17/hls.min.js&example=hls">hls.js</a>
</li>
<li style="display: inline-block;margin-right: 10px;">
<a
href="/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/5.2.1/modern/umd/dash.all.min.js&example=dash">dash.js</a>
</li>
<li style="display: inline-block;margin-right: 10px;">
<a
href="/?libs=https://cdnjs.cloudflare.com/ajax/libs/flv.js/1.6.2/flv.min.js&example=flv">flv.js</a>
</li>
<li style="display: inline-block;margin-right: 10px;">
<a
href="/?libs=https://cdn.jsdelivr.net/npm/mpegts.js@1.7.3/dist/mpegts.min.js&example=mpegts">mpegts.js</a>
</li>
<li style="display: inline-block;margin-right: 10px;">
<a
href="/?libs=https://cdn.jsdelivr.net/npm/webtorrent@1/webtorrent.min.js&example=webtorrent">webtorrent.js</a>
</li>
</ul>
<ul>
<li class="title">Plugins</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-danmuku/index.js&example=danmuku">artplayer-plugin-danmuku</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-danmuku/index.js%0A./uncompiled/artplayer-plugin-danmuku-mask/index.js&example=danmuku.mask">artplayer-plugin-danmuku-mask</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-ads/index.js&example=ads">artplayer-plugin-ads</a>
</li>
<li>
<a
href="/?libs=https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.5.17/hls.min.js%0A./uncompiled/artplayer-plugin-hls-control/index.js&example=hls.control">artplayer-plugin-hls-control</a>
</li>
<li>
<a
href="/?libs=https://cdnjs.cloudflare.com/ajax/libs/dashjs/5.2.1/modern/umd/dash.all.min.js%0A./uncompiled/artplayer-plugin-dash-control/index.js&example=dash.control">artplayer-plugin-dash-control</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-vtt-thumbnail/index.js&example=vtt.thumbnail">artplayer-plugin-vtt-thumbnail</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles">artplayer-plugin-multiple-subtitles</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-chromecast/index.js&example=chromecast">artplayer-plugin-chromecast</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-vast/index.js&example=vast">artplayer-plugin-vast</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-chapter/index.js&example=chapter">artplayer-plugin-chapter</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-auto-thumbnail/index.js&example=auto.thumbnail">artplayer-plugin-auto-thumbnail</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-ambilight/index.js&example=ambilight">artplayer-plugin-ambilight</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-asr/index.js&example=asr">artplayer-plugin-asr</a>
</li>
<li>
<a href="/?libs=./uncompiled/artplayer-plugin-document-pip/index.js&example=document.pip">artplayer-plugin-document-pip</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-jassub/index.js&example=jassub">artplayer-plugin-jassub</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-plugin-audio-track/index.js&example=audio.track">artplayer-plugin-audio-track</a>
</li>
</ul>
<ul>
<li class="title">Proxys</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-proxy-canvas/index.js&example=canvas">artplayer-proxy-canvas</a>
</li>
<li>
<a href="/?libs=./uncompiled/artplayer-proxy-mediabunny/index.js&example=mediabunny">artplayer-proxy-mediabunny</a>
</li>
</ul>
<ul>
<li class="title">Tools</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-tool-thumbnail/index.js&example=tool.thumbnail">artplayer-tool-thumbnail</a>
</li>
<li>
<a
href="/?libs=./uncompiled/artplayer-tool-iframe/index.js&example=iframe">artplayer-tool-iframe</a>
</li>
</ul>
</div>
</div>
<a class="item" href="./document/">Document</a>
<a class="item" href="https://github.com/zhw2590582/ArtPlayer">Github</a>
<a class="item" href="./upscaler/">✨ Upscaler</a>
<a class="item" href="./llms.txt">🤖 LLMs</a>
<span class="item" href="#">Q群: 320881312</span>
</div>
<div class="tool">
<div class="checkbox">
<input type="checkbox" id="ts">
<label for="ts">TS</label>
</div>
<div class="checkbox">
<input type="checkbox" id="prod">
<label for="prod">Prod</label>
</div>
<div class="checkbox">
<input type="checkbox" id="code">
<label for="code">
<del>Code</del>
</label>
</div>
<div class="checkbox">
<input type="checkbox" id="log">
<label for="log">
<del>Log</del>
</label>
</div>
<div class="run">▶ Run Code</div>
</div>
</header>
<main class="main">
<div id="editor" class="part-left">
<div class="libs">
<div class="upload">
Upload Files
<input type="file" id="file" multiple />
</div>
<textarea class="libsInput"
placeholder="Other dependencies, support for js and css, multiple line breaks"
spellcheck="false"></textarea>
</div>
<div class="code">
<div class="codeMirrorWrap"></div>
</div>
</div>
<div class="part-right">
<div class="video-wrap">
<div class="artplayer-app"></div>
</div>
<div class="console"></div>
</div>
</main>
<div class="popups">
<div class="popinner"></div>
</div>
<script src="./assets/js/console.js"></script>
<script src="./assets/js/vs/loader.js"></script>
<script>
var artplayer = document.createElement('script');
var common = document.createElement('script');
artplayer.onload = function () {
common.src = "./assets/js/common.js";
document.body.appendChild(common);
}
if (localStorage.getItem('prod') === 'true') {
artplayer.src = "./compiled/artplayer.js"
} else {
artplayer.src = "./uncompiled/artplayer/index.js"
}
document.body.appendChild(artplayer);
</script>
<script>
var isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
window.location.hostname === '[::1]' ||
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
</script>
<script>
if (!isLocalhost) {
var _hmt = _hmt || [];
var hm = document.createElement('script');
hm.src = "https://hm.baidu.com/hm.js?879b2890d8d025c751785170763ca82b";
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
}
</script>
<script>
if (!isLocalhost && 'serviceWorker' in navigator) {
window.addEventListener('load', function () {
// navigator.serviceWorker.register(`./sw.js?t=${Artplayer.build}`);
});
}
</script>
</body>
</html>