Files
ArtPlayer/assets/css/style.css
T
糖猫猫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

314 lines
5.4 KiB
CSS

body,
html {
height: 100%;
}
body {
font-family: Hiragino Sans GB, Microsoft YaHei, \5fae\8f6f\96c5\9ed1, tahoma, arial, simsun, \5b8b\4f53;
-webkit-text-size-adjust: 100% !important;
-moz-text-size-adjust: 100% !important;
-ms-text-size-adjust: 100% !important;
text-size-adjust: 100% !important;
font-size: 14px;
margin: 0;
padding: 0;
color: #ccc;
background: rgb(16, 17, 19);
display: flex;
flex-direction: column;
overflow: hidden;
}
*,
:after,
:before {
box-sizing: border-box;
}
a {
color: #ccc;
text-decoration: none;
}
a:hover {
color: #fff;
}
img {
max-width: 100%;
vertical-align: top;
}
input[type="file"] {
cursor: pointer;
}
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-thumb {
background-color: #666;
}
::-webkit-scrollbar-thumb:hover {
background-color: #ccc;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 14px;
height: 48px;
width: 100%;
flex-shrink: 0;
padding: 0 0 0 20px;
border-bottom: 1px solid rgb(17, 21, 24);
background-color: rgb(28, 32, 34);
}
.header .logo {
display: flex;
justify-content: space-between;
align-items: center;
margin-right: 30px;
}
.header .logo img {
margin-right: 10px;
}
.header .tool {
display: flex;
align-items: center;
justify-content: space-between;
height: 100%;
line-height: 1;
gap: 20px;
}
.header .checkbox {
display: flex;
align-items: center;
}
.header .checkbox input {
margin-right: 5px;
}
.header .menus {
display: flex;
align-items: center;
flex: 1;
height: 100%;
gap: 30px;
}
.header .menus .item {
display: flex;
align-items: center;
height: 100%;
line-height: 1;
}
.header .menus .has-sub-menu {
position: relative;
}
.header .menus .has-sub-menu:hover .sub-menu {
display: block;
}
.header .menus .has-sub-menu .sub-menu {
display: none;
position: absolute;
z-index: 9999;
top: 40px;
left: 0;
width: 280px;
padding: 0 10px;
background: #1b1b1b;
border-radius: 3px;
border: 1px solid rgb(255, 255, 255, 0.05);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
.header .menus .has-sub-menu .sub-menu ul {
padding: 0;
margin-bottom: 20px;
}
.header .menus .has-sub-menu .sub-menu li {
display: block;
list-style: none;
margin-bottom: 10px;
}
.header .menus .has-sub-menu .sub-menu li.title {
color: #fff;
font-size: 16px;
margin-bottom: 15px;
font-weight: bold;
}
.header .menus .has-sub-menu .sub-menu li a:hover {
text-decoration: underline;
}
.header .run {
display: flex;
justify-content: center;
align-items: center;
padding: 0 15px;
height: 100%;
line-height: 1;
cursor: pointer;
color: #f1fa8c;
border-left: 1px solid rgb(17, 21, 24);
background-color: rgb(39, 41, 54);
}
.header .run:hover {
background-color: #2e3350;
}
.main {
display: flex;
flex: 1;
height: 100%;
overflow: hidden;
}
.main .part-left {
display: flex;
flex-direction: column;
width: 50%;
border-right: 1px solid rgb(17, 21, 24);
}
.main .part-left .libs {
display: flex;
height: 50px;
border-bottom: 1px solid rgb(17, 21, 24);
}
.main .part-left .upload {
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 0 15px;
height: 100%;
font-size: 13px;
color: #f1fa8c;
border-right: 1px solid rgb(17, 21, 24);
background-color: rgb(39, 41, 54);
}
.main .part-left #file {
opacity: 0;
position: absolute;
inset: 0;
width: 100%;
height: 100%;
}
.main .part-left .libsInput {
height: 100%;
flex: 1;
padding: 10px;
outline: none;
resize: none;
border: none;
font-size: 13px;
color: #ccc;
background-color: rgb(28, 32, 34);
}
.main .part-left .code {
flex: 1;
}
.main .part-left .code .codeMirrorWrap {
height: 100%;
}
.main .part-right {
flex: 1;
display: flex;
flex-direction: column;
}
.part-right .video-wrap {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
flex-direction: column;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.part-right .video-wrap .artplayer-app {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 20px;
width: 90%;
height: 65%;
margin-bottom: 10px;
background-color: rgb(0 0 0 / 20%);
border: 1px dashed rgba(255, 255, 255, 0.1);
}
.part-right .video-wrap .artplayer-danmuku {
width: 300px;
}
.part-right .console {
position: relative;
z-index: 8;
height: 30%;
}
.popups {
display: none;
justify-content: center;
align-items: center;
position: fixed;
z-index: 999;
left: 0;
top: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
}
.popups .popinner {
display: flex;
justify-content: center;
align-items: center;
width: 800px;
height: 600px;
background: #2b2b2b;
border-radius: 3px;
padding: 20px;
background-repeat: no-repeat;
background-position: center center;
background-size: contain;
}
.fullscreenWeb {
position: fixed;
z-index: 9999;
width: 100%;
height: 100%;
left: 0;
top: 0;
right: 0;
bottom: 0;
}