split ffmpeg commands to multiples lines

This commit is contained in:
Mylloon 2023-08-23 21:30:20 +02:00
parent ef356ef58f
commit f41a6c8c35
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -58,13 +58,21 @@ app.whenReady().then(() => {
// Merge 2 audio // Merge 2 audio
// See: https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a2stereostereo // See: https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a2stereostereo
await execute( await execute(
`"${ffmpegPath}" -y -i "${file}" -filter_complex "[0:a]amerge=inputs=2[a]" -ac 2 -map 0:v -map "[a]" -c:v copy "${tmpFile}"` `"${ffmpegPath}" -y \
-i "${file}" \
-filter_complex "[0:a]amerge=inputs=2[a]" -ac 2 -map 0:v -map "[a]" \
-c:v copy \
"${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
// About disposition: https://ffmpeg.org/ffmpeg.html#Main-options // About disposition: https://ffmpeg.org/ffmpeg.html#Main-options
await execute( await execute(
`"${ffmpegPath}" -y -i "${tmpFile}" -i "${file}" -map 0 -map 1:a -c:v copy -disposition:a 0 -disposition:a:0 default "${outFile}"` `"${ffmpegPath}" -y \
-i "${tmpFile}" -i "${file}" \
-map 0 -map 1:a -c:v copy \
-disposition:a 0 -disposition:a:0 default \
"${outFile}"`
).catch((e) => printAndDevTool(win, e)); ).catch((e) => printAndDevTool(win, e));
// Delete the temporary video file // Delete the temporary video file
@ -87,8 +95,14 @@ app.whenReady().then(() => {
const nul = process.platform === "win32" ? "NUL" : "/dev/null"; const nul = process.platform === "win32" ? "NUL" : "/dev/null";
await execute( await execute(
`"${ffmpegPath}" -y -i "${file}" -c:v libx264 -b:v ${videoBitrate}k -pass 1 -an -f mp4 ${nul} && \ `"${ffmpegPath}" -y \
"${ffmpegPath}" -y -i "${file}" -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 "${finalFile}"` -i "${file}" -c:v libx264 -b:v ${videoBitrate}k -pass 1 -an -f mp4 \
${nul} \
&& \
"${ffmpegPath}" -y \
-i "${file}" -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 \
"${finalFile}"`
).catch((e) => printAndDevTool(win, e)); ).catch((e) => printAndDevTool(win, e));
// Delete the old video file // Delete the old video file