Set bitrate limits for transcoding (fixes #638) (#1135)

* Set bitrate limits for transcoding (fixes #638)

* added optimization script and test, changed stuff

* fix test, improve docs

* re-add optimize-old-videos script

* added documentation

* Don't optimize videos without valid UUID, or redundancy videos

* move getUUIDFromFilename

* fix tests?

* update torrent and file size, some more fixes/improvements

* use higher bitrate for high fps video, adjust bitrates

* add test video

* don't throw error if resolution is undefined

* generate test fixture on the fly

* use random noise video for bitrate test, add promise

* shorten test video to avoid timeout

* use existing function to optimize video

* various fixes

* increase test timeout

* limit test fixture size, add link

* test fixes

* add await

* more test fixes, add -b:v parameter

* replace ffmpeg wiki link

* fix ffmpeg params

* fix unit test

* add test fixture to .gitgnore

* add video transcoding fps model

* add missing file
This commit is contained in:
Felix Ableitner 2018-10-08 09:26:04 -05:00 committed by Chocobozzz
parent 2cae5f1307
commit edb4ffc7e0
16 changed files with 221 additions and 26 deletions

View file

@ -5,6 +5,7 @@ import { VideoModel } from '../server/models/video/video'
import { initDatabaseModels } from '../server/initializers'
import { remove, readdir } from 'fs-extra'
import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy'
import { getUUIDFromFilename } from '../server/helpers/utils'
run()
.then(() => process.exit(0))
@ -82,15 +83,6 @@ async function pruneDirectory (directory: string, onlyOwned = false) {
return toDelete
}
function getUUIDFromFilename (filename: string) {
const regex = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
const result = filename.match(regex)
if (!result || Array.isArray(result) === false) return null
return result[0]
}
async function askConfirmation () {
return new Promise((res, rej) => {
prompt.start()