π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add documentation about ffmpeg
Manav Rathibb865a7b15f9
diff --git a/desktop/electron-builder.yml b/desktop/electron-builder.ymlindex fb147b5726..8f29df2eef 100644--- a/desktop/electron-builder.yml+++ b/desktop/electron-builder.yml@@ -31,6 +31,13 @@ mac:hardenedRuntime: truex64ArchFiles: Contents/Resources/ggmlclip-macafterSign: electron-builder-notarize+# When Electron packages our node_modules, they go into the ASAR archive. This+# is not what we want for the FFMPEG binaries though, and instead put them+# outside of the ASAR archive so that we can get at a direct path to these files+# when trying to run it.+#+# The filtering by `${os}` and `${arch}` is to include only the binaries for the+# os/arch combination that we're bundling.asarUnpack:- node_modules/ffmpeg-static/bin/${os}/${arch}/ffmpeg- node_modules/ffmpeg-static/index.jsdiff --git a/desktop/src/preload.ts b/desktop/src/preload.tsindex ff7a17a1c5..72ba5c61bc 100644--- a/desktop/src/preload.ts+++ b/desktop/src/preload.ts@@ -385,7 +385,7 @@ setupLogging();// [Note: Transferring large amount of data over IPC]//// Electron's IPC implementation uses the HTML standard Structured Clone-// Algorithm to serialize objects passed between processes. [1]+// Algorithm to serialize objects passed between processes.// https://www.electronjs.org/docs/latest/tutorial/ipc#object-serialization//// In particular, both ArrayBuffer and the web File types are eligible for@@ -406,6 +406,9 @@ setupLogging();// copying, the IPC should be fast enough for even moderately large data:// https://github.com/electron/electron/issues/1948#issuecomment-864191345//+// The main problem with transfering large amounts of data is potentially+// running out of memory, causing the app to crash as it copies it over across+// the processes.contextBridge.exposeInMainWorld("ElectronAPIs", {exists,checkExistsAndCreateDir,diff --git a/desktop/src/services/ffmpeg.ts b/desktop/src/services/ffmpeg.tsindex e0a9157909..897ec6b0a4 100644--- a/desktop/src/services/ffmpeg.ts+++ b/desktop/src/services/ffmpeg.ts@@ -20,6 +20,26 @@ function getFFmpegStaticPath() {return pathToFfmpeg.replace("app.asar", "app.asar.unpacked");}+/**+ * Run a ffmpeg command+ *+ * [Note: FFMPEG in Electron]+ *+ * There is a wasm build of FFMPEG, but that is currently 10-20 times slower+ * that the native build. That is slow enough to be unusable for our purposes.+ * https://ffmpegwasm.netlify.app/docs/performance+ *+ * So the alternative is to bundle a ffmpeg binary with our app. e.g.+ *+ * yarn add fluent-ffmpeg ffmpeg-static ffprobe-static+ *+ * (we only use ffmpeg-static, the rest are mentioned for completeness' sake).+ *+ * Interestingly, Electron already bundles an ffmpeg library (it comes from the+ * ffmpeg fork maintained by Chromium).+ * https://chromium.googlesource.com/chromium/third_party/ffmpeg+ * https://stackoverflow.com/questions/53963672/what-version-of-ffmpeg-is-bundled-inside-electron+ */export async function runFFmpegCmd(cmd: string[],inputFilePath: string,