mirror of
https://github.com/bitinflow/rerun-encoder.git
synced 2026-03-13 13:46:00 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df803afe2b | ||
|
|
2644c30bf2 | ||
|
|
036f20ac63 | ||
|
|
3ac8430a0f | ||
|
|
961be44480 | ||
|
|
9b3961f5f0 |
@@ -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')
|
||||
|
||||
@@ -89,6 +89,7 @@ export class InternalServer {
|
||||
name: response.data.name,
|
||||
config: response.data.config,
|
||||
avatar_url: response.data.avatar_url,
|
||||
premium: response.data.premium,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as fs from 'fs'
|
||||
import {Credentials, Settings} from "../../shared/schema";
|
||||
|
||||
const defaults: Settings = {
|
||||
version: '1.0.0',
|
||||
version: '1.0.1',
|
||||
credentials: null,
|
||||
endpoint: 'https://api.rerunmanager.com/v1/',
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "rerun-encoder",
|
||||
"private": true,
|
||||
"productName": "Rerun Encoder",
|
||||
"version": "1.0.0",
|
||||
"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",
|
||||
|
||||
1
shared/schema.d.ts
vendored
1
shared/schema.d.ts
vendored
@@ -5,6 +5,7 @@ export interface User {
|
||||
id: string
|
||||
name: string
|
||||
avatar_url: string
|
||||
premium: boolean
|
||||
config: {
|
||||
storage_limit: number
|
||||
videos_limit: number
|
||||
|
||||
@@ -109,8 +109,9 @@ const logout = () => {
|
||||
|
||||
const storageUpgradeRequired = computed(() => {
|
||||
if (!settings.value) return false
|
||||
if (!settings.value.credentials) return false
|
||||
// @ts-ignore
|
||||
return !settings.value.credentials.user.config.premium
|
||||
return !settings.value.credentials.user.premium
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user