-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluent-test-js
62 lines (58 loc) · 1.73 KB
/
fluent-test-js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const fs = require('fs');
const ffmpeg = require('fluent-ffmpeg');
const ffmpegStatic = require('ffmpeg-static');
ffmpeg.setFfmpegPath(ffmpegStatic);
// const inpStream = fs.createReadStream('./test.mp4');
// const outStream = fs.createWriteStream('./test.mp3');
// const albumCover = '/Users/bmaggi/Downloads/banana.jpg';
// ffmpeg(inpStream)
// .format('mp3')
// .audioBitrate(64)
// .on('error', (error, stdout, stderr) => {
// console.log('Cannot process video: ' + error.message, stdout, stderr);
// })
// .on('end', () => {
// console.log('Processing finished !');
// })
// .pipe(outStream, { end: true });
// .addOutputOptions(
// '-i',
// albumCover,
// '-map',
// '0:0',
// '-map',
// '1:0',
// '-c',
// 'copy',
// '-id3v2_version',
// '3',
// )
ffmpeg()
.input('/Users/bmaggi/myprj/musika/test.mp3')
.addInput('/Users/bmaggi/Downloads/cat.jpg')
.outputOption('-map', '0:0')
.outputOption('-map', '1:0')
.outputOption('-c', 'copy')
.outputOption('-id3v2_version', '3')
.outputOption('-metadata:s:v', 'title="Album cover"')
.outputOption('-metadata:s:v', 'comment="Cover (front)"')
.saveToFile('/Users/bmaggi/myprj/musika/cat-song.mp3');
// ffmpeg('./test.mp3')
// .addOutputOptions(
// '-i',
// '/Users/bmaggi/Downloads/banana.jpg',
// '-map',
// '0:0',
// '-map',
// '1:0',
// '-c',
// 'copy',
// '-id3v2_version',
// '3',
// '-metadata:s:v',
// 'title="Album cover"',
// '-metadata:s:v',
// 'comment="Cover (front)"',
// )
// .save('caca.mp3');
// ffmpeg -i test.mp3 -i /Users/bmaggi/Downloads/banana.jpg -map 0:0 -map 1:0 -codec copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" out.mp3