add metadata to compressed video

This commit is contained in:
Mylloon 2023-08-23 23:14:03 +02:00
parent 78ad17e005
commit 1c42ea43c5
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -16,6 +16,10 @@ const moviesFilter = {
extensions: ["mp4", "mkv"], extensions: ["mp4", "mkv"],
}; };
const metadataAudio = `-metadata:s:a:0 title="System sounds and microphone" \
-metadata:s:a:1 title="System sounds" \
-metadata:s:a:2 title="Microphone"`;
/** Create a new window */ /** Create a new window */
const createWindow = () => { const createWindow = () => {
const win = new BrowserWindow({ const win = new BrowserWindow({
@ -73,9 +77,7 @@ app.whenReady().then(() => {
-i "${tmpFile}" -i "${file}" \ -i "${tmpFile}" -i "${file}" \
-map 0 -map 1:a -c:v copy \ -map 0 -map 1:a -c:v copy \
-disposition:a 0 -disposition:a:0 default \ -disposition:a 0 -disposition:a:0 default \
-metadata:s:a:0 title="System sounds and microphone" \ ${metadataAudio} \
-metadata:s:a:1 title="System sounds" \
-metadata:s:a:2 title="Microphone" \
"${outFile}"` "${outFile}"`
).catch((e) => printAndDevTool(win, e)); ).catch((e) => printAndDevTool(win, e));
@ -109,6 +111,7 @@ app.whenReady().then(() => {
-i "${file}" \ -i "${file}" \
-c:v libx264 -b:v ${videoBitrate}k -pass 2 -c:a copy \ -c:v libx264 -b:v ${videoBitrate}k -pass 2 -c:a copy \
-map 0:0 -map 0:1 -map 0:2 -map 0:3 -f mp4 \ -map 0:0 -map 0:1 -map 0:2 -map 0:3 -f mp4 \
${metadataAudio} \
"${finalFile}"` "${finalFile}"`
).catch((e) => printAndDevTool(win, e)); ).catch((e) => printAndDevTool(win, e));