Skip to content

🎥 Make videos programmatically with React

increase default audio bitrate

Jonny Burger75a4c9fabe1a
diff --git a/packages/renderer/src/stitch-frames-to-video.ts b/packages/renderer/src/stitch-frames-to-video.ts
index 7bb27d4b4c..765221acd3 100644
--- a/packages/renderer/src/stitch-frames-to-video.ts
+++ b/packages/renderer/src/stitch-frames-to-video.ts
@@ -232,6 +232,9 @@ export const spawnFfmpeg = async (
audio,
'-c:a',
audioCodecName,
+ // Set bitrate up to 320k, for aac it might effectively be lower
+ '-b:a',
+ '320k',
options.force ? '-y' : null,
options.outputLocation,
].filter(Internals.truthy)
@@ -275,6 +278,8 @@ export const spawnFfmpeg = async (
]),
codec === 'h264' ? ['-movflags', 'faststart'] : null,
audioCodecName ? ['-c:a', audioCodecName] : null,
+ // Set bitrate up to 320k, for aac it might be lower
+ audioCodecName ? ['-b:a', '320k'] : null,
// Ignore metadata that may come from remote media
['-map_metadata', '-1'],
[