I'm trying to set some metadata using output options but I'm running into some issues.
In shell, I do it like this:
ffmpeg -i input.mp3 -y -codec copy -metadata title="song x" output.mp3
It works fine and in iTunes, the title is song x
Now, with node-fluent-ffmpeg:
ffmpeg('input.mp3')
.outputOptions('-codec copy')
.outputOptions('-metadata title="song x"')
.save('output.mp3')
.on('start', function(cmdline) {
console.log('Command line: ' + cmdline);
})
In console I get this command line:
ffmpeg -i input.mp3 -y -codec copy -metadata title="song x" output.mp3
which works fine on shell, but I get this error in node:
ffmpeg exited with code 1: Unrecognized option \'metadata title="song x"\'.\nError splitting the argument list: Option not found\n',
stack: 'Error: ffmpeg exited with code 1: Unrecognized option \'metadata title="song x"\'.\nError splitting the argument list: Option not found\n\n at ChildProcess.<anonymous> (/path/to/node_project/node_modules/fluent-ffmpeg/lib/processor.js:167:22)\n at ChildProcess.EventEmitter.emit (events.js:98:17)\n at Process.ChildProcess._handle.onexit (child_process.js:797:12)
If I remove the space in the metadata like this:
ffmpeg('input.mp3')
.outputOptions('-codec copy')
.outputOptions('-metadata title="songx"')
.save('output.mp3')
.on('start', function(cmdline) {
console.log('Command line: ' + cmdline);
})
It works without error, but in iTunes I get the title as "songx" with quotes instead of just songx
So there are two issues:
I don't think there's an issue with quotes here. outputOptions and similar methods support the "-option parameter" syntax for simple cases, but for more complex cases (ie. spaces in parameters) you should pass them separately:
ffmpeg('input.mp3')
.outputOptions('-metadata', 'title="song x"');
Tell me if you still have problems with this syntax.
Yup that solved the spaces problem.
For the quotes, I just omitted them .outputOptions('-metadata', 'title=song x')
Thanks for the help :)
Most helpful comment
I don't think there's an issue with quotes here.
outputOptionsand similar methods support the"-option parameter"syntax for simple cases, but for more complex cases (ie. spaces in parameters) you should pass them separately:Tell me if you still have problems with this syntax.