c# - Powershell script finishes after the first ffmpeg call -
the following powershell script executes first ffmpeg call, no matter 1 first. both ffmpeg , powershell processes never finish. stopping server, however, leads processes finishing , second picture appears.
param($inputfile, $outputfile, $thumbnail, $sprites) $thumbnailwidth = 120 $thumbnailheight = 120 # thumbnail ffmpeg -i $inputfile -f image2 -vframes 1 -filter:v "crop=min(iw\,ih):min(iw\,ih), scale=$($thumbnailwidth):$($thumbnailheight)" -crf 18 "$($thumbnail)\150x150.png" # poster ffmpeg -i $inputfile -f image2 -vframes 1 -filter:v "crop=min(iw\,ih):min(iw\,ih), scale=$($posterwidth):$($posterheight)" -crf 18 "$($thumbnail)\1000x1000.png"
the script gets called within asp.net application follows:
processstartinfo startinfo = new processstartinfo(); startinfo.filename = "powershell.exe"; startinfo.arguments = string.format("-executionpolicy remotesigned -file \"{0}\" \"{1}\" \"{2}\" \"{3}\" \"{4}\"", scriptpath, fullpath, videopath, thumbnailpath, sprites); startinfo.redirectstandardoutput = true; startinfo.redirectstandarderror = true; startinfo.useshellexecute = false; startinfo.createnowindow = true; process process = new process(); process.startinfo = startinfo; process.enableraisingevents = true; process.exited += delegate { // cleaning }; process.start();
does have clue, why first 2 ffmpeg calls working, while each call seems correct?
adding process.standarderror.readtoend();
makes script finish expected, makes block, not acceptable.
Comments
Post a Comment