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

I cannot get an image that isn't 0 bytes. #86

Open
mespr opened this issue Jan 18, 2023 · 1 comment
Open

I cannot get an image that isn't 0 bytes. #86

mespr opened this issue Jan 18, 2023 · 1 comment

Comments

@mespr
Copy link

mespr commented Jan 18, 2023

Describe the bug

The examples provided in the README are rendering 0 length images. I believe I copied example code verbatim apart from the file paths, and the inclusion of the option {path: ffmpeg}. My expectation is that the output would have a none zero length and render as an image.

I have tried async, I have tried different videos (though only mp4). I have tried different image extensions and deleting previous results. My ultimate goal is to make use of your buffer support with web uploads. It all seems to work apart from getting empty results.

To Reproduce

import fs from 'fs';
import thumbGen from "simple-thumbnail";
import ffmpeg from "ffmpeg-static";

fs.createReadStream('/workspace/test/test.mp4',{path: ffmpeg})
  .pipe(thumbGen(null, null, '250x?'))
  .pipe(fs.createWriteStream('/workspace/test/thumbnail.png'))

NOTE: I believe that the syntax for ffmpeg no longer involves .path. path is undefined and ffmpeg is not throwing errors.

This results in an image file with no data

-rwxr-----   1 userid userid 33925688 Dec 31  2021 test.mp4
-rw-rw-r--   1 userid userid        0 Jan 18 16:16 thumbnail.jpg
-rw-rw-r--   1 userid userid        0 Jan 18 16:16 thumbnail.png

Expected behavior

I expect a thumbnail image to be produced.

Environment (please complete the following information):

  • node v18.7.0
  • Ubuntu 22.10.
  • The relevant package.json dependencies are
    "ffmpeg-static": "^5.1.0",
    "simple-thumbnail": "^1.6.5",

Additional context

I believe this package is exactly what I am looking for, but I'm stumped. My project in this context is /samizdatonline/samizdat-media, part of an adventurous project you can find at samizdatonline.org. If you can confirm this should work, or provide hints as to what I am doing wrong, my team is willing to help.

Thank you

@MatejSkrbis
Copy link

It seems this library is not compatible with ffmpeg-static v5.
I am using ffmpeg-static 4.4.0 and when I tried to upgrade to 5.1.0, the image with 0 byte length was generated.

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

2 participants