git ssb

5+

Matt McKegg / ferment



Tree: ce8c9a23510ffcaae086aac41d0d04be17ab0af0

Files: ce8c9a23510ffcaae086aac41d0d04be17ab0af0 / lib / convert.js

814 bytesRaw
1var ffmpeg = require('./exec-ffmpeg')
2
3module.exports = function (input, output, cb) {
4 ffmpeg([
5 '-i', input,
6 '-vn', // remove video if any
7 '-codec:a', 'libopus',
8 '-b:a', '128k', // this is just an average - opus uses VBR by default
9 output
10 ], cb)
11}
12
13module.exports.mp3 = function (input, output, cb) {
14 ffmpeg([
15 '-i', input,
16 '-vn', // remove video if any
17 '-codec:a', 'libmp3lame',
18 '-qscale:a', 7, // fairly low quality VBR, but this is just a fallback option
19 output
20 ], cb)
21}
22
23module.exports.export = function (input, output, cb) {
24 ffmpeg([
25 '-y', // overwrite existing file
26 '-i', input,
27 '-vn', // remove video if any
28 '-codec:a', 'libmp3lame',
29 '-qscale:a', 2, // High quality MP3 - since we're exporting from the opus version
30 output
31 ], cb)
32}
33

Built with git-ssb-web