dylanhthomas / peat-media-converter

A windows app to prepare any video or animated gif to be analyzed by PEAT (Photosensitive Epilepsy Analysis Tool)
Creative Commons Zero v1.0 Universal
10 stars 0 forks source link

Getting Error: Command Failed & .... & was unexpected at this time. #7

Closed daffaromero closed 3 months ago

daffaromero commented 8 months ago

I seem to always be getting this error right here, no matter what I do.

Error: Command failed: & "C:\Users\{{USERNAME}}\AppData\Local\peat_media_converter\app-1.0.3\resources\app\bin\ffmpeg.exe" -i "[INPUT].mp4" -an -vcodec rawvideo -y -r 25 -hide_banner -loglevel error -vf scale=min(640\,iw):-1 "D:\converter_output\[OUTPUT]_converted.avi" && & "C:\Users\{{USERNAME}}\AppData\Local\peat_media_converter\app-1.0.3\resources\app\bin\ffs.exe" "D:\converter_output\[OUTPUT]_converted.avi" 1000000000 "D:\converter_output" & was unexpected at this time.

Could the error stem from the fact that chaining commands with && is not supported in Windows PowerShell? As a note, running ffmpeg commands through Windows PowerShell and CMD works fine. Though I did have to change && to ;.

OS: Windows 11 Home 22H2 Release version: 1.0.3

Appreciate any input! Splendid program you've built here.

dylanhthomas commented 8 months ago

Thank you for letting me know, I’m not sure why it works on some windows installations and not others, but this could be a way of making it more reliable. I can push an update in a couple of days, unless you’re desperate for it this weekend. On Feb 10, 2024, at 5:14 AM, Daffa Muhammad Romero @.***> wrote: I seem to always be getting this error right here, no matter what I do. Error: Command failed: & "C:\Users{{USERNAME}}\AppData\Local\peat_media_converter\app-1.0.3\resources\app\bin\ffmpeg.exe" -i "[INPUT].mp4" -an -vcodec rawvideo -y -r 25 -hide_banner -loglevel error -vf scale=min(640\,iw):-1 "D:\converter_output[OUTPUT]_converted.avi" && & "C:\Users{{USERNAME}}\AppData\Local\peat_media_converter\app-1.0.3\resources\app\bin\ffs.exe" "D:\converter_output[OUTPUT]_converted.avi" 1000000000 "D:\converter_output" & was unexpected at this time.

Could the error stem from the fact that chaining commands with && is not supported in Windows PowerShell? As a note, running ffmpeg commands through Windows PowerShell and CMD works fine. Though I did have to change && to ;. OS: Windows 11 Home 22H2 Release version: 1.0.3 Appreciate any input! Splendid program you've built here.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

daffaromero commented 8 months ago

Wholly appreciate the quick reply.

Don't worry, I'm not in need of an immediate fix; feel free to work on it as you please. In the meantime, I'm completely fine with running ffmpeg through the command line. Thank you!

dylanhthomas commented 3 months ago

This has been finally fixed in v1.0.4.

Background information:

Unless specified explicitly, nodejs executes commands using your default command shell, which depending on your Windows configuration could be either cmd.exe or powershell.exe

The commands in PEAT Media Converter were designed to run in cmd.exe so for users where powershell.exe was the default, every conversion would fail.

This release explicitly sets the command shell to be used as cmd.exe

daffaromero commented 3 months ago

Hell yeah brother. Nice one 👍