Open Hassnain243A opened 3 years ago
var fs = require('fs')
var ffmpeg = require('ffmpeg.js/ffmpeg-mp4')
const audioPath = './res/433834921.mp3'`
const videoPath = './res/433834921.mp4'
const resultPath = './result/433834921.mp4'
const audioData = new Uint8Array(fs.readFileSync(audioPath))
const videoData = new Uint8Array(fs.readFileSync(videoPath))
// ffmpeg -i input.flv -i input.mp3 -c:v copy -c:a aac -strict experimental output.mp4
const result = ffmpeg({
MEMFS: [{name: '433834921.mp3', data: audioData}, {name: '433834921.mp4', data: videoData}],
arguments: ["-i", "433834921.mp3", "-i", "433834921.mp4", "-c:v", "copy", "-c:a", "aac", "-strict", "experimental", "out.mp4"],
})
const out = result.MEMFS[0];
fs.writeFileSync(resultPath, Buffer(out.data))
I need to merge mp3 to mp4 in the browser with js. Is there any documentation here for that?