aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-17 13:10:58 +0200
committerChocobozzz <me@florianbigard.com>2018-10-17 13:10:58 +0200
commit0229b014e0101844df028342b8d4dd9ae4e887a4 (patch)
tree5c42c40499e4298ee241203c8e055dbbd9438739 /server
parentf365e978ed08e8fc7adf0607271c4071915629ee (diff)
downloadPeerTube-0229b014e0101844df028342b8d4dd9ae4e887a4.tar.gz
PeerTube-0229b014e0101844df028342b8d4dd9ae4e887a4.tar.zst
PeerTube-0229b014e0101844df028342b8d4dd9ae4e887a4.zip
Fix tests
Diffstat (limited to 'server')
-rw-r--r--server/helpers/ffmpeg-utils.ts16
-rw-r--r--server/models/account/user.ts1
2 files changed, 10 insertions, 7 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts
index 17f35fe8d..a53a7bae4 100644
--- a/server/helpers/ffmpeg-utils.ts
+++ b/server/helpers/ffmpeg-utils.ts
@@ -118,11 +118,13 @@ function transcode (options: TranscodeOptions) {
118 return new Promise<void>(async (res, rej) => { 118 return new Promise<void>(async (res, rej) => {
119 let fps = await getVideoFileFPS(options.inputPath) 119 let fps = await getVideoFileFPS(options.inputPath)
120 // On small/medium resolutions, limit FPS 120 // On small/medium resolutions, limit FPS
121 if (options.resolution !== undefined && 121 // if (
122 options.resolution < VIDEO_TRANSCODING_FPS.KEEP_ORIGIN_FPS_RESOLUTION_MIN && 122 // options.resolution !== undefined &&
123 fps > VIDEO_TRANSCODING_FPS.AVERAGE) { 123 // options.resolution < VIDEO_TRANSCODING_FPS.KEEP_ORIGIN_FPS_RESOLUTION_MIN &&
124 fps = VIDEO_TRANSCODING_FPS.AVERAGE 124 // fps > VIDEO_TRANSCODING_FPS.AVERAGE
125 } 125 // ) {
126 // fps = VIDEO_TRANSCODING_FPS.AVERAGE
127 // }
126 128
127 let command = ffmpeg(options.inputPath, { niceness: FFMPEG_NICE.TRANSCODING }) 129 let command = ffmpeg(options.inputPath, { niceness: FFMPEG_NICE.TRANSCODING })
128 .output(options.outputPath) 130 .output(options.outputPath)
@@ -321,12 +323,12 @@ async function presetH264 (ffmpeg: ffmpeg, resolution: VideoResolution, fps: num
321 // https://slhck.info/video/2017/03/01/rate-control.html 323 // https://slhck.info/video/2017/03/01/rate-control.html
322 // https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate 324 // https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate
323 const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS) 325 const targetBitrate = getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS)
324 localFfmpeg.outputOptions([`-maxrate ${ targetBitrate }`, `-bufsize ${ targetBitrate * 2 }`]) 326 localFfmpeg = localFfmpeg.outputOptions([`-maxrate ${ targetBitrate }`, `-bufsize ${ targetBitrate * 2 }`])
325 327
326 // Keyframe interval of 2 seconds for faster seeking and resolution switching. 328 // Keyframe interval of 2 seconds for faster seeking and resolution switching.
327 // https://streaminglearningcenter.com/blogs/whats-the-right-keyframe-interval.html 329 // https://streaminglearningcenter.com/blogs/whats-the-right-keyframe-interval.html
328 // https://superuser.com/a/908325 330 // https://superuser.com/a/908325
329 localFfmpeg.outputOption(`-g ${ fps * 2 }`) 331 localFfmpeg = localFfmpeg.outputOption(`-g ${ fps * 2 }`)
330 332
331 return localFfmpeg 333 return localFfmpeg
332} 334}
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 4b4a562fa..34aafa1a7 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -109,6 +109,7 @@ export class UserModel extends Model<UserModel> {
109 nsfwPolicy: NSFWPolicyType 109 nsfwPolicy: NSFWPolicyType
110 110
111 @AllowNull(false) 111 @AllowNull(false)
112 @Default(true)
112 @Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled')) 113 @Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled'))
113 @Column 114 @Column
114 webTorrentEnabled: boolean 115 webTorrentEnabled: boolean