Compare commits
34 commits
Author | SHA1 | Date | |
---|---|---|---|
7c4bd84486 | |||
e34712976b | |||
dc190ab807 | |||
21050bb0b7 | |||
482caad25f | |||
5841006f15 | |||
ee64d06e0a | |||
2ef8bda147 | |||
b6d6b84839 | |||
f2b04f0cea | |||
c22a9c295d | |||
b391e05ed3 | |||
a74bb33967 | |||
8d34199ae0 | |||
b894fd0856 | |||
39d84c9b57 | |||
981f95c40d | |||
c8538f5d03 | |||
2c2f469cc5 | |||
7973a02603 | |||
a6fe54fd9c | |||
20052ed7d6 | |||
4223ede10a | |||
877021ee0d | |||
fce9bce308 | |||
0ed6407315 | |||
af921925af | |||
cb9de1b856 | |||
1d1c0f78bc | |||
6fffd19278 | |||
bfa1f94a43 | |||
ebbca9b6aa | |||
fc7782a982 | |||
440fcf2334 |
8 changed files with 171 additions and 193 deletions
|
@ -25,3 +25,4 @@ jobs:
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.TOKEN }}
|
token: ${{ secrets.TOKEN }}
|
||||||
files: out/make/zip/win32/x64/dsr-win32-x64-${{ github.ref_name }}.zip
|
files: out/make/zip/win32/x64/dsr-win32-x64-${{ github.ref_name }}.zip
|
||||||
|
draft: true
|
||||||
|
|
36
README.md
36
README.md
|
@ -1,10 +1,10 @@
|
||||||
# Discord Video Sharing ![status-badge](https://git.mylloon.fr/Anri/dsr/badges/workflows/release.yml/badge.svg)
|
# Discord Video Sharing [![status-badge](https://git.mylloon.fr/Anri/dsr/badges/workflows/release.yml/badge.svg)](https://git.mylloon.fr/Anri/dsr/actions?workflow=release.yml)
|
||||||
|
|
||||||
Tool for sharing video to Discord.
|
Tool for sharing video to Discord.
|
||||||
|
|
||||||
> This tool was primarily made for video captured by NVidia Shadowplay.
|
> This tool was primarily made for video captured by NVidia Shadowplay.
|
||||||
|
|
||||||
## Download/Install
|
## Download/Install/Update
|
||||||
|
|
||||||
2 choices :
|
2 choices :
|
||||||
|
|
||||||
|
@ -15,22 +15,36 @@ Tool for sharing video to Discord.
|
||||||
irm https://git.mylloon.fr/Anri/dsr/raw/branch/main/install.ps1 | iex
|
irm https://git.mylloon.fr/Anri/dsr/raw/branch/main/install.ps1 | iex
|
||||||
```
|
```
|
||||||
|
|
||||||
> - If you have Discord Nitro: add `/nitro` flag when running DSR.
|
## Available flags
|
||||||
> - If you have an NVidia GPU with NVenc: add `/nvenc` flag when running DSR.
|
|
||||||
|
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
|
## More info
|
||||||
|
|
||||||
- [x] KISS interface
|
- [x] KISS interface
|
||||||
- [x] Support drag&drop into the icon
|
- [x] Support drag&drop into the icon
|
||||||
- [x] Keep the video under 25mb (discord limitation)
|
- [x] Keep the video under discord limitation
|
||||||
- [x] NVenc support
|
- [x] Defaults to H.264 CPU encoder
|
||||||
- [x] If already under the limit, the file won't be compressed
|
- [x] If already under the limit, the file won't be compressed
|
||||||
- [x] Nitro suppport via `/nitro` flag
|
- [x] NVenc support
|
||||||
- [x] Merge audio files into one track when recorded with system audio and microphone
|
- [x] Nitro suppport
|
||||||
split up, while keeping the original ones (with conveninant metadata)
|
- [x] Merge 2 audio files into one track when recorded with system audio and microphone
|
||||||
- [x] Works also with file with only one audio track
|
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
|
||||||
|
nothing
|
||||||
- [x] Support multiples files at once
|
- [x] Support multiples files at once
|
||||||
- [x] Optimize for video streaming
|
- [x] Always optimize for video streaming
|
||||||
|
|
||||||
## Package the app for Windows
|
## Package the app for Windows
|
||||||
|
|
||||||
|
|
210
package-lock.json
generated
210
package-lock.json
generated
|
@ -1,24 +1,23 @@
|
||||||
{
|
{
|
||||||
"name": "dsr",
|
"name": "dsr",
|
||||||
"version": "1.9.0",
|
"version": "1.11.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "dsr",
|
"name": "dsr",
|
||||||
"version": "1.9.0",
|
"version": "1.11.0",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron-forge/maker-zip": "^7.4",
|
"@electron-forge/maker-zip": "^7.4",
|
||||||
"ffmpeg-static": "^5.2",
|
"ffmpeg-static": "^5.2",
|
||||||
"ffprobe-static": "^3.1",
|
"ffprobe-static": "^3.1",
|
||||||
"terminate": "^2.8",
|
"typescript": "^5.6"
|
||||||
"typescript": "^5.5"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-forge/cli": "^7.4",
|
"@electron-forge/cli": "^7.4",
|
||||||
"@types/ffprobe-static": "^2.0",
|
"@types/ffprobe-static": "^2.0",
|
||||||
"electron": "^32.0"
|
"electron": "^32.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@derhuerst/http-basic": {
|
"node_modules/@derhuerst/http-basic": {
|
||||||
|
@ -312,11 +311,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@electron/asar": {
|
"node_modules/@electron/asar": {
|
||||||
"version": "3.2.10",
|
"version": "3.2.13",
|
||||||
"resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.2.10.tgz",
|
"resolved": "https://registry.npmjs.org/@electron/asar/-/asar-3.2.13.tgz",
|
||||||
"integrity": "sha512-mvBSwIBUeiRscrCeJE1LwctAriBj65eUDm0Pc11iE5gRwzkmsdbS7FnZ1XUWjpSeQWL1L5g12Fc/SchPM9DUOw==",
|
"integrity": "sha512-pY5z2qQSwbFzJsBdgfJIzXf5ElHTVMutC2dxh0FD60njknMu3n1NnTABOcQwbb5/v5soqE79m9UjaJryBf3epg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/glob": "^7.1.0",
|
||||||
"commander": "^5.0.0",
|
"commander": "^5.0.0",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
"minimatch": "^3.0.4"
|
"minimatch": "^3.0.4"
|
||||||
|
@ -400,9 +400,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@electron/notarize": {
|
"node_modules/@electron/notarize": {
|
||||||
"version": "2.4.0",
|
"version": "2.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.5.0.tgz",
|
||||||
"integrity": "sha512-ArHnRPIJJGrmV+uWNQSINAht+cM4gAo3uA3WFI54bYF93mzmD15gzhPQ0Dd+v/fkMhnRiiIO8NNkGdn87Vsy0g==",
|
"integrity": "sha512-jNT8nwH1f9X5GEITXaQ8IF/KdskvIkOFfB2CvwumsveVidzpSc+mvhhTMdAGSYF3O+Nq49lJ7y+ssODRXu06+A==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
|
@ -450,12 +450,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@electron/packager": {
|
"node_modules/@electron/packager": {
|
||||||
"version": "18.3.4",
|
"version": "18.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/@electron/packager/-/packager-18.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/@electron/packager/-/packager-18.3.5.tgz",
|
||||||
"integrity": "sha512-u/IxB5nelg+areXbSEWJxg1r4z0TcS1D1Dax106PsgwgPtcFvB6jjGxZVLA0WHSrLpkj6qfigHSuVXzxMTH+Qw==",
|
"integrity": "sha512-ClgTxXTt3MesWAcjIxIkgxELjTcllw1FRoVsihP7uT48kpDMqI71p4XvnMWbq8PvU57TcrKICAaLkxRhbc+/wQ==",
|
||||||
"license": "BSD-2-Clause",
|
"license": "BSD-2-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron/asar": "^3.2.1",
|
"@electron/asar": "^3.2.13",
|
||||||
"@electron/get": "^3.0.0",
|
"@electron/get": "^3.0.0",
|
||||||
"@electron/notarize": "^2.1.0",
|
"@electron/notarize": "^2.1.0",
|
||||||
"@electron/osx-sign": "^1.0.5",
|
"@electron/osx-sign": "^1.0.5",
|
||||||
|
@ -761,6 +761,16 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/glob": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/minimatch": "*",
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/http-cache-semantics": {
|
"node_modules/@types/http-cache-semantics": {
|
||||||
"version": "4.0.4",
|
"version": "4.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz",
|
||||||
|
@ -776,10 +786,16 @@
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/minimatch": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "20.16.1",
|
"version": "22.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz",
|
||||||
"integrity": "sha512-zJDo7wEadFtSyNz5QITDfRcrhqDvQI1xQNQ0VoizPjM/dVAODqqIUWbJPkvsxmTI0MYRGRikcdjMPhOssnPejQ==",
|
"integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.19.2"
|
"undici-types": "~6.19.2"
|
||||||
|
@ -872,9 +888,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ansi-regex": {
|
"node_modules/ansi-regex": {
|
||||||
"version": "6.0.1",
|
"version": "6.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",
|
||||||
"integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
|
"integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
|
@ -1462,12 +1478,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.3.6",
|
"version": "4.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
|
||||||
"integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==",
|
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ms": "2.1.2"
|
"ms": "^2.1.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0"
|
"node": ">=6.0"
|
||||||
|
@ -1594,12 +1610,6 @@
|
||||||
"p-limit": "^3.1.0 "
|
"p-limit": "^3.1.0 "
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/duplexer": {
|
|
||||||
"version": "0.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
|
|
||||||
"integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/eastasianwidth": {
|
"node_modules/eastasianwidth": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||||
|
@ -1607,9 +1617,9 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/electron": {
|
"node_modules/electron": {
|
||||||
"version": "32.0.1",
|
"version": "32.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-32.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-32.1.0.tgz",
|
||||||
"integrity": "sha512-5Hd5Jaf9niYVR2hZxoRd3gOrcxPOxQV1XPV5WaoSfT9jLJHFadhlKtuSDIk3U6rQZke+aC7GqPPAv55nWFCMsA==",
|
"integrity": "sha512-4etE3K6vPUkHihf7nvawngbB5+jLuUJgZh31f9ki1Gfveo0qwNDkLv/doabw+4zFFWKUXI+uFUpyOpL5+RwS+Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -1647,6 +1657,16 @@
|
||||||
"global-agent": "^3.0.0"
|
"global-agent": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"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==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~6.19.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/electron/node_modules/fs-extra": {
|
"node_modules/electron/node_modules/fs-extra": {
|
||||||
"version": "8.1.0",
|
"version": "8.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||||
|
@ -1772,9 +1792,9 @@
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/escalade": {
|
"node_modules/escalade": {
|
||||||
"version": "3.1.2",
|
"version": "3.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
|
||||||
"integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
|
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
|
@ -1793,21 +1813,6 @@
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/event-stream": {
|
|
||||||
"version": "3.3.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",
|
|
||||||
"integrity": "sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"duplexer": "~0.1.1",
|
|
||||||
"from": "~0",
|
|
||||||
"map-stream": "~0.1.0",
|
|
||||||
"pause-stream": "0.0.11",
|
|
||||||
"split": "0.3",
|
|
||||||
"stream-combiner": "~0.0.4",
|
|
||||||
"through": "~2.3.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/eventemitter3": {
|
"node_modules/eventemitter3": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
|
||||||
|
@ -2085,12 +2090,6 @@
|
||||||
"node": ">= 12"
|
"node": ">= 12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/from": {
|
|
||||||
"version": "0.1.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
|
|
||||||
"integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/fs-extra": {
|
"node_modules/fs-extra": {
|
||||||
"version": "10.1.0",
|
"version": "10.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
|
||||||
|
@ -3051,11 +3050,6 @@
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/map-stream": {
|
|
||||||
"version": "0.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz",
|
|
||||||
"integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g=="
|
|
||||||
},
|
|
||||||
"node_modules/matcher": {
|
"node_modules/matcher": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",
|
||||||
|
@ -3095,9 +3089,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/micromatch": {
|
"node_modules/micromatch": {
|
||||||
"version": "4.0.7",
|
"version": "4.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
|
||||||
"integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==",
|
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -3250,9 +3244,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/negotiator": {
|
"node_modules/negotiator": {
|
||||||
|
@ -3708,18 +3702,6 @@
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/pause-stream": {
|
|
||||||
"version": "0.0.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
|
|
||||||
"integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==",
|
|
||||||
"license": [
|
|
||||||
"MIT",
|
|
||||||
"Apache2"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"through": "~2.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/pe-library": {
|
"node_modules/pe-library": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/pe-library/-/pe-library-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/pe-library/-/pe-library-1.0.1.tgz",
|
||||||
|
@ -3897,25 +3879,10 @@
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ps-tree": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz",
|
|
||||||
"integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"event-stream": "=3.3.4"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"ps-tree": "bin/ps-tree.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/pump": {
|
"node_modules/pump": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz",
|
||||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
"integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"end-of-stream": "^1.1.0",
|
"end-of-stream": "^1.1.0",
|
||||||
|
@ -4504,18 +4471,6 @@
|
||||||
"integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==",
|
"integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==",
|
||||||
"license": "CC0-1.0"
|
"license": "CC0-1.0"
|
||||||
},
|
},
|
||||||
"node_modules/split": {
|
|
||||||
"version": "0.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz",
|
|
||||||
"integrity": "sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"through": "2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/sprintf-js": {
|
"node_modules/sprintf-js": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
|
||||||
|
@ -4534,15 +4489,6 @@
|
||||||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/stream-combiner": {
|
|
||||||
"version": "0.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
|
|
||||||
"integrity": "sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"duplexer": "~0.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/string_decoder": {
|
"node_modules/string_decoder": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
|
@ -4693,24 +4639,6 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/terminate": {
|
|
||||||
"version": "2.8.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/terminate/-/terminate-2.8.0.tgz",
|
|
||||||
"integrity": "sha512-bcbjJEg0wY5nuJXvGxxHfmoEPkyHLCctUKO6suwtxy7jVSgGcgPeGwpbLDLELFhIaxCGRr3dPvyNg1yuz2V0eg==",
|
|
||||||
"license": "GPL-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"ps-tree": "^1.2.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=12"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/through": {
|
|
||||||
"version": "2.3.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
|
||||||
"integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/to-regex-range": {
|
"node_modules/to-regex-range": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||||
|
@ -4771,9 +4699,9 @@
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.5.4",
|
"version": "5.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz",
|
||||||
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
|
"integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
|
|
12
package.json
12
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "dsr",
|
"name": "dsr",
|
||||||
"version": "1.9.0",
|
"version": "1.11.0",
|
||||||
"description": "Discord Video Sharing",
|
"description": "Discord Video Sharing",
|
||||||
"main": "./dist/main.js",
|
"main": "./dist/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -21,18 +21,20 @@
|
||||||
"@electron-forge/maker-zip": "^7.4",
|
"@electron-forge/maker-zip": "^7.4",
|
||||||
"ffmpeg-static": "^5.2",
|
"ffmpeg-static": "^5.2",
|
||||||
"ffprobe-static": "^3.1",
|
"ffprobe-static": "^3.1",
|
||||||
"terminate": "^2.8",
|
"typescript": "^5.6"
|
||||||
"typescript": "^5.5"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-forge/cli": "^7.4",
|
"@electron-forge/cli": "^7.4",
|
||||||
"@types/ffprobe-static": "^2.0",
|
"@types/ffprobe-static": "^2.0",
|
||||||
"electron": "^32.0"
|
"electron": "^32.1"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"forge": {
|
"forge": {
|
||||||
"packagerConfig": {
|
"packagerConfig": {
|
||||||
"icon": "./image/icon.ico"
|
"icon": "./image/icon.ico",
|
||||||
|
"asar": {
|
||||||
|
"unpack": "**/node_modules/*-static/**"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"makers": [
|
"makers": [
|
||||||
{
|
{
|
||||||
|
|
60
src/main.ts
60
src/main.ts
|
@ -11,9 +11,9 @@ import {
|
||||||
processes,
|
processes,
|
||||||
} from "./utils/misc";
|
} from "./utils/misc";
|
||||||
import path = require("path");
|
import path = require("path");
|
||||||
import ffmpegPath = require("ffmpeg-static");
|
|
||||||
|
|
||||||
const kill = require("terminate");
|
import ffmpeg = require("ffmpeg-static");
|
||||||
|
const ffmpegPath = `${ffmpeg}`.replace("app.asar", "app.asar.unpacked");
|
||||||
|
|
||||||
let error = false;
|
let error = false;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ const moviesFilter = {
|
||||||
extensions: ["mp4", "mkv"],
|
extensions: ["mp4", "mkv"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const metadataAudioSize = 3;
|
||||||
const metadataAudio = `-metadata:s:a:0 title="System sounds and microphone" \
|
const metadataAudio = `-metadata:s:a:0 title="System sounds and microphone" \
|
||||||
-metadata:s:a:1 title="System sounds" \
|
-metadata:s:a:1 title="System sounds" \
|
||||||
-metadata:s:a:2 title="Microphone"`;
|
-metadata:s:a:2 title="Microphone"`;
|
||||||
|
@ -51,6 +52,11 @@ const createWindow = () => {
|
||||||
return win;
|
return win;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// For notification on Windows
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
app.setAppUserModelId(app.name);
|
||||||
|
}
|
||||||
|
|
||||||
/* Ready to create the window */
|
/* Ready to create the window */
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
const win = createWindow();
|
const win = createWindow();
|
||||||
|
@ -84,9 +90,9 @@ app.whenReady().then(() => {
|
||||||
const tmpFile = getNewFilename(file, "TMP_");
|
const tmpFile = getNewFilename(file, "TMP_");
|
||||||
let outFile;
|
let outFile;
|
||||||
|
|
||||||
const nbTracks = getNumberOfAudioTracks(file);
|
let audioTracks = getNumberOfAudioTracks(file);
|
||||||
|
|
||||||
switch (nbTracks) {
|
switch (audioTracks.length) {
|
||||||
case 2:
|
case 2:
|
||||||
// Merge 2 audio
|
// Merge 2 audio
|
||||||
// See: https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a2stereostereo
|
// See: https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a2stereostereo
|
||||||
|
@ -115,6 +121,8 @@ app.whenReady().then(() => {
|
||||||
// Delete the temporary video file
|
// Delete the temporary video file
|
||||||
deleteFile(tmpFile);
|
deleteFile(tmpFile);
|
||||||
|
|
||||||
|
audioTracks = getNumberOfAudioTracks(outFile);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Other cases: no merge needed
|
// Other cases: no merge needed
|
||||||
|
@ -132,7 +140,7 @@ app.whenReady().then(() => {
|
||||||
title: outFile,
|
title: outFile,
|
||||||
size: stats.size / 1024 / 1024,
|
size: stats.size / 1024 / 1024,
|
||||||
duration,
|
duration,
|
||||||
nbTracks,
|
audioTracks,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,9 +148,11 @@ app.whenReady().then(() => {
|
||||||
const reduceSize = async (
|
const reduceSize = async (
|
||||||
file: string,
|
file: string,
|
||||||
bitrate: number,
|
bitrate: number,
|
||||||
nbTracks: number
|
audioTracks: number[]
|
||||||
) => {
|
) => {
|
||||||
const audioBitrate = 400; // keep some room
|
const audioBitrate = Math.ceil(
|
||||||
|
audioTracks.reduce((sum, current) => current + sum, 0)
|
||||||
|
);
|
||||||
let videoBitrate = bitrate - audioBitrate;
|
let videoBitrate = bitrate - audioBitrate;
|
||||||
|
|
||||||
const finalFile = getNewFilename(file, "Compressed - ");
|
const finalFile = getNewFilename(file, "Compressed - ");
|
||||||
|
@ -151,7 +161,7 @@ app.whenReady().then(() => {
|
||||||
const nul = process.platform === "win32" ? "NUL" : "/dev/null";
|
const nul = process.platform === "win32" ? "NUL" : "/dev/null";
|
||||||
|
|
||||||
// Mapping of tracks for FFMPEG, adding 1 for the video stream
|
// Mapping of tracks for FFMPEG, adding 1 for the video stream
|
||||||
const mappingTracks = Array(nbTracks + 1)
|
const mappingTracks = Array(audioTracks.length + 1)
|
||||||
.fill("-map 0:")
|
.fill("-map 0:")
|
||||||
.map((str, index) => {
|
.map((str, index) => {
|
||||||
return str + index;
|
return str + index;
|
||||||
|
@ -162,13 +172,21 @@ app.whenReady().then(() => {
|
||||||
let hwAcc = "";
|
let hwAcc = "";
|
||||||
|
|
||||||
const argv = process.argv;
|
const argv = process.argv;
|
||||||
if (argv.includes("/nvenc")) {
|
if (argv.includes("/nvenc_h264")) {
|
||||||
// Use NVenc
|
// Use NVenc H.264
|
||||||
codec = "h264_nvenc";
|
codec = "h264_nvenc";
|
||||||
hwAcc = "-hwaccel cuda";
|
hwAcc = "-hwaccel cuda";
|
||||||
|
}
|
||||||
|
|
||||||
// Increase video bitrate
|
if (argv.includes("/nvenc_h265")) {
|
||||||
videoBitrate = Math.floor(videoBitrate * 1.7);
|
// Use NVenc H.265
|
||||||
|
codec = "hevc_nvenc";
|
||||||
|
hwAcc = "-hwaccel cuda";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv.includes("/h265")) {
|
||||||
|
// Use H.265 encoder
|
||||||
|
codec = "libx265";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compress the video
|
// Compress the video
|
||||||
|
@ -183,7 +201,8 @@ app.whenReady().then(() => {
|
||||||
-i "${file}" \
|
-i "${file}" \
|
||||||
-c:v ${codec} -b:v ${videoBitrate}k -pass 2 -c:a copy \
|
-c:v ${codec} -b:v ${videoBitrate}k -pass 2 -c:a copy \
|
||||||
${mappingTracks} -f mp4 \
|
${mappingTracks} -f mp4 \
|
||||||
${metadataAudio} \
|
-profile:v main \
|
||||||
|
${audioTracks.length === metadataAudioSize ? metadataAudio : ""} \
|
||||||
${shareOpt} \
|
${shareOpt} \
|
||||||
"${finalFile}"`
|
"${finalFile}"`
|
||||||
).catch((e) => registerError(win, e));
|
).catch((e) => registerError(win, e));
|
||||||
|
@ -198,8 +217,8 @@ app.whenReady().then(() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Move metadata at the begenning of the file */
|
/** Move metadata at the begenning of the file */
|
||||||
const moveMetadata = async (file: string) => {
|
const moveMetadata = async (file: string, nbTracks: number) => {
|
||||||
const finalFile = getNewFilename(file, "Shareable - ");
|
const finalFile = getNewFilename(file, "Broadcastable - ");
|
||||||
|
|
||||||
// Optimize for streaming
|
// Optimize for streaming
|
||||||
await execute(
|
await execute(
|
||||||
|
@ -207,6 +226,7 @@ app.whenReady().then(() => {
|
||||||
-i "${file}" \
|
-i "${file}" \
|
||||||
-map 0 -codec copy \
|
-map 0 -codec copy \
|
||||||
${shareOpt} \
|
${shareOpt} \
|
||||||
|
${nbTracks === metadataAudioSize ? metadataAudio : ""} \
|
||||||
"${finalFile}"`
|
"${finalFile}"`
|
||||||
).catch((e) => registerError(win, e));
|
).catch((e) => registerError(win, e));
|
||||||
|
|
||||||
|
@ -224,17 +244,19 @@ app.whenReady().then(() => {
|
||||||
ipcMain.handle("mergeAudio", (_, file: string) => mergeAudio(file));
|
ipcMain.handle("mergeAudio", (_, file: string) => mergeAudio(file));
|
||||||
ipcMain.handle(
|
ipcMain.handle(
|
||||||
"reduceSize",
|
"reduceSize",
|
||||||
(_, file: string, bitrate: number, nbTracks: number) =>
|
(_, file: string, bitrate: number, audioTracks: number[]) =>
|
||||||
reduceSize(file, bitrate, nbTracks)
|
reduceSize(file, bitrate, audioTracks)
|
||||||
|
);
|
||||||
|
ipcMain.handle("moveMetadata", (_, file: string, nbTracks: number) =>
|
||||||
|
moveMetadata(file, nbTracks)
|
||||||
);
|
);
|
||||||
ipcMain.handle("moveMetadata", (_, file: string) => moveMetadata(file));
|
|
||||||
ipcMain.handle("exit", () => (error ? {} : app.quit()));
|
ipcMain.handle("exit", () => (error ? {} : app.quit()));
|
||||||
ipcMain.handle("confirmation", (_, text: string) => confirmation(text));
|
ipcMain.handle("confirmation", (_, text: string) => confirmation(text));
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on("window-all-closed", () => {
|
app.on("window-all-closed", () => {
|
||||||
processes.forEach((process) => {
|
processes.forEach((process) => {
|
||||||
kill(process.pid);
|
process.stdin.write("q");
|
||||||
});
|
});
|
||||||
|
|
||||||
app.quit();
|
app.quit();
|
||||||
|
|
|
@ -13,9 +13,10 @@ contextBridge.exposeInMainWorld("internals", {
|
||||||
ipcRenderer.invoke("getFilename", filepath),
|
ipcRenderer.invoke("getFilename", filepath),
|
||||||
askFiles: () => ipcRenderer.invoke("askFiles"),
|
askFiles: () => ipcRenderer.invoke("askFiles"),
|
||||||
mergeAudio: (file: string) => ipcRenderer.invoke("mergeAudio", file),
|
mergeAudio: (file: string) => ipcRenderer.invoke("mergeAudio", file),
|
||||||
reduceSize: (file: string, bitrate: number, nbTracks: number) =>
|
reduceSize: (file: string, bitrate: number, audioTracks: number[]) =>
|
||||||
ipcRenderer.invoke("reduceSize", file, bitrate, nbTracks),
|
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"),
|
exit: () => ipcRenderer.invoke("exit"),
|
||||||
confirmation: (text: string) => ipcRenderer.invoke("confirmation", text),
|
confirmation: (text: string) => ipcRenderer.invoke("confirmation", text),
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,14 +11,14 @@ let internals: {
|
||||||
title: string;
|
title: string;
|
||||||
duration: number;
|
duration: number;
|
||||||
size: number;
|
size: number;
|
||||||
nbTracks: number;
|
audioTracks: number[];
|
||||||
}>;
|
}>;
|
||||||
reduceSize: (
|
reduceSize: (
|
||||||
file: string,
|
file: string,
|
||||||
bitrate: number,
|
bitrate: number,
|
||||||
nbTracks: number
|
audioTracks: number[]
|
||||||
) => Promise<string>;
|
) => Promise<string>;
|
||||||
moveMetadata: (file: string) => Promise<string>;
|
moveMetadata: (file: string, nbTracks: number) => Promise<string>;
|
||||||
confirmation: (text: string) => Promise<void>;
|
confirmation: (text: string) => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,13 +56,16 @@ const getFiles = async () => {
|
||||||
/** Returns maximum allowed size for files in MB */
|
/** Returns maximum allowed size for files in MB */
|
||||||
const fetchMaxSize = async () => {
|
const fetchMaxSize = async () => {
|
||||||
const argv = await internals.argv();
|
const argv = await internals.argv();
|
||||||
if (argv.includes("/nitro")) {
|
if (argv.includes("/nitrobasic")) {
|
||||||
|
// Nitro Basic user
|
||||||
|
return 50;
|
||||||
|
} else if (argv.includes("/nitro")) {
|
||||||
// Nitro user
|
// Nitro user
|
||||||
return 500;
|
return 500;
|
||||||
|
} else {
|
||||||
|
// Free user
|
||||||
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free user
|
|
||||||
return 25;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Either replace the message, or add some info */
|
/** Either replace the message, or add some info */
|
||||||
|
@ -132,13 +135,16 @@ const main = async () => {
|
||||||
finalTitle = await internals.reduceSize(
|
finalTitle = await internals.reduceSize(
|
||||||
newFile.title,
|
newFile.title,
|
||||||
bitrate,
|
bitrate,
|
||||||
newFile.nbTracks
|
newFile.audioTracks
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
updateMessage(`\nPréparation pour le partage...`, true, Mode.Append);
|
updateMessage(`\nPréparation pour le partage...`, true, Mode.Append);
|
||||||
|
|
||||||
// Move the metadata to make it playable before everything is downloaded
|
// 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
|
// Append title to the list of processed files
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import ffprobe = require("ffprobe-static");
|
|
||||||
import child_process = require("child_process");
|
import child_process = require("child_process");
|
||||||
import path = require("path");
|
import path = require("path");
|
||||||
import { BrowserWindow } from "electron";
|
import { BrowserWindow } from "electron";
|
||||||
import { existsSync, unlink } from "fs";
|
import { existsSync, unlink } from "fs";
|
||||||
|
|
||||||
|
import ffprobe = require("ffprobe-static");
|
||||||
|
const ffprobePath = ffprobe.path.replace("app.asar", "app.asar.unpacked");
|
||||||
|
|
||||||
export const processes: child_process.ChildProcess[] = [];
|
export const processes: child_process.ChildProcess[] = [];
|
||||||
|
|
||||||
/** Create a new filename from the OG one */
|
/** Create a new filename from the OG one */
|
||||||
|
@ -14,16 +16,18 @@ export const getNewFilename = (ogFile: string, part: string) => {
|
||||||
|
|
||||||
/** Return the duration of a video in second */
|
/** Return the duration of a video in second */
|
||||||
export const getVideoDuration = (file: string) => {
|
export const getVideoDuration = (file: string) => {
|
||||||
const command = `"${ffprobe.path}" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${file}"`;
|
const command = `"${ffprobePath}" -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "${file}"`;
|
||||||
const durationString = child_process.execSync(command).toString().trim();
|
const durationString = child_process.execSync(command).toString().trim();
|
||||||
return parseFloat(durationString);
|
return parseFloat(durationString);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Return the number of audio tracks */
|
/** Return the number of audio tracks */
|
||||||
export const getNumberOfAudioTracks = (file: string) => {
|
export const getNumberOfAudioTracks = (file: string): number[] => {
|
||||||
const command = `"${ffprobe.path}" -v error -show_entries stream=index -select_streams a -of json "${file}"`;
|
const command = `"${ffprobePath}" -v error -show_entries stream=bit_rate -select_streams a -of json "${file}"`;
|
||||||
const result = child_process.execSync(command, { encoding: "utf8" });
|
const result = child_process.execSync(command, { encoding: "utf8" });
|
||||||
return JSON.parse(result).streams.length;
|
return JSON.parse(result).streams.map(
|
||||||
|
(v: { bit_rate: string }) => Number(v.bit_rate) / 1000
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Print an error to the console and open the dev tool panel */
|
/** Print an error to the console and open the dev tool panel */
|
||||||
|
|
Loading…
Reference in a new issue