Compare commits

...

15 commits
1.10.1 ... main

Author SHA1 Message Date
f590f77bca
bump version to 1.11.2
All checks were successful
Upload release / build (push) Successful in 1m45s
2024-10-16 01:08:36 +02:00
ecb03ded2a
add extra room 2024-10-16 01:08:17 +02:00
21b39e80bf
update dependencies 2024-10-16 01:01:59 +02:00
55b94d0021
bump version to 1.11.1
All checks were successful
Upload release / build (push) Successful in 1m54s
2024-10-01 16:55:12 +02:00
4f34191d2f
don't crash when trying to compress an enormous file 2024-10-01 16:55:06 +02:00
7c4bd84486
bump version to 1.11.0
All checks were successful
Upload release / build (push) Successful in 1m46s
2024-09-19 01:32:06 +02:00
e34712976b
magic value into const 2024-09-19 01:32:00 +02:00
dc190ab807
fix audio metadata 2024-09-19 01:29:17 +02:00
21050bb0b7
rework readme flag part and change some flags name 2024-09-19 01:19:00 +02:00
482caad25f
Add NVENC2 2024-09-19 01:12:04 +02:00
5841006f15
add H265 (slow asf) 2024-09-19 01:04:32 +02:00
ee64d06e0a
fix audio track issue 2024-09-19 00:52:24 +02:00
2ef8bda147
Revert "fix packager"
This reverts commit c8538f5d03.
2024-09-18 23:45:32 +02:00
b6d6b84839
bump version to 1.10.2
All checks were successful
Upload release / build (push) Successful in 1m22s
2024-09-18 19:02:46 +02:00
f2b04f0cea
Revert "no need that much room now that we have exact audio bitrate"
we need

This reverts commit b391e05ed3.
2024-09-18 19:02:16 +02:00
6 changed files with 277 additions and 375 deletions

View file

@ -15,18 +15,30 @@ Tool for sharing video to Discord.
irm https://git.mylloon.fr/Anri/dsr/raw/branch/main/install.ps1 | iex
```
> - If you have Discord Nitro: add `/nitro` flag when running DSR.
> - If you have Discord Nitro Basic: add `/nitrobasic` flag when running DSR.
> - If you have an NVidia GPU with NVenc: add `/nvenc` flag when running DSR.
## Available flags
You can add thoses flags in the `Target` field of your Windows shortcut.
| | |
| ------------- | ----------------------------------------------------- |
| `/nitro` | Increase the file limit to 500Mo |
| `/nitrobasic` | Increase the file limit to 50Mo |
| | |
| `/nvenc_h264` | Enable NVenc with H.264 encoder (NVidia GPU required) |
| `/nvenc_h265` | Enable NVenc with H.265 encoder (NVidia GPU required) |
| `/h265` | Enable the H.265 CPU encoder (slow compression) |
> NVenc support is experimental, but faster than CPU counterparts.
## More info
- [x] KISS interface
- [x] Support drag&drop into the icon
- [x] Keep the video under discord limitation
- [x] Defaults to H.264 CPU encoder
- [x] If already under the limit, the file won't be compressed
- [x] Basic NVenc support
- [x] Nitro suppport via flags
- [x] NVenc support
- [x] Nitro suppport
- [x] Merge 2 audio files into one track when recorded with system audio and microphone
split up, while keeping the original ones (with conveniant metadata)
- [x] Works also with file with only one or more than 2 audio track, by doing

497
package-lock.json generated
View file

@ -1,23 +1,23 @@
{
"name": "dsr",
"version": "1.10.1",
"version": "1.11.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "dsr",
"version": "1.10.1",
"version": "1.11.2",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@electron-forge/maker-zip": "^7.4",
"@electron-forge/maker-zip": "^7.5",
"ffmpeg-static": "^5.2",
"ffprobe-static": "^3.1",
"typescript": "^5.6"
},
"devDependencies": {
"@electron-forge/cli": "^7.4",
"@electron-forge/cli": "^7.5",
"@types/ffprobe-static": "^2.0",
"electron": "^32.1"
"electron": "^33.0"
}
},
"node_modules/@derhuerst/http-basic": {
@ -36,9 +36,9 @@
}
},
"node_modules/@electron-forge/cli": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/cli/-/cli-7.4.0.tgz",
"integrity": "sha512-a+zZv3ja/IxkJzNyx4sOHSZv6DPV85S0PEVF6pcRjUpbDL5r+DxjRFsNc0Nq4UIWyFm1nw7RWoPdd9uDst4Tvg==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/cli/-/cli-7.5.0.tgz",
"integrity": "sha512-dlxr4ac5ONWs1Wmbgh18rclxcp9Fe5SzCF9ookp08Z1w4YP9FbQd1SHs0oLKWLF6qH9qdX8H2EWB9Nt6tOzC5g==",
"dev": true,
"funding": [
{
@ -52,8 +52,8 @@
],
"license": "MIT",
"dependencies": {
"@electron-forge/core": "7.4.0",
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/core": "7.5.0",
"@electron-forge/shared-types": "7.5.0",
"@electron/get": "^3.0.0",
"chalk": "^4.0.0",
"commander": "^4.1.1",
@ -72,9 +72,9 @@
}
},
"node_modules/@electron-forge/core": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/core/-/core-7.4.0.tgz",
"integrity": "sha512-pYHKpB2CKeQgWsb+gox+FPkEvP+6Q2zGj2eZtgZRtKppoWIXrHIpOtcm6FllJ/gZ5u4AsQzVIYReAHGaBa0osw==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/core/-/core-7.5.0.tgz",
"integrity": "sha512-Hg/fXabRZtMbyrtnpzpb3i49qNai+juCg+6bgyjYfWgJGr5VGH947lWd7skujH5qJ+Y7FgvANDGnenZuQwxZNw==",
"dev": true,
"funding": [
{
@ -88,19 +88,19 @@
],
"license": "MIT",
"dependencies": {
"@electron-forge/core-utils": "7.4.0",
"@electron-forge/maker-base": "7.4.0",
"@electron-forge/plugin-base": "7.4.0",
"@electron-forge/publisher-base": "7.4.0",
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/template-base": "7.4.0",
"@electron-forge/template-vite": "7.4.0",
"@electron-forge/template-vite-typescript": "7.4.0",
"@electron-forge/template-webpack": "7.4.0",
"@electron-forge/template-webpack-typescript": "7.4.0",
"@electron-forge/tracer": "7.4.0",
"@electron-forge/core-utils": "7.5.0",
"@electron-forge/maker-base": "7.5.0",
"@electron-forge/plugin-base": "7.5.0",
"@electron-forge/publisher-base": "7.5.0",
"@electron-forge/shared-types": "7.5.0",
"@electron-forge/template-base": "7.5.0",
"@electron-forge/template-vite": "7.5.0",
"@electron-forge/template-vite-typescript": "7.5.0",
"@electron-forge/template-webpack": "7.5.0",
"@electron-forge/template-webpack-typescript": "7.5.0",
"@electron-forge/tracer": "7.5.0",
"@electron/get": "^3.0.0",
"@electron/packager": "^18.3.1",
"@electron/packager": "^18.3.5",
"@electron/rebuild": "^3.2.10",
"@malept/cross-spawn-promise": "^2.0.0",
"chalk": "^4.0.0",
@ -129,13 +129,13 @@
}
},
"node_modules/@electron-forge/core-utils": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/core-utils/-/core-utils-7.4.0.tgz",
"integrity": "sha512-9RLG0F9SX466TpkaTcW+V15KmnGuTpmr7NKMRlngtHXmnkBUJz4Mxp1x33WZLgL90dJrxrRgHSfVBtA4lstDPw==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/core-utils/-/core-utils-7.5.0.tgz",
"integrity": "sha512-PtyQT6qeOEJsi4ltoB7Jb6YUUCwK3gDt5gVyAF2aJ8eZi9rJ0hasHc5vjcmBaz9FwDMjYZrBD8oRBhNgbhEakQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/shared-types": "7.5.0",
"@electron/rebuild": "^3.2.10",
"@malept/cross-spawn-promise": "^2.0.0",
"chalk": "^4.0.0",
@ -151,12 +151,12 @@
}
},
"node_modules/@electron-forge/maker-base": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/maker-base/-/maker-base-7.4.0.tgz",
"integrity": "sha512-LwWS4VPdwjISl1KpLhmM1Qr1M3sRTTQ/RsX+GlFd7cQ1W/FsgxMjaTG4Od1d+a5CGVTh3s6X2g99TSUfxjOveg==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/maker-base/-/maker-base-7.5.0.tgz",
"integrity": "sha512-+jluKW2UPxaI1+qQQ8fqaUVVbZohRjOSF0Iti7STRFbgJKJitzPB24Cjji9qJCKIx5klMeEiwp0YPAE/d9Xt8g==",
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/shared-types": "7.5.0",
"fs-extra": "^10.0.0",
"which": "^2.0.2"
},
@ -165,13 +165,13 @@
}
},
"node_modules/@electron-forge/maker-zip": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/maker-zip/-/maker-zip-7.4.0.tgz",
"integrity": "sha512-UGbMdpuK/P29x1FFRWNOs3bNz+7QNFWVWyTM5hcWqib66cNuUmoaPifQyuwW2POIrIohrxlzLK87/i9Zc8g4dA==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/maker-zip/-/maker-zip-7.5.0.tgz",
"integrity": "sha512-gIO3bEbubOJqWV6kd0b9nBwTrFfFQv/K8PAqg6e0uSZiy7QuSCFZVAZse02gO3AzxVDSVjjTQ4nmXBXC4Glh1A==",
"license": "MIT",
"dependencies": {
"@electron-forge/maker-base": "7.4.0",
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/maker-base": "7.5.0",
"@electron-forge/shared-types": "7.5.0",
"cross-zip": "^4.0.0",
"fs-extra": "^10.0.0",
"got": "^11.8.5"
@ -181,39 +181,39 @@
}
},
"node_modules/@electron-forge/plugin-base": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/plugin-base/-/plugin-base-7.4.0.tgz",
"integrity": "sha512-LcTNtEc2YaWvhhqWVIfdJ+J0/krSgc2dqYAHhOH2aLUSm9End3dKO/PZ1Y6DPsiPiJKHnSLBJ/XBN/16NY4Sjw==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/plugin-base/-/plugin-base-7.5.0.tgz",
"integrity": "sha512-44AbXSb5lDY8uHIo0mJ91atOSWgxv3iuECk07/gDBiuMPX62dwHnLteEjQF4GBXJZTpnV7SxhD+d2AUBQmoojw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0"
"@electron-forge/shared-types": "7.5.0"
},
"engines": {
"node": ">= 16.4.0"
}
},
"node_modules/@electron-forge/publisher-base": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/publisher-base/-/publisher-base-7.4.0.tgz",
"integrity": "sha512-PiJk4RfaC55SnVnteLW2ZIQNM9DpGOi6YoUn5t8i9UcVp2rFIdya7bJY/b9u1hwubm4d5+TdypMVEuJjM44CJQ==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/publisher-base/-/publisher-base-7.5.0.tgz",
"integrity": "sha512-PcF3jWA+oXRwNVWjKW6GxHJywJ62QXpYF/8SMs7kgKzBDzLqrbUnWuaXoCP5kCP+AxM495ZU5L2dyJek1eM+VA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0"
"@electron-forge/shared-types": "7.5.0"
},
"engines": {
"node": ">= 16.4.0"
}
},
"node_modules/@electron-forge/shared-types": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/shared-types/-/shared-types-7.4.0.tgz",
"integrity": "sha512-5Ehy6enUjBaU08odf9u9TOhmOVXlqobzMvKUixtkdAWgV1XZAUJmn+p21xhj0IkO92MQiXMGv66w9pDNjRT8uQ==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/shared-types/-/shared-types-7.5.0.tgz",
"integrity": "sha512-VXuLVGYa3ZulBlmjA40ZEpk+iPH5ebN0v7t27wDt3rm23bph2aQrL7uSTLXhobenXYBVKggXnQt6rJ9A7FCDNQ==",
"license": "MIT",
"dependencies": {
"@electron-forge/tracer": "7.4.0",
"@electron/packager": "^18.3.1",
"@electron-forge/tracer": "7.5.0",
"@electron/packager": "^18.3.5",
"@electron/rebuild": "^3.2.10",
"listr2": "^7.0.2"
},
@ -222,13 +222,13 @@
}
},
"node_modules/@electron-forge/template-base": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-base/-/template-base-7.4.0.tgz",
"integrity": "sha512-3YWdRSGzQfQPQkQxStn2wkJ/SuNGGKo9slwFJGvqMV+Pbx3/M/hYi9sMXOuaqVZgeaBp8Ap27yFPxaIIOC3vcA==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-base/-/template-base-7.5.0.tgz",
"integrity": "sha512-wEz4FI90jje4FdwJ4FzqUejodfioNcJjlgG2Ci1FiRn4Qv0jX4MP8SEgKmnD44181/44HgMa429zxRv/fDYzOw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/shared-types": "7.5.0",
"@malept/cross-spawn-promise": "^2.0.0",
"debug": "^4.3.1",
"fs-extra": "^10.0.0",
@ -239,14 +239,14 @@
}
},
"node_modules/@electron-forge/template-vite": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-vite/-/template-vite-7.4.0.tgz",
"integrity": "sha512-YPVyCGiBKmZPCxK/Bd2louV3PBcxI2nT2+tRKP+mlEHOWrxbZIfmZSR2lIAFvK/ALKlwUKROdmlwyi7ZcdT7JQ==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-vite/-/template-vite-7.5.0.tgz",
"integrity": "sha512-AkMO5nW5jC8ijCYeoAK7hu+K5o7NMoHNsn71eepJ/kjOnSxXjJeBVGmP4DgzF2zc6AgeRz2TCKx6P8GUtFG5cw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/template-base": "7.4.0",
"@electron-forge/shared-types": "7.5.0",
"@electron-forge/template-base": "7.5.0",
"fs-extra": "^10.0.0"
},
"engines": {
@ -254,14 +254,14 @@
}
},
"node_modules/@electron-forge/template-vite-typescript": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-vite-typescript/-/template-vite-typescript-7.4.0.tgz",
"integrity": "sha512-wdByG807VWcUd81E6572b/G/Ki8gb+GrCIWxO7Cl3qBa+yNaU1sHhBwB1RyTbQy1r8ubSBtsWrRD1J/yzHKWoQ==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-vite-typescript/-/template-vite-typescript-7.5.0.tgz",
"integrity": "sha512-bD9QQ6uEsDHp6/V7odCkoK53egy0A4LEh++F1VYFt7SWJ5+InkcSLww7ELz2hrNmpmXb+euRrNagL1gorPToSA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/template-base": "7.4.0",
"@electron-forge/shared-types": "7.5.0",
"@electron-forge/template-base": "7.5.0",
"fs-extra": "^10.0.0"
},
"engines": {
@ -269,14 +269,14 @@
}
},
"node_modules/@electron-forge/template-webpack": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-webpack/-/template-webpack-7.4.0.tgz",
"integrity": "sha512-W558AEGwQrwEtKIbIJPPs0LIsaC/1Vncj5NgqKehEMJjBb0KQq4hwBu/6dauQrfun4jRCOp7LV+OVrf5XPJ7QA==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-webpack/-/template-webpack-7.5.0.tgz",
"integrity": "sha512-Il9dO4VMhxibsYTsKRkccWUN3WFg55PEQFL93oarFcEtAT3sjMx/1bZDj/2AIHqbwIf7IrCylPKiPP2uUNOM9Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/template-base": "7.4.0",
"@electron-forge/shared-types": "7.5.0",
"@electron-forge/template-base": "7.5.0",
"fs-extra": "^10.0.0"
},
"engines": {
@ -284,14 +284,14 @@
}
},
"node_modules/@electron-forge/template-webpack-typescript": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-webpack-typescript/-/template-webpack-typescript-7.4.0.tgz",
"integrity": "sha512-O5gwjNSGFNRdJWyiCtevcOBDPAMhgOPvLORh9qR1GcjyTutWwHWmZzycqH+MmkhpQPgrAYDEeipXcOQhSbzNZA==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/template-webpack-typescript/-/template-webpack-typescript-7.5.0.tgz",
"integrity": "sha512-Q11xAzFxWtES0bwykMd8MAzrVRtmSruXQxQIvqM7Qf3VmU8joq8v5njmn13LeCDkcRGjALiJqO8EsgsW3bttNw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@electron-forge/shared-types": "7.4.0",
"@electron-forge/template-base": "7.4.0",
"@electron-forge/shared-types": "7.5.0",
"@electron-forge/template-base": "7.5.0",
"fs-extra": "^10.0.0"
},
"engines": {
@ -299,9 +299,9 @@
}
},
"node_modules/@electron-forge/tracer": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@electron-forge/tracer/-/tracer-7.4.0.tgz",
"integrity": "sha512-F4jbnDn4yIZjmky1FZ6rgBKTM05AZQQfHkyJW2hdS4pDKJjdKAqWytoZKDi1/S6Cr6tN+DD0TFGD3V0i6HPHYQ==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@electron-forge/tracer/-/tracer-7.5.0.tgz",
"integrity": "sha512-1dE0wKCmv/K3BXCH70o2jp/y2kXgZQm73gIvzyadySXYwu2L4BWxhAO+Q+JsnbUk+nclHEup5ph4D0JoPIWLcQ==",
"license": "MIT",
"dependencies": {
"chrome-trace-event": "^1.0.3"
@ -399,6 +399,71 @@
"node": ">= 4.0.0"
}
},
"node_modules/@electron/node-gyp": {
"version": "10.2.0-electron.1",
"resolved": "git+ssh://git@github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2",
"integrity": "sha512-lBSgDMQqt7QWMuIjS8zNAq5FI5o5RVBAcJUGWGI6GgoQITJt3msAkUrHp8YHj3RTVE+h70ndqMGqURjp3IfRyQ==",
"license": "MIT",
"dependencies": {
"env-paths": "^2.2.0",
"exponential-backoff": "^3.1.1",
"glob": "^8.1.0",
"graceful-fs": "^4.2.6",
"make-fetch-happen": "^10.2.1",
"nopt": "^6.0.0",
"proc-log": "^2.0.1",
"semver": "^7.3.5",
"tar": "^6.2.1",
"which": "^2.0.2"
},
"bin": {
"node-gyp": "bin/node-gyp.js"
},
"engines": {
"node": ">=12.13.0"
}
},
"node_modules/@electron/node-gyp/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/@electron/node-gyp/node_modules/glob": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz",
"integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
"deprecated": "Glob versions prior to v9 are no longer supported",
"license": "ISC",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/@electron/node-gyp/node_modules/minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@electron/notarize": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.5.0.tgz",
@ -500,11 +565,12 @@
}
},
"node_modules/@electron/rebuild": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/@electron/rebuild/-/rebuild-3.6.0.tgz",
"integrity": "sha512-zF4x3QupRU3uNGaP5X1wjpmcjfw1H87kyqZ00Tc3HvriV+4gmOGuvQjGNkrJuXdsApssdNyVwLsy+TaeTGGcVw==",
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/@electron/rebuild/-/rebuild-3.7.0.tgz",
"integrity": "sha512-VW++CNSlZwMYP7MyXEbrKjpzEwhB5kDNbzGtiPEjwYysqyTCF+YbNJ210Dj3AjWsGSV4iEEwNkmJN9yGZmVvmw==",
"license": "MIT",
"dependencies": {
"@electron/node-gyp": "git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2",
"@malept/cross-spawn-promise": "^2.0.0",
"chalk": "^4.0.0",
"debug": "^4.1.1",
@ -513,7 +579,6 @@
"got": "^11.7.0",
"node-abi": "^3.45.0",
"node-api-version": "^0.2.0",
"node-gyp": "^9.0.0",
"ora": "^5.1.0",
"read-binary-file-arch": "^1.0.6",
"semver": "^7.3.5",
@ -793,9 +858,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.5.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz",
"integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==",
"version": "22.7.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz",
"integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"
@ -914,26 +979,6 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/aproba": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
"integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==",
"license": "ISC"
},
"node_modules/are-we-there-yet": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz",
"integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==",
"deprecated": "This package is no longer supported.",
"license": "ISC",
"dependencies": {
"delegates": "^1.0.0",
"readable-stream": "^3.6.0"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
"node_modules/at-least-node": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
@ -1373,15 +1418,6 @@
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"license": "MIT"
},
"node_modules/color-support": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
"integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
"license": "ISC",
"bin": {
"color-support": "bin.js"
}
},
"node_modules/colorette": {
"version": "2.0.20",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
@ -1428,12 +1464,6 @@
"typedarray": "^0.0.6"
}
},
"node_modules/console-control-strings": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
"license": "ISC"
},
"node_modules/cross-dirname": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/cross-dirname/-/cross-dirname-0.1.0.tgz",
@ -1578,12 +1608,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/delegates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
"license": "MIT"
},
"node_modules/detect-libc": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz",
@ -1617,9 +1641,9 @@
"license": "MIT"
},
"node_modules/electron": {
"version": "32.1.0",
"resolved": "https://registry.npmjs.org/electron/-/electron-32.1.0.tgz",
"integrity": "sha512-4etE3K6vPUkHihf7nvawngbB5+jLuUJgZh31f9ki1Gfveo0qwNDkLv/doabw+4zFFWKUXI+uFUpyOpL5+RwS+Q==",
"version": "33.0.0",
"resolved": "https://registry.npmjs.org/electron/-/electron-33.0.0.tgz",
"integrity": "sha512-OdLLR/zAVuNfKahSSYokZmSi7uK2wEYTbCoiIdqWLsOWmCqO9j0JC2XkYQmXQcAk2BJY0ri4lxwAfc5pzPDYsA==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
@ -1658,9 +1682,9 @@
}
},
"node_modules/electron/node_modules/@types/node": {
"version": "20.16.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.5.tgz",
"integrity": "sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==",
"version": "20.16.11",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.11.tgz",
"integrity": "sha512-y+cTCACu92FyA5fgQSAI8A1H429g7aSK2HsO7K4XYUWc4dY5IUz55JSDIYT6/VsOLfGy8vmvQYC2hfb0iF16Uw==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -2145,76 +2169,6 @@
"node": ">= 12"
}
},
"node_modules/gauge": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz",
"integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==",
"deprecated": "This package is no longer supported.",
"license": "ISC",
"dependencies": {
"aproba": "^1.0.3 || ^2.0.0",
"color-support": "^1.1.3",
"console-control-strings": "^1.1.0",
"has-unicode": "^2.0.1",
"signal-exit": "^3.0.7",
"string-width": "^4.2.3",
"strip-ansi": "^6.0.1",
"wide-align": "^1.1.5"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
"node_modules/gauge/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/gauge/node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"license": "MIT"
},
"node_modules/gauge/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/gauge/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/gauge/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
@ -2505,12 +2459,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-unicode": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
"license": "ISC"
},
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
@ -3266,9 +3214,9 @@
"license": "MIT"
},
"node_modules/node-abi": {
"version": "3.67.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.67.0.tgz",
"integrity": "sha512-bLn/fU/ALVBE9wj+p4Y21ZJWYFjUXLXPi/IewyLZkx3ApxKDNBWCKdReeKOtD8dWpOdDCeMyLh6ZewzcLsG2Nw==",
"version": "3.70.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.70.0.tgz",
"integrity": "sha512-xMTIZdvAyzGyxwOwxXv/8V/f/KAqKWNCeNIIFu2doEtQp9wvMUTam036At/iVtJqum6n5ljbAhUmXAUOhyivSA==",
"license": "MIT",
"dependencies": {
"semver": "^7.3.5"
@ -3307,31 +3255,6 @@
}
}
},
"node_modules/node-gyp": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz",
"integrity": "sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==",
"license": "MIT",
"dependencies": {
"env-paths": "^2.2.0",
"exponential-backoff": "^3.1.1",
"glob": "^7.1.4",
"graceful-fs": "^4.2.6",
"make-fetch-happen": "^10.0.3",
"nopt": "^6.0.0",
"npmlog": "^6.0.0",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"tar": "^6.1.2",
"which": "^2.0.2"
},
"bin": {
"node-gyp": "bin/node-gyp.js"
},
"engines": {
"node": "^12.13 || ^14.13 || >=16"
}
},
"node_modules/nopt": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz",
@ -3403,22 +3326,6 @@
"node": ">=4"
}
},
"node_modules/npmlog": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz",
"integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==",
"deprecated": "This package is no longer supported.",
"license": "ISC",
"dependencies": {
"are-we-there-yet": "^3.0.0",
"console-control-strings": "^1.1.0",
"gauge": "^4.0.3",
"set-blocking": "^2.0.0"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
"node_modules/object-keys": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
@ -3851,6 +3758,15 @@
"node": "^12.20.0 || >=14"
}
},
"node_modules/proc-log": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-2.0.1.tgz",
"integrity": "sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw==",
"license": "ISC",
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
"node_modules/progress": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
@ -4065,9 +3981,9 @@
}
},
"node_modules/resedit": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/resedit/-/resedit-2.0.2.tgz",
"integrity": "sha512-UKTnq602iVe+W5SyRAQx/WdWMnlDiONfXBLFg/ur4QE4EQQ8eP7Jgm5mNXdK12kKawk1vvXPja2iXKqZiGDW6Q==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/resedit/-/resedit-2.0.3.tgz",
"integrity": "sha512-oTeemxwoMuxxTYxXUwjkrOPfngTQehlv0/HoYFNkB4uzsP1Un1A9nI8JQKGOFkxpqkC7qkMs0lUsGrvUlbLNUA==",
"license": "MIT",
"dependencies": {
"pe-library": "^1.0.1"
@ -4319,12 +4235,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"license": "ISC"
},
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@ -4699,9 +4609,9 @@
"license": "MIT"
},
"node_modules/typescript": {
"version": "5.6.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz",
"integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==",
"version": "5.6.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
"integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
@ -4822,65 +4732,6 @@
"node": ">= 8"
}
},
"node_modules/wide-align": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
"integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
"license": "ISC",
"dependencies": {
"string-width": "^1.0.2 || 2 || 3 || 4"
}
},
"node_modules/wide-align/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/wide-align/node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"license": "MIT"
},
"node_modules/wide-align/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/wide-align/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wide-align/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",

View file

@ -1,6 +1,6 @@
{
"name": "dsr",
"version": "1.10.1",
"version": "1.11.2",
"description": "Discord Video Sharing",
"main": "./dist/main.js",
"scripts": {
@ -18,21 +18,21 @@
"author": "Mylloon",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@electron-forge/maker-zip": "^7.4",
"@electron-forge/maker-zip": "^7.5",
"ffmpeg-static": "^5.2",
"ffprobe-static": "^3.1",
"typescript": "^5.6"
},
"devDependencies": {
"@electron-forge/cli": "^7.4",
"@electron-forge/cli": "^7.5",
"@types/ffprobe-static": "^2.0",
"electron": "^32.1"
"electron": "^33.0"
},
"config": {
"forge": {
"packagerConfig": {
"icon": "./image/icon.ico",
"asarOptions": {
"asar": {
"unpack": "**/node_modules/*-static/**"
}
},

View file

@ -22,6 +22,7 @@ const moviesFilter = {
extensions: ["mp4", "mkv"],
};
const metadataAudioSize = 3;
const metadataAudio = `-metadata:s:a:0 title="System sounds and microphone" \
-metadata:s:a:1 title="System sounds" \
-metadata:s:a:2 title="Microphone"`;
@ -89,7 +90,7 @@ app.whenReady().then(() => {
const tmpFile = getNewFilename(file, "TMP_");
let outFile;
const audioTracks = getNumberOfAudioTracks(file);
let audioTracks = getNumberOfAudioTracks(file);
switch (audioTracks.length) {
case 2:
@ -120,6 +121,8 @@ app.whenReady().then(() => {
// Delete the temporary video file
deleteFile(tmpFile);
audioTracks = getNumberOfAudioTracks(outFile);
break;
default:
// Other cases: no merge needed
@ -141,47 +144,59 @@ app.whenReady().then(() => {
};
};
/** Reduce size of a file */
/** Reduce size of a file
* Returns an empty string in case of failing
*/
const reduceSize = async (
file: string,
bitrate: number,
audioTracks: number[]
) => {
const audioBitrate = Math.ceil(
audioTracks.reduce((sum, current) => current + sum, 0)
audioTracks.reduce((sum, current) => current + sum, 50) // initial value > 0 for extra room
);
let videoBitrate = bitrate - audioBitrate;
const videoBitrate = bitrate - audioBitrate;
let finalFile;
const finalFile = getNewFilename(file, "Compressed - ");
if (videoBitrate > 0) {
finalFile = getNewFilename(file, "Compressed - ");
// Trash the output, depends on the platform
const nul = process.platform === "win32" ? "NUL" : "/dev/null";
// Trash the output, depends on the platform
const nul = process.platform === "win32" ? "NUL" : "/dev/null";
// Mapping of tracks for FFMPEG, adding 1 for the video stream
const mappingTracks = Array(audioTracks.length + 1)
.fill("-map 0:")
.map((str, index) => {
return str + index;
})
.join(" ");
// Mapping of tracks for FFMPEG, adding 1 for the video stream
const mappingTracks = Array(audioTracks.length + 1)
.fill("-map 0:")
.map((str, index) => {
return str + index;
})
.join(" ");
let codec = "libx264";
let hwAcc = "";
let codec = "libx264";
let hwAcc = "";
const argv = process.argv;
if (argv.includes("/nvenc")) {
// Use NVenc
codec = "h264_nvenc";
hwAcc = "-hwaccel cuda";
const argv = process.argv;
if (argv.includes("/nvenc_h264")) {
// Use NVenc H.264
codec = "h264_nvenc";
hwAcc = "-hwaccel cuda";
}
// Increase video bitrate
videoBitrate = Math.floor(videoBitrate);
}
if (argv.includes("/nvenc_h265")) {
// Use NVenc H.265
codec = "hevc_nvenc";
hwAcc = "-hwaccel cuda";
}
// Compress the video
// Add metadata to audio's track
await execute(
`"${ffmpegPath}" -y ${hwAcc} \
if (argv.includes("/h265")) {
// Use H.265 encoder
codec = "libx265";
}
// Compress the video
// Add metadata to audio's track
await execute(
`"${ffmpegPath}" -y ${hwAcc} \
-i "${file}" \
-c:v ${codec} -b:v ${videoBitrate}k -pass 1 -an -f mp4 \
${nul} \
@ -190,22 +205,26 @@ app.whenReady().then(() => {
-i "${file}" \
-c:v ${codec} -b:v ${videoBitrate}k -pass 2 -c:a copy \
${mappingTracks} -f mp4 \
${metadataAudio} \
-profile:v main \
${audioTracks.length === metadataAudioSize ? metadataAudio : ""} \
${shareOpt} \
"${finalFile}"`
).catch((e) => registerError(win, e));
).catch((e) => registerError(win, e));
// Delete the 2 pass temporary files
deleteTwoPassFiles(process.cwd());
} else {
finalFile = "";
}
// Delete the old video file
deleteFile(file);
// Delete the 2 pass temporary files
deleteTwoPassFiles(process.cwd());
return finalFile;
};
/** Move metadata at the begenning of the file */
const moveMetadata = async (file: string) => {
const moveMetadata = async (file: string, nbTracks: number) => {
const finalFile = getNewFilename(file, "Broadcastable - ");
// Optimize for streaming
@ -214,6 +233,7 @@ app.whenReady().then(() => {
-i "${file}" \
-map 0 -codec copy \
${shareOpt} \
${nbTracks === metadataAudioSize ? metadataAudio : ""} \
"${finalFile}"`
).catch((e) => registerError(win, e));
@ -234,7 +254,9 @@ app.whenReady().then(() => {
(_, file: string, bitrate: number, audioTracks: number[]) =>
reduceSize(file, bitrate, audioTracks)
);
ipcMain.handle("moveMetadata", (_, file: string) => moveMetadata(file));
ipcMain.handle("moveMetadata", (_, file: string, nbTracks: number) =>
moveMetadata(file, nbTracks)
);
ipcMain.handle("exit", () => (error ? {} : app.quit()));
ipcMain.handle("confirmation", (_, text: string) => confirmation(text));
});

View file

@ -15,7 +15,8 @@ contextBridge.exposeInMainWorld("internals", {
mergeAudio: (file: string) => ipcRenderer.invoke("mergeAudio", file),
reduceSize: (file: string, bitrate: number, audioTracks: number[]) =>
ipcRenderer.invoke("reduceSize", file, bitrate, audioTracks),
moveMetadata: (file: string) => ipcRenderer.invoke("moveMetadata", file),
moveMetadata: (file: string, nbTracks: number) =>
ipcRenderer.invoke("moveMetadata", file, nbTracks),
exit: () => ipcRenderer.invoke("exit"),
confirmation: (text: string) => ipcRenderer.invoke("confirmation", text),
});

View file

@ -18,7 +18,7 @@ let internals: {
bitrate: number,
audioTracks: number[]
) => Promise<string>;
moveMetadata: (file: string) => Promise<string>;
moveMetadata: (file: string, nbTracks: number) => Promise<string>;
confirmation: (text: string) => Promise<void>;
};
@ -103,6 +103,7 @@ const main = async () => {
updateMessage("Récupération des fichiers...");
const files = await getFiles();
let processedFiles = "";
let numberOfUncompressableFiles = 0;
// Iterate over all the retrieved files
for (const [idx, file] of files.entries()) {
@ -120,7 +121,7 @@ const main = async () => {
// Compress video if needed
if (newFile.size > maxSizeDiscord) {
const targetSize = maxSizeDiscord - 1; // keep some room
const targetSize = maxSizeDiscord - 2; // keep some room
// https://trac.ffmpeg.org/wiki/Encode/H.264#twopass
const bitrate = Math.floor((targetSize * 8388.608) / newFile.duration);
@ -141,18 +142,33 @@ const main = async () => {
updateMessage(`\nPréparation pour le partage...`, true, Mode.Append);
// Move the metadata to make it playable before everything is downloaded
finalTitle = await internals.moveMetadata(newFile.title);
finalTitle = await internals.moveMetadata(
newFile.title,
newFile.audioTracks.length
);
}
// Append title to the list of processed files
processedFiles += `\n- ${finalTitle}`;
updateMessage(`Fichier ${counter} traités.`);
if (finalTitle.length > 0) {
processedFiles += `\n- ${finalTitle}`;
updateMessage(`Fichier ${counter} traités.`);
} else {
processedFiles += `\n- ${file} [incompressable]`;
updateMessage(`Fichier ${counter} trop large pour être compressé.`);
numberOfUncompressableFiles++;
}
}
let errorMessage = "";
if (numberOfUncompressableFiles > 0) {
errorMessage += `\nNombre de fichier incompressable : ${numberOfUncompressableFiles}.`;
}
// Send confirmation to the user that we're done
await internals.confirmation(
`${files.length} fichiers traités : ${processedFiles}`
`${files.length} fichiers traités : ${processedFiles}` + errorMessage
);
await internals.exit();
};