I am writing a Node script which copies and re-tags some of my MP4 files using fluent-ffmpeg
It doesn't work with any metadata that contains spaces. The code that does the copying/tagging looks something like this:
const ffmpeg = require('fluent-ffmpeg');
const inputFilename = 'path/to/original.m4a';
const outputFilename = 'path/to/new.m4a';
const options = [
'-metadata', 'artist=Someone',
'-metadata', 'album=Some title',
// ...etc
];
ffmpeg(inputFilename)
.outputOptions(options)
.saveToFile(outputFilename);
This results in an error:
events.js:183
throw er; // Unhandled 'error' event
An error occurred: ffmpeg exited with code 1: title: Invalid argument
I have tried putting Some title
in single quotes, double quotes and no quotes. I have tried escaping the spaces in it. I have tried passing the options array as single options rather than tuples, for example: '-metadata album="Some title"'
- but whatever I try, it still throws an error when there are spaces.
(It may be relevant to note that this is on Windows)
Can anyone suggest a way of getting it to work?