-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new CRF option to control quality between 0 and 100%
- Loading branch information
Showing
7 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const assert = require('assert') | ||
const tape = require('tape') | ||
const ffargs = require('../../lib/video/ffargs') | ||
|
||
tape('crf for h264', t => { | ||
// Full range is 0-51 (not linear) | ||
// 17 is already near lossless so we consider it to be 100% quality | ||
// https://trac.ffmpeg.org/wiki/Encode/H.264 | ||
assert.equal(ffargs.crf(0, 'h264'), 51) | ||
assert.equal(ffargs.crf(20, 'h264'), 44) | ||
assert.equal(ffargs.crf(50, 'h264'), 34) | ||
assert.equal(ffargs.crf(70, 'h264'), 27) | ||
assert.equal(ffargs.crf(100, 'h264'), 17) | ||
t.end() | ||
}) | ||
|
||
tape('crf for vpx', t => { | ||
// Full range is 0-63 (not linear) | ||
// 15 is already near lossless so we consider it to be 100% quality | ||
// https://trac.ffmpeg.org/wiki/Encode/VP9 | ||
assert.equal(ffargs.crf(0, 'vpx'), 63) | ||
assert.equal(ffargs.crf(20, 'vpx'), 53) | ||
assert.equal(ffargs.crf(50, 'vpx'), 39) | ||
assert.equal(ffargs.crf(80, 'vpx'), 24) | ||
assert.equal(ffargs.crf(100, 'vpx'), 15) | ||
t.end() | ||
}) |