TejasQ/gen-subs

FFMMPEG exits with code 1 - Invalid Argument

Opened this issue · 10 comments

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

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

I encountered the same exact problem.

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

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

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

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

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?

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.

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

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