mirror of
https://github.com/bitinflow/rerun-encoder.git
synced 2026-03-14 06:06:03 +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 * as fs from "fs";
|
||||||
import axios, {AxiosInstance} from "axios";
|
import axios, {AxiosInstance} from "axios";
|
||||||
|
|
||||||
const ffmpeg = require('fluent-ffmpeg')
|
|
||||||
|
|
||||||
export class Encoder {
|
export class Encoder {
|
||||||
private readonly id: string;
|
private readonly id: string;
|
||||||
private readonly input: string;
|
private readonly input: string;
|
||||||
@@ -42,15 +40,25 @@ export class Encoder {
|
|||||||
async encode(): Promise<void> {
|
async encode(): Promise<void> {
|
||||||
this.listeners.onStart(this.id)
|
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)
|
ffmpeg(this.input)
|
||||||
.outputOptions(this.getOutputOptions())
|
.outputOptions(this.getOutputOptions())
|
||||||
.output(this.output)
|
.output(this.output)
|
||||||
.on('start', () => {
|
.on('start', () => {
|
||||||
console.log('start')
|
console.log('start')
|
||||||
})
|
})
|
||||||
.on('progress', (progress) => {
|
.on('codecData', data => {
|
||||||
console.log('progress', progress)
|
totalTime = parseInt(data.duration.replace(/:/g, ''))
|
||||||
this.listeners.onProgress(this.id, progress.percent)
|
})
|
||||||
|
.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 () => {
|
.on('end', async () => {
|
||||||
console.log('end')
|
console.log('end')
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export class InternalServer {
|
|||||||
name: response.data.name,
|
name: response.data.name,
|
||||||
config: response.data.config,
|
config: response.data.config,
|
||||||
avatar_url: response.data.avatar_url,
|
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";
|
import {Credentials, Settings} from "../../shared/schema";
|
||||||
|
|
||||||
const defaults: Settings = {
|
const defaults: Settings = {
|
||||||
version: '1.0.0',
|
version: '1.0.1',
|
||||||
credentials: null,
|
credentials: null,
|
||||||
endpoint: 'https://api.rerunmanager.com/v1/',
|
endpoint: 'https://api.rerunmanager.com/v1/',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "rerun-encoder",
|
"name": "rerun-encoder",
|
||||||
"private": true,
|
"private": true,
|
||||||
"productName": "Rerun Encoder",
|
"productName": "Rerun Encoder",
|
||||||
"version": "1.0.0",
|
"version": "1.0.3",
|
||||||
"description": "Official Rerun Encoder App for Rerun Manager",
|
"description": "Official Rerun Encoder App for Rerun Manager",
|
||||||
"main": "dist-electron/main/index.js",
|
"main": "dist-electron/main/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -57,6 +57,7 @@
|
|||||||
"vue-tsc": "^1.1.7"
|
"vue-tsc": "^1.1.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
||||||
"@koa/cors": "^4.0.0",
|
"@koa/cors": "^4.0.0",
|
||||||
"axios": "^1.3.4",
|
"axios": "^1.3.4",
|
||||||
"cors": "^2.8.5",
|
"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
|
id: string
|
||||||
name: string
|
name: string
|
||||||
avatar_url: string
|
avatar_url: string
|
||||||
|
premium: boolean
|
||||||
config: {
|
config: {
|
||||||
storage_limit: number
|
storage_limit: number
|
||||||
videos_limit: number
|
videos_limit: number
|
||||||
|
|||||||
@@ -109,8 +109,9 @@ const logout = () => {
|
|||||||
|
|
||||||
const storageUpgradeRequired = computed(() => {
|
const storageUpgradeRequired = computed(() => {
|
||||||
if (!settings.value) return false
|
if (!settings.value) return false
|
||||||
|
if (!settings.value.credentials) return false
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return !settings.value.credentials.user.config.premium
|
return !settings.value.credentials.user.premium
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user