Anna K.
Anna K.

Reputation: 1995

nodejs adding double quotes to command arguments?

Example:

ffmpeg -i test.mkv -metadata title="Test 123" -c copy temp.mkv

ffmpeg sees ""Test 123"". It happens with spawn() and execFile()

If I run the same command in the windows shell ffmpeg sees it correctly as "Test 123"

So what's up with nodejs?

Here's the nodejs code:

var process = spawn('ffmpeg', [
  '-i',
  inFile,
  '-metadata',
  'title="Test 123"',     
  '-c',
  'copy',
  outFile
]);

Upvotes: 2

Views: 3772

Answers (1)

eljefedelrodeodeljefe
eljefedelrodeodeljefe

Reputation: 6791

You just need to switch to "title='Test 123'" since double quotes have precedence over single quotes. Your stdin should then just parse it right to title="Test 123".

Upvotes: 4

Related Questions