This commit is contained in:
ct
2025-06-21 21:55:52 +08:00
parent 8bd90c85dc
commit 12733015f2
2 changed files with 24 additions and 8 deletions

View File

@@ -127,9 +127,22 @@ const useVideoExport = ({ timelineElements, dimensions, totalDuration }) => {
if (videos.length === 0 && images.length === 0) {
if (is_string) {
return 'ffmpeg -f lavfi -i color=black:size=450x800:duration=1 -c:v libvpx-vp9 -t 1 output.mp4';
return 'ffmpeg -y -c:v libvpx-vp9 -f lavfi -i color=black:size=450x800:duration=1 -t 1 -vcodec libx264 output.mp4';
} else {
return ['-f', 'lavfi', '-i', 'color=black:size=450x800:duration=1', '-c:v', 'libvpx-vp9', '-t', '1', 'output.mp4'];
return [
'-y',
'-c:v',
'libvpx-vp9',
'-f',
'lavfi',
'-i',
'color=black:size=450x800:duration=1',
'-t',
'1',
'-vcodec',
'libx264',
'output.mp4',
];
}
}
@@ -314,20 +327,23 @@ const useVideoExport = ({ timelineElements, dimensions, totalDuration }) => {
);
const finalArgs = [
'-y',
'-c:v',
'libvpx-vp9',
...inputArgs,
'-filter_complex',
filterComplex,
'-map',
`[${videoLayer}]`,
...audioArgs,
'-c:v',
'libvpx-vp9',
'-pix_fmt',
'yuv420p',
'-c:a',
'aac',
'-r',
'30',
'-t',
totalDuration.toString(),
'-vcodec',
'libx264',
'output.mp4',
];
@@ -344,7 +360,7 @@ const useVideoExport = ({ timelineElements, dimensions, totalDuration }) => {
const inputs = inputStrings.join(' ');
const audioMap = audioArgs.length > 0 ? ` ${audioArgs.map((arg) => escapeShellArg(arg)).join(' ')}` : '';
const command = `ffmpeg ${inputs} -filter_complex ${escapeShellArg(filterComplex)} -map ${escapeShellArg(`[${videoLayer}]`)}${audioMap} -c:v libvpx-vp9 -pix_fmt yuv420p -r 30 -t ${totalDuration} output.mp4`;
const command = `ffmpeg -y -c:v libvpx-vp9 ${inputs} -filter_complex ${escapeShellArg(filterComplex)} -map ${escapeShellArg(`[${videoLayer}]`)}${audioMap} -c:a aac -r 30 -t ${totalDuration} -vcodec libx264 output.mp4`;
showConsoleLogs && console.log('🎵 FINAL COMMAND HAS AUDIO:', command.includes('atrim') && command.includes('audio_final'));

View File

@@ -55,7 +55,7 @@
"y": 200,
"fontSize": 40,
"fontWeight": "bold",
"fontFamily": "Montserrat",
"fontFamily": "Arial",
"fontStyle": "normal",
"fill": "#ffffff",
"stroke": "#000000",