Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFMMPEG exits with code 1 - Invalid Argument #8

Open
BleedingDev opened this issue Jan 14, 2024 · 10 comments
Open

FFMMPEG exits with code 1 - Invalid Argument #8

BleedingDev opened this issue Jan 14, 2024 · 10 comments

Comments

@BleedingDev
Copy link

I got this error, which I don't know how to handle.

Platform

Window 11
Powershell
Node 20.11

Error

⠙ Converting to audio...node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: Error: ffmpeg exited with code 1: C:\Users\pegak\AppData\Local\Temp\gen-subs\from-video\1705273617943-D:\Videos\tides_of_war_1.wav: Invalid argument
".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v20.11.0
@BleedingDev
Copy link
Author

It doesn't matter if I call with npx or when installed globally. The result is the same.

@SuperiorAlpaca
Copy link

I encountered the same exact problem.

@iceberg53
Copy link

iceberg53 commented Feb 7, 2024

I'm also encountering the same problem on Windows 10 with Node.js v18.8.0 .

iceberg53 added a commit to iceberg53/gen-subs that referenced this issue Feb 10, 2024
This commit mainly replaces the use of custom string manipulation by
functions from the path module from node ( path.basename(),
path.resolve(), path.extname(), ...) .
It's done to account for Windows OS file paths
("C:\\folder\\subfolder\\file.ext") which are different from POSIX ones
("/home/user/folder/file.ext") .
That difference led to file names with character sequences that caused
an error when calling ffmpeg.
@iceberg53
Copy link

I tried to provide a fix for the bug and I'm for the approval of the maintainer. You can grab the code and run it locally if you urgently need a fix : https://github.com/iceberg53/gen-subs/tree/windows-bug-fix

@BleedingDev
Copy link
Author

Awesome many thanks. :) I will try once I have some time. :)

@issam-seghir
Copy link

i have the same problem :

sudo npx gen-subs for '.\vsdc-sr-subtitled-video.mp4' --burn-in --format ass

Need to install the following packages:
gen-subs@1.1.0
Ok to proceed? (y) y

⠼ Converting to audio...node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: Error: ffmpeg exited with code 1: C:\Users\GAMING\AppData\Local\Temp\gen-subs\from-video\1718404910943-E:\Videos\VSDC Free Screen Recorder\vsdc-sr-subtitled-video.wav: Invalid argument
".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v20.10.0

@Isador-Sotho
Copy link

I tried to provide a fix for the bug and I'm for the approval of the maintainer. You can grab the code and run it locally if you urgently need a fix : https://github.com/iceberg53/gen-subs/tree/windows-bug-fix

Completely new to node and npm, sorry for my helplessness :(
How to get it running locally?

@iceberg53
Copy link

I tried to provide a fix for the bug and I'm for the approval of the maintainer. You can grab the code and run it locally if you urgently need a fix : https://github.com/iceberg53/gen-subs/tree/windows-bug-fix

Completely new to node and npm, sorry for my helplessness :( How to get it running locally?

Hi!
For nodejs projects like this one, you can take a look at the package.json file in the scripts section to see the commands available for the project.
To run the gen-subs project, go to the root folder and run npm run build .
This will generate a new cli.js file in the dist folder .
Then run the cli.js file like any other executable file.
If you're still in the root folder for instance, use ./dist/cli.js followed by the gen-subs command line arguments.
Example: ./dist/cli.js for ./your/video.mp4
There are a few other fixes that I added beside this one regarding the windows prerequisites and the incompleteness of the subtitles.
As they are not merged yet, you can clone my development branch where I merged those fixes.
Also take a look at the Readme of that dev branch to make sure that your windows has what you need for running gen-subs.
Here's the link to the development branch https://github.com/iceberg53/gen-subs/tree/dev .
Let me know if you have any issue.

@Isador-Sotho
Copy link

Worked out just fine :)
Thank you!

Short rundown of my steps should anyone else try to follow:

  1. Download of branch "windows-bug-fix" as ZIP
  2. Extracted into working dir
  3. (Admin) Powershell into working dir
  4. Changed "@types/vosk": "link:../../DefinitelyTyped/types/vosk", to "@types/vosk": "file:../../DefinitelyTyped/types/vosk", in package.json due to error message
  5. npm run build
  6. npx gen-subs for [video]
  7. Subs generated

@iceberg53
Copy link

I'm happy that you managed to get it working.
When you started generating your subtitles did they cover the whole video ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants