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

snapshot: tell ffmpeg pipe input format #902

Merged
merged 2 commits into from
Jun 21, 2023
Merged

Conversation

bjia56
Copy link
Collaborator

@bjia56 bjia56 commented Jun 21, 2023

Snapshots of raw images (e.g. via the snapshot url) frequently results in error when rescaling. A sample stacktrace:

[Snapshot Plugin]: -hide_banner -y -i pipe:[REDACTED] -filter_complex scale='min(512,iw)':-2 -frames:v 1 -f image2 pipe:3
[Snapshot Plugin]: pipe:4: Invalid data found when processing input
[Snapshot Plugin]: ffmpeg exited
[Snapshot Plugin]: Snapshot failed Error: ffmpeg input to image conversion failed with exit code: 1, /usr/bin/ffmpeg -hide_banner -y -i pipe:4 -filter_complex scale='min(512,iw)':-2 -frames:v 1 -f image2 pipe:3
[Snapshot Plugin]:     at /src/ffmpeg-image-filter.ts:177:23
[Snapshot Plugin]:     at processTicksAndRejections (node:internal/process/task_queues:95:5)

It looks like this might be a side effect due to switching from static ffmpeg to system ffmpeg (maybe because static ffmpeg is a later version), since static ffmpeg doesn't produce the same error. Explicitly telling system ffmpeg to use jpeg_pipe image2pipe makes it much happier.

@koush
Copy link
Owner

koush commented Jun 21, 2023

I’m not familiar with jpeg pipe and whether all ffmpeg has that available. Typically the -f format I use for jpeg is image2. Does that work?

You can actually see the output arguments using that in the logs already.

@bjia56
Copy link
Collaborator Author

bjia56 commented Jun 21, 2023

image2 doesn't work for the input arguments as it expects a list of files instead of a pipe

@bjia56
Copy link
Collaborator Author

bjia56 commented Jun 21, 2023

I see there's an image2pipe option, will test that out later today

@koush
Copy link
Owner

koush commented Jun 21, 2023

Quick read indicates that the image2* demuxer/muxer handles both jpeg and png, so that's probably preferred.

@koush koush merged commit 7f4c899 into koush:main Jun 21, 2023
@bjia56 bjia56 deleted the snapshot-ffmpeg-fix branch June 21, 2023 23:10
A2Wolverin3 pushed a commit to A2Wolverin3/scrypted that referenced this pull request Jul 11, 2023
* snapshot: tell ffmpeg pipe input format

* use image2pipe
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

Successfully merging this pull request may close these issues.

2 participants