🎥 Make videos programmatically with React
ffprobe/ffmpeg download log
Patric Salvisberg9b88cb5d82e4
diff --git a/packages/renderer/src/ffmpeg-flags.ts b/packages/renderer/src/ffmpeg-flags.tsindex c14b2a359d..f747f62fee 100644--- a/packages/renderer/src/ffmpeg-flags.ts+++ b/packages/renderer/src/ffmpeg-flags.ts@@ -147,9 +147,14 @@ const waitForFfmpegToBeDownloaded = (url: string) => {});};-const onProgress = (downloadedBytes: number, totalBytesToDownload: number) => {+const onProgress = (+ downloadedBytes: number,+ totalBytesToDownload: number,+ binary: 'ffmpeg' | 'ffprobe'+) => {console.log(- 'Downloading FFmpeg: ',+ 'Downloading ',+ [binary],`${toMegabytes(downloadedBytes)}/${toMegabytes(totalBytesToDownload)}`);};@@ -162,8 +167,14 @@ export const downloadBinary = async (const destinationPath = getFfmpegAbsolutePath(remotionRoot, binary);isDownloading[url] = true;- const totalBytes = await _downloadFile(url, destinationPath, onProgress);- onProgress(totalBytes, totalBytes);+ const totalBytes = await _downloadFile(+ url,+ destinationPath,+ (downloadedBytes) => {+ onProgress(downloadedBytes, totalBytes, binary);+ }+ );+ onProgress(totalBytes, totalBytes, binary);if (os.platform() !== 'win32') {fs.chmodSync(destinationPath, '777');}diff --git a/packages/renderer/src/test/get-audio-channels.test.ts b/packages/renderer/src/test/get-audio-channels.test.tsindex cf9e64b4b8..d78318eee5 100644--- a/packages/renderer/src/test/get-audio-channels.test.ts+++ b/packages/renderer/src/test/get-audio-channels.test.ts@@ -46,7 +46,7 @@ test('Get audio channels for video without music', async () => {process.cwd());expect(channels.channels).toEqual(0);- expect(channels.duration).toBeCloseTo(3.34, 2);+ expect(channels.duration).toBeCloseTo(3.334, 2);}, 90000);test('Get audio channels for video with music', async () => {