-4

I need help putting two quotes round to strings in this line of code.

System.Diagnostics.Process.Start("CMD.exe", "\"/C ffmpeg -loop 1 -i input.png -i " + value + " -acodec libvo_aacenc -vcodec h264 -shortest " + value + ".mp4\"");

I am trying to pass two custom arguments to ffmpeg in CMD.exe, how ever if the file has spaces it fails and does nothing.

The way to fix this is to put two quotes around it like " + value + ", but that brings up a bunch of errors. I've tried things like "\"" + value + "\"" but it just brings up a ton of errors.

  • 2
    Specifically what errors are you getting. – juharr Dec 09 '14 at 20:04
  • Haven't tried, not sure the caveats to ffmpeg, but if ffmpeg actually doesn't want the arguments all in quotes (possibly breaks the switching), maybe: String.Format(@"/C ffmpeg -loop 1 -i input.png -i ""{0}"" -acodec libvo_aacenc -vcodec h264 -shortest ""{0}.mp4""", value); – Robert Dec 09 '14 at 20:09

1 Answers1

1

Please try:

System.Diagnostics.Process.Start("CMD.exe", "/C ffmpeg -loop 1 -i input.png -i \"" + value + "\" -acodec libvo_aacenc -vcodec h264 -shortest \"" + value + ".mp4\"");

And let me know if it works.

Pablo A. Revert
  • 356
  • 1
  • 6