2 Commits
1.0.1 ... 1.0.3

Author SHA1 Message Date
René Preuß
df803afe2b Some ffmpeg fail to return progress
https://stackoverflow.com/a/70899710
2023-03-03 18:36:17 +01:00
René Preuß
2644c30bf2 Add @ffmpeg-installer/ffmpeg 2023-03-03 15:06:41 +01:00
2 changed files with 15 additions and 6 deletions

View File

@@ -3,8 +3,6 @@ import {EncoderListeners, EncoderOptions, Settings, User, Video} from "../../sha
import * as fs from "fs";
import axios, {AxiosInstance} from "axios";
const ffmpeg = require('fluent-ffmpeg')
export class Encoder {
private readonly id: string;
private readonly input: string;
@@ -42,15 +40,25 @@ export class Encoder {
async encode(): Promise<void> {
this.listeners.onStart(this.id)
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path
console.log('ffmpegPath', ffmpegPath)
const ffmpeg = require('fluent-ffmpeg')
ffmpeg.setFfmpegPath(ffmpegPath)
let totalTime = 0;
ffmpeg(this.input)
.outputOptions(this.getOutputOptions())
.output(this.output)
.on('start', () => {
console.log('start')
})
.on('progress', (progress) => {
console.log('progress', progress)
this.listeners.onProgress(this.id, progress.percent)
.on('codecData', data => {
totalTime = parseInt(data.duration.replace(/:/g, ''))
})
.on('progress', progress => {
const time = parseInt(progress.timemark.replace(/:/g, ''))
const percent = (time / totalTime) * 100
console.log('progress', percent)
this.listeners.onProgress(this.id, percent)
})
.on('end', async () => {
console.log('end')

View File

@@ -2,7 +2,7 @@
"name": "rerun-encoder",
"private": true,
"productName": "Rerun Encoder",
"version": "1.0.1",
"version": "1.0.3",
"description": "Official Rerun Encoder App for Rerun Manager",
"main": "dist-electron/main/index.js",
"scripts": {
@@ -57,6 +57,7 @@
"vue-tsc": "^1.1.7"
},
"dependencies": {
"@ffmpeg-installer/ffmpeg": "^1.1.0",
"@koa/cors": "^4.0.0",
"axios": "^1.3.4",
"cors": "^2.8.5",