I'm trying to write down a ffmetadata file from ffmpeg command
ffmpeg -i INPUT.mp4 -f ffmetadata FFMETADATAFILE
in Node.js:
var metadata = function (fpath, metadapath) {
var self = this;
var loglevel = self.logger.isDebug() ? 'debug' : 'error';
return new Promise((resolve, reject) => {
//ffmpeg -i INPUT.mp4 -f ffmetadata FFMETADATAFILE
const args = [
'-y',
'-loglevel', loglevel,
'-i', fpath,
'-f', 'ffmetadata',
metadapath
];
const opts = {
cwd: self._options.tempDir
};
if (self.logger.debug) self.logger.debug(args.join(" "))
cp.spawn('ffmpeg', args, opts)
.stderr.on('data', (data) => {
self.logger.debug(`${data}`);
})
.on('message', msg => self.logger.debug(msg))
.on('error', reject)
.on('close', resolve);
});
}
The logging has any error, and the process exits with 0, but any file is saved to metadapath. If I execute the command with the same parameters, it works ok:
ffmpeg -y -loglevel debug -i /path/input.mp3 -f ffmetadata /path/metdata.txt