This commit is contained in:
Mylloon 2023-08-24 15:56:19 +02:00
parent e6d2376fea
commit 53d19bdb74
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -63,10 +63,10 @@ app.whenReady().then(() => {
// See: https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a2stereostereo // See: https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a2stereostereo
await execute( await execute(
`"${ffmpegPath}" -y \ `"${ffmpegPath}" -y \
-i "${file}" \ -i "${file}" \
-filter_complex "[0:a]amerge=inputs=2[a]" -ac 2 -map 0:v -map "[a]" \ -filter_complex "[0:a]amerge=inputs=2[a]" -ac 2 -map 0:v -map "[a]" \
-c:v copy \ -c:v copy \
"${tmpFile}"` "${tmpFile}"`
).catch((e) => printAndDevTool(win, e)); ).catch((e) => printAndDevTool(win, e));
// Add merged audio as first position to original video and make it default // Add merged audio as first position to original video and make it default
@ -74,11 +74,11 @@ app.whenReady().then(() => {
// Also rename all tracks accordingly to what they are // Also rename all tracks accordingly to what they are
await execute( await execute(
`"${ffmpegPath}" -y \ `"${ffmpegPath}" -y \
-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 \
${metadataAudio} \ ${metadataAudio} \
"${outFile}"` "${outFile}"`
).catch((e) => printAndDevTool(win, e)); ).catch((e) => printAndDevTool(win, e));
// Delete the temporary video file // Delete the temporary video file
@ -104,16 +104,16 @@ app.whenReady().then(() => {
// Add metadata to audio's track // Add metadata to audio's track
await execute( await execute(
`"${ffmpegPath}" -y \ `"${ffmpegPath}" -y \
-i "${file}" \ -i "${file}" \
-c:v libx264 -b:v ${videoBitrate}k -pass 1 -an -f mp4 \ -c:v libx264 -b:v ${videoBitrate}k -pass 1 -an -f mp4 \
${nul} \ ${nul} \
&& \ && \
"${ffmpegPath}" -y \ "${ffmpegPath}" -y \
-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} \ ${metadataAudio} \
"${finalFile}"` "${finalFile}"`
).catch((e) => printAndDevTool(win, e)); ).catch((e) => printAndDevTool(win, e));
// Delete the old video file // Delete the old video file