mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
created main
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
import { app, BrowserWindow, ipcMain, dialog } from 'electron';
|
||||||
|
import { exec } from 'child_process';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
let mainWindow;
|
||||||
|
|
||||||
|
function createWindow() {
|
||||||
|
mainWindow = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: false,
|
||||||
|
contextIsolation: true,
|
||||||
|
preload: path.join(__dirname, 'preload.js')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mainWindow.loadFile('index.html');
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(createWindow);
|
||||||
|
|
||||||
|
// Kommunikation vom Renderer (Frontend)
|
||||||
|
ipcMain.handle('convert-video', async (event, filePath) => {
|
||||||
|
const output = path.join(path.dirname(filePath), 'converted.mp4');
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
exec(`ffmpeg -i "${filePath}" -vcodec libx264 "${output}"`, (error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
console.error('Fehler beim Konvertieren:', error);
|
||||||
|
reject(error);
|
||||||
|
} else {
|
||||||
|
console.log('Konvertierung abgeschlossen:', output);
|
||||||
|
resolve(output);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user