Here is a simplified version of the powershell script I'm trying to write to join some .mp4 files:
[string]$inputs = ""
$filenames = "input1.mp4", "input2.mp4", "input3.mp4"
foreach ($f in $filenames) {
$inputs += "-i $f "
}
Write-Host $inputs
.\bin\ffmpeg.exe $inputs -filter_complex...
The write-host
prints out the string like I expect, but then ffmpeg gives me an error that says:
Unrecognized option 'i input1.mp4 -i input2.mp4 -i input3.mp4 '. Error splitting the argument list: Option not found
So it looks like when the arguments are being passed to cmd.exe to be passed to ffmpeg, something is getting lost (at least that's how I think it works). I've read other questions that talk about problems with passing double-quotes in arguments, but my problem is with -
. Can someone explain what is going in my case? I don't think it's an escaping issue since the second and third -
look like they're being passed. Also, if I just use start-process
with the -argumentList
option (and prepare one big $arguments
string beforehand) then everything works.