From 7f406908200ad12ad2c92912808f6b5efa1fd61f Mon Sep 17 00:00:00 2001 From: knotteye Date: Fri, 8 Jan 2021 17:14:16 -0600 Subject: [PATCH 01/15] Update repository link --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f11f66b..d33fe2c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "repository": { "type": "git", - "url": "https://gitlab.com/knotteye/satyr.git" + "url": "https://git.waldn.net/git/knotteye/satyr.git" }, "dependencies": { "bcrypt": "^5.0.0", From a1a101c0f19fc1cae45c935d32f2d229f2cd58f3 Mon Sep 17 00:00:00 2001 From: knotteye Date: Fri, 8 Jan 2021 17:25:44 -0600 Subject: [PATCH 02/15] Check if the video object still exists before restarting the timeout --- site/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/site/index.js b/site/index.js index 3cb75d7..56ad90c 100644 --- a/site/index.js +++ b/site/index.js @@ -102,12 +102,15 @@ async function render(path, s){ //root case "/": render('/users/live'); + modifyLinks(); break; case "": render('/users/live'); + modifyLinks(); break; case "/index.html": render('/users/live'); + modifyLinks(); break; //404 default: @@ -215,7 +218,8 @@ async function initPlayer(usr) { onError(e); } } else { - setTimeout(initPlayer, 5000, usr); + if(document.getElementById('video') !== null) + setTimeout(initPlayer, 5000, usr); } } From 5c22c1a73805c1087942eb0bc1b655ea68de8912 Mon Sep 17 00:00:00 2001 From: knotteye Date: Sat, 9 Jan 2021 15:22:23 -0600 Subject: [PATCH 03/15] Add migration script for channel bans table in the database. --- src/db/3.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/db/3.ts diff --git a/src/db/3.ts b/src/db/3.ts new file mode 100644 index 0000000..7037fa7 --- /dev/null +++ b/src/db/3.ts @@ -0,0 +1,9 @@ +import * as db from "../database"; + +async function run () { + await db.query('CREATE TABLE IF NOT EXISTS ch_bans(channel VARCHAR(25), target VARCHAR(45), time BIGINT, length INT DEFAULT 30)'); + await db.query('INSERT INTO ch_bans(channel) SELECT username FROM users'); + await db.query('INSERT INTO db_meta (version) VALUES (3)'); +} + +export { run } \ No newline at end of file From 57410dc969b81b352ea5e35fe79c003cffededdd Mon Sep 17 00:00:00 2001 From: knotteye Date: Sat, 9 Jan 2021 15:25:06 -0600 Subject: [PATCH 04/15] Update database functions to create and destroy rows in new table. --- src/database.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/database.ts b/src/database.ts index 0d733e7..05a572a 100644 --- a/src/database.ts +++ b/src/database.ts @@ -30,6 +30,7 @@ async function addUser(name: string, password: string){ await query('INSERT INTO user_meta (username, title, about, live) VALUES ('+raw.escape(name)+',\'\',\'\',false)'); await query('INSERT INTO chat_integration (username, irc, xmpp, twitch, discord) VALUES ('+raw.escape(name)+',\'\',\'\',\'\',\'\')'); await query('INSERT INTO twitch_mirror (username) VALUES ('+raw.escape(name)+')'); + await query('INSERT INTO ch_bans(channel) VALUES ('+raw.escape(name)+')'); return true; } @@ -40,6 +41,7 @@ async function rmUser(name: string){ await query('delete from user_meta where username='+raw.escape(name)+' limit 1'); await query('delete from chat_integration where username='+raw.escape(name)+' limit 1'); await query('delete from twitch_mirror where username='+raw.escape(name)+' limit 1'); + await query('delete from ch_bans where username='+raw.escape(name)+' limit 1'); return true; } From a882285bacd2ee53edd09bbeb0f3563d00a1004e Mon Sep 17 00:00:00 2001 From: knotteye Date: Sun, 10 Jan 2021 10:13:29 -0600 Subject: [PATCH 05/15] Fix database functions regarding ch_bans since it's a special case --- src/database.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/database.ts b/src/database.ts index 05a572a..8b1bfda 100644 --- a/src/database.ts +++ b/src/database.ts @@ -30,7 +30,6 @@ async function addUser(name: string, password: string){ await query('INSERT INTO user_meta (username, title, about, live) VALUES ('+raw.escape(name)+',\'\',\'\',false)'); await query('INSERT INTO chat_integration (username, irc, xmpp, twitch, discord) VALUES ('+raw.escape(name)+',\'\',\'\',\'\',\'\')'); await query('INSERT INTO twitch_mirror (username) VALUES ('+raw.escape(name)+')'); - await query('INSERT INTO ch_bans(channel) VALUES ('+raw.escape(name)+')'); return true; } @@ -41,7 +40,7 @@ async function rmUser(name: string){ await query('delete from user_meta where username='+raw.escape(name)+' limit 1'); await query('delete from chat_integration where username='+raw.escape(name)+' limit 1'); await query('delete from twitch_mirror where username='+raw.escape(name)+' limit 1'); - await query('delete from ch_bans where username='+raw.escape(name)+' limit 1'); + await query('delete from ch_bans where channel='+raw.escape(name)); return true; } From 814d826ec9e2f0f54926a5eabf93b993be048d3f Mon Sep 17 00:00:00 2001 From: knotteye Date: Sun, 10 Jan 2021 11:01:28 -0600 Subject: [PATCH 06/15] Modify the migration script to import existing data. --- package-lock.json | 8 ++++---- package.json | 1 + src/db/3.ts | 16 ++++++++++++++-- src/v3manual.ts | 6 ++++++ 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 src/v3manual.ts diff --git a/package-lock.json b/package-lock.json index 813819b..d816fbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "satyr", - "version": "0.10.1", + "version": "0.10.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1110,9 +1110,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "ipaddr.js": { "version": "1.9.0", diff --git a/package.json b/package.json index d33fe2c..a97c46d 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "setup": "sh install/setup.sh", "migrate": "ts-node src/migrate.ts", "invite": "ts-node src/cli.ts --invite", + "v3-manual": "ts-node src/v3manual.ts", "make-templates": "nunjucks-precompile -i [\"\\.html$\",\"\\.njk$\"] templates > site/templates.js" }, "repository": { diff --git a/src/db/3.ts b/src/db/3.ts index 7037fa7..1606c57 100644 --- a/src/db/3.ts +++ b/src/db/3.ts @@ -1,9 +1,21 @@ import * as db from "../database"; +import * as dirty from "dirty"; async function run () { await db.query('CREATE TABLE IF NOT EXISTS ch_bans(channel VARCHAR(25), target VARCHAR(45), time BIGINT, length INT DEFAULT 30)'); - await db.query('INSERT INTO ch_bans(channel) SELECT username FROM users'); - await db.query('INSERT INTO db_meta (version) VALUES (3)'); + console.log('!!! This migration has a race condition when run from the `npm run migrate` command. If thats how this was called, please re-run this migration manually.\n!!! Run `npm run v3-manual` to do so'); + var bansdb = new dirty('./config/bans.db') + bansdb.on('load', async () => { + bansdb.forEach(async (key, val) => { + let ips = Object.keys(val); + for(var i=0;i Date: Sun, 10 Jan 2021 11:26:52 -0600 Subject: [PATCH 07/15] Fix a bug where we weren't setting X-Auth-As on /api/register Also fix new users appearing to not exist until they update their bio/profile --- src/database.ts | 2 +- src/http.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/database.ts b/src/database.ts index 8b1bfda..7a95310 100644 --- a/src/database.ts +++ b/src/database.ts @@ -27,7 +27,7 @@ async function addUser(name: string, password: string){ let dupe = await query('select * from users where username='+raw.escape(name)); if(dupe[0]) return false; await query('INSERT INTO users (username, password_hash, stream_key, record_flag) VALUES ('+raw.escape(name)+', '+raw.escape(hash)+', '+raw.escape(key)+', 0)'); - await query('INSERT INTO user_meta (username, title, about, live) VALUES ('+raw.escape(name)+',\'\',\'\',false)'); + await query('INSERT INTO user_meta (username, title, about, live) VALUES ('+raw.escape(name)+',\' \',\' \',false)'); await query('INSERT INTO chat_integration (username, irc, xmpp, twitch, discord) VALUES ('+raw.escape(name)+',\'\',\'\',\'\',\'\')'); await query('INSERT INTO twitch_mirror (username) VALUES ('+raw.escape(name)+')'); return true; diff --git a/src/http.ts b/src/http.ts index b06cef1..a331a9a 100644 --- a/src/http.ts +++ b/src/http.ts @@ -254,6 +254,7 @@ async function initAPI() { api.register(req.body.username, req.body.password, req.body.confirm, true).then((result) => { if(result[0]) return genToken(req.body.username).then((t) => { res.cookie('Authorization', t, {maxAge: 604800000, httpOnly: true, sameSite: 'Lax'}); + res.cookie('X-Auth-As', req.body.username, {maxAge: 604800000, httpOnly: false, sameSite: 'Lax'}) res.json(result); api.useInvite(req.body.invite); return; @@ -268,6 +269,7 @@ async function initAPI() { api.register(req.body.username, req.body.password, req.body.confirm).then( (result) => { if(result[0]) return genToken(req.body.username).then((t) => { res.cookie('Authorization', t, {maxAge: 604800000, httpOnly: true, sameSite: 'Lax'}); + res.cookie('X-Auth-As', req.body.username, {maxAge: 604800000, httpOnly: false, sameSite: 'Lax'}) res.json(result); return; }); From 69d81ec836bbfc2693bf5bae797f0f9f344234fd Mon Sep 17 00:00:00 2001 From: knotteye Date: Sun, 10 Jan 2021 12:31:11 -0600 Subject: [PATCH 08/15] Switch to using MySQL instead of bans.db --- src/http.ts | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/http.ts b/src/http.ts index a331a9a..3bc1753 100644 --- a/src/http.ts +++ b/src/http.ts @@ -17,7 +17,6 @@ const app = express(); const server = http.createServer(app); const io = socketio(server); const store = dirty(); -var banlist; var jwkey; try{ jwkey = JWK.asKey(readFileSync('./config/jwt.pem')); @@ -77,7 +76,7 @@ async function init(){ else res.status(404).render('404.njk', njkconf); //res.status(404).render('404.njk', njkconf); }); - banlist = new dirty('./config/bans.db').on('load', () => {initChat()}); + await initChat(); server.listen(config['http']['port']); } @@ -591,9 +590,10 @@ async function initChat() { socket.on('JOINROOM', async (data) => { let t: any = await db.query('select username from users where username='+db.raw.escape(data)); if(t[0]){ - if(banlist.get(data) && banlist.get(data)[socket['handshake']['address']]){ - if(Math.floor(banlist.get(data)[socket['handshake']['address']]['time'] + (banlist.get(data)[socket['handshake']['address']]['length'] * 60)) < Math.floor(Date.now() / 1000)){ - banlist.set(data, Object.assign({}, banlist.get(data), {[socket['handshake']['address']]: null})); + let b = await db.query('select * from ch_bans where target='+db.raw.escape(socket['handshake']['address'])+' and channel='+db.raw.escape(data)); + if(b[0]){ + if(Math.floor(b[0].time + (b[0].length * 60)) < Math.floor(Date.now() / 1000)){ + await db.query('delete from ch_bans where target='+db.raw.escape(b[0].target)+'and channel='+db.raw.escape(b[0].channel)+' and time='+db.raw.escape(b[0].time)+' and length='+db.raw.escape(b[0].length)); } else { socket.emit('ALERT', 'You are banned from that room'); @@ -682,23 +682,27 @@ async function initChat() { } else socket.emit('ALERT', 'Not authorized to do that.'); }); - socket.on('BAN', (data: Object) => { + socket.on('BAN', async (data: Object) => { if(socket.nick === data['room']){ let id: string = store.get(data['nick']); if(id){ if(Array.isArray(id)) { for(let i=0;i { + socket.on('UNBAN', async (data: Object) => { if(socket.nick === data['room']){ - if(banlist.get(data['room']) && banlist.get(data['room'])[data['ip']]){ - banlist.set(data['room'], Object.assign({}, banlist.get(data['room']), {[data['ip']]: null})); + let b = await db.query('select * from ch_bans where channel='+db.raw.escape(data['room'])+' and target='+db.raw.escape(data['ip'])); + if(b[0]){ + await db.query('delete from ch_bans where channel='+db.raw.escape(data['room'])+' and target='+db.raw.escape(data['ip'])); socket.emit('ALERT', data['ip']+' was unbanned.'); } else @@ -717,13 +722,13 @@ async function initChat() { } else socket.emit('ALERT', 'Not authorized to do that.'); }); - socket.on('LISTBAN', (data: Object) => { + socket.on('LISTBAN', async (data: Object) => { if(socket.nick === data['room']){ - if(banlist.get(data['room'])) { - let bans = Object.keys(banlist.get(data['room'])); + let b = await db.query('select target from ch_bans where channel='+db.raw.escape(data['room'])); + if(b[0]) { let str = ''; - for(let i=0;i Date: Sun, 8 Nov 2020 23:12:24 -0600 Subject: [PATCH 09/15] Start work on hardware acceleration. Documentation first, code later. --- docs/CONFIGURATION.md | 11 ++++---- docs/HWACCEL.md | 53 ++++++++++++++++++++++++++++++++++++++ install/config.example.yml | 4 +++ 3 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 docs/HWACCEL.md diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 839492d..4af0580 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -38,17 +38,16 @@ transcode: # satyr will generate one source quality variant, and the remaining # variants will be of incrementally lower quality and bitrate +# having more than 4-5 variants will start giving diminishing returns on stream quality for cpu load +# if you can't afford to generate at least 3 variants, it's recommended to leave adaptive streaming off + inputflags: "" # additional flags to apply to the input during transcoding outputflags: "" # additional flags to apply to the output during transcoding -# hardware acceleration is a bit difficult to configure programmatically -# this is a good place to do so for your system -# https://trac.ffmpeg.org/wiki/HWAccelIntro is a good place to start - -# having more than 4-5 variants will start giving diminishing returns on stream quality for cpu load -# if you can't afford to generate at least 3 variants, it's recommended to leave adaptive streaming off +hwaccel: +# See HWACCEL.md for information on configuring hardware acceleration. crypto: saltRounds: 12 diff --git a/docs/HWACCEL.md b/docs/HWACCEL.md new file mode 100644 index 0000000..f5595f3 --- /dev/null +++ b/docs/HWACCEL.md @@ -0,0 +1,53 @@ +## Configuration Hardware Acceleration +Satyr supports the NVENC and VA-API hardware acceleration APIs. If you've configured your system correctly (the hard part) it should be enough to set the type and use the default device setting if you only have one hardware acceleration device. + +### System +Configuring the system for any hardware acceleration API involves three main steps: selecting the right drivers, installing the API libraries, and configuring ffmpeg. + +#### NVENC +NVENC in ffmpeg can work with either open-source drivers (nouvea) or nvidia's proprietary drivers. The documentation for your distribution should have instructions for installing these. + +The only system library you should need is the CUDA toolkit, general named cudatoolkit, nvidia-cuda-toolkit, or some variation in your system repositories. +You can also try installing manually from [here](https://developer.nvidia.com/cuda-downloads). + +Most binary distributions provide a version of ffmpeg with NVENC already enabled. If not you can try compiling ffmpeg from source with the `--enable-nvenc` flag. If you use a source based distribution you should be familiar with enabling optional compile flags. + +You can verify that ffmpeg has been set up correctly by checking the output of `ffmpeg -hide_banner -hwaccels | grep cuvid` and `ffmpeg -hide_banner -encoders | grep nvenc`. If you don't see anything, something is wrong. + +#### VA-API +VA-API is an extremely generic API. Although the package names might be different in your distribution, the arch wiki page for hardware acceleration has good information on [driver selection](https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Installation) and [verifying](https://wiki.archlinux.org/index.php/Hardware_video_acceleration#Verifying_VA-API) a VA-API install for a wide range of devices. + +Regardless of driver selection, you will also need libva or the equivalent from your distrubtion, and libva-utils can be helpful as well. + +Most binary distributions provide a version of ffmpeg with VA-API already enabled. If not you can try compiling ffmpeg from source with the `--enable-vaapi` flag. If you use a source based distribution you should be familiar with enabling optional compile flags. + +You can verify that ffmpeg has been set up correctly by checking the output of `ffmpeg -hide_banner -hwaccels | grep vaapi` and `ffmpeg -hide_banner -encoders | grep vaapi`. If you don't see anything, something is wrong. + +### Satyr +``` +# Decoding +hwaccel: +# Enable hardware acceleration for decoding as well as encoding. +# Probably not worth it, hardware decoding won't be any faster compared to software on a vaguely modern CPU +# Hardware decoding also may not support the input format, in which case transcoding will fail + decode: true + +# Only supported for VA-API +# Fall back to software decoding if hardware decoding fails +hwaccel: + decode: 'fallback' + + +# NVENC +hwaccel: + type: 'nvenc' +# device is optional for nvenc + device: 0 +# nvenc wants a device number instead of a path, set to null to disable + +# VA-API +hwaccel: + type: 'vaapi' +# device is mandatory for va-api + device: '/dev/dri/renderD128' +``` \ No newline at end of file diff --git a/install/config.example.yml b/install/config.example.yml index 4ea6987..2e81225 100644 --- a/install/config.example.yml +++ b/install/config.example.yml @@ -32,6 +32,10 @@ transcode: #unused right now, will always transcode to dash format: dash +hwaccel: + # see docs/HWACCEL.md for instructions on configuring hardware acceleration + type: null + chat: irc: From 9df4b545ec7ac13919ac9013c4521016fbab8c40 Mon Sep 17 00:00:00 2001 From: knotteye Date: Sun, 10 Jan 2021 13:42:12 -0600 Subject: [PATCH 10/15] Update config.ts to include hwaccel options --- src/config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/config.ts b/src/config.ts index 4c641a4..50669e4 100644 --- a/src/config.ts +++ b/src/config.ts @@ -39,6 +39,11 @@ const config: Object = { connectionTimeout: '1000', insecureAuth: false, debug: false }, localconfig['database']), + hwaccel: Object.assign({ + type: null, + device: null, + decode: false + }, localconfig['hwaccel']), rtmp: Object.assign({ cluster: false, port: 1935, From 1afd855e73655184536d44c12e396045ebadde79 Mon Sep 17 00:00:00 2001 From: knotteye Date: Sun, 10 Jan 2021 13:42:23 -0600 Subject: [PATCH 11/15] Clarify some documentation --- docs/HWACCEL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/HWACCEL.md b/docs/HWACCEL.md index f5595f3..748a7d7 100644 --- a/docs/HWACCEL.md +++ b/docs/HWACCEL.md @@ -43,7 +43,7 @@ hwaccel: type: 'nvenc' # device is optional for nvenc device: 0 -# nvenc wants a device number instead of a path, set to null to disable +# nvenc wants a device number instead of a path, set to null to use the default # VA-API hwaccel: From 943c71d1e050a613e8af156c5e36f90162150081 Mon Sep 17 00:00:00 2001 From: knotteye Date: Sun, 10 Jan 2021 13:42:52 -0600 Subject: [PATCH 12/15] Add what I think is working hwaccel support --- src/server.ts | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/server.ts b/src/server.ts index dd60538..2406eca 100644 --- a/src/server.ts +++ b/src/server.ts @@ -42,9 +42,10 @@ function init () { if(session.audioCodec !== 0 && session.videoCodec !== 0){ transCommand(results[0].username, key).then((r) => { execFile(config['media']['ffmpeg'], r, {maxBuffer: Infinity}, (err, stdout, stderr) => { - /*console.log(err); - console.log(stdout); - console.log(stderr);*/ + //console.log(r); + //console.log(err); + //console.log(stdout); + //console.log(stderr); }); }); break; @@ -126,29 +127,49 @@ function init () { async function transCommand(user: string, key: string): Promise{ let args: string[] = ['-loglevel', 'fatal', '-y']; + let vcodec: string = 'libx264'; + if(config['hwaccel']['type'] === 'nvenc'){ + vcodec = 'h264_nvenc'; + if(config['hwaccel']['decode']){ + args = args.concat(['-hwaccel', 'cuda']); + if(config['hwaccel']['device']) + args = args.concat(['-hwaccel_device', config['hwaccel']['device']]); + args = args.concat(['-hwaccel_output_format', 'cuda']); + } + } + else if (config['hwaccel']['type'] === 'vaapi') { + vcodec = 'h264_vaapi'; + if(config['hwaccel']['decode'] === 'fallback'){ + args = args.concat('init_hw_device', 'vaapi=foo:'+config['hwaccel']['device'], '-hwaccel vaapi', '-hwaccel_output_format', 'vaapi', '-hwaccel_device', 'foo'); + } else if (config['hwaccel']['decode']) { + args = args.concat(['-hwaccel', 'vaapi', '-hwaccel_output_format', 'vaapi', '-vaapi_device', config['hwaccel']['device']]); + } + } if(config['transcode']['inputflags'] !== null && config['transcode']['inputflags'] !== "") args = args.concat(config['transcode']['inputflags'].split(" ")); args = args.concat(['-i', 'rtmp://127.0.0.1:'+config['rtmp']['port']+'/'+config['media']['privateEndpoint']+'/'+key, '-movflags', '+faststart']); if(config['transcode']['adaptive']===true && config['transcode']['variants'] > 1) { for(let i=0;i 51 ? 51 : Math.floor(18 + (i * 7)); args = args.concat(['-crf:'+i, ''+crf]); } for(let i=1;i Date: Sun, 10 Jan 2021 14:29:54 -0600 Subject: [PATCH 13/15] Map streams automatically instead of manually --- src/server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.ts b/src/server.ts index 2406eca..b48ed12 100644 --- a/src/server.ts +++ b/src/server.ts @@ -149,9 +149,9 @@ async function transCommand(user: string, key: string): Promise{ args = args.concat(['-i', 'rtmp://127.0.0.1:'+config['rtmp']['port']+'/'+config['media']['privateEndpoint']+'/'+key, '-movflags', '+faststart']); if(config['transcode']['adaptive']===true && config['transcode']['variants'] > 1) { for(let i=0;i Date: Sun, 10 Jan 2021 15:09:42 -0600 Subject: [PATCH 14/15] Disable CRF when using hwaccel --- src/server.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server.ts b/src/server.ts index b48ed12..1546a86 100644 --- a/src/server.ts +++ b/src/server.ts @@ -155,9 +155,11 @@ async function transCommand(user: string, key: string): Promise{ for(let i=1;i 51 ? 51 : Math.floor(18 + (i * 7)); - args = args.concat(['-crf:'+i, ''+crf]); + if(!config['hwaccel']['type']){ + for(let i=1;i 51 ? 51 : Math.floor(18 + (i * 7)); + args = args.concat(['-crf:'+i, ''+crf]); + } } for(let i=1;i Date: Sun, 10 Jan 2021 15:20:45 -0600 Subject: [PATCH 15/15] Update documentation with hwaccleration issues --- install/config.example.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/install/config.example.yml b/install/config.example.yml index 2e81225..67e578c 100644 --- a/install/config.example.yml +++ b/install/config.example.yml @@ -28,6 +28,7 @@ database: transcode: #may result in higher latency if your cpu can't keep up adaptive: false + #more than 3 might cause problems when using hwacceleration variants: 3 #unused right now, will always transcode to dash format: dash