Image-to-video module fails to render without proper error message

Current State: Our video generation is completed in two stages, with each stage involving a separate API call to Shotstack:

  1. We use the “image-to-video” module to process each individual image.
  2. We then stitch these videos together with transitions using the “video” type.

The images themselves are stored in S3, and we generate time-based URLs that stay active for one hour.

Observation: While most of the time the image-to-video module processes and renders successfully, every once in a while we encounter errors indicating that an image is not accessible. This issue appears intermittently, not due to URL expiration, as the URLs remain valid for an hour from generation, and we use the same url to show a preview before passing it to shotstack.

Questions:

  1. What’s the maximum image resolution that the image-to-video module can support ?
  2. How many maximum image-to-video can be run in parallel?
  3. Do we lose quality when we stitch individual image-to-video renders compared to a single template consisting of multiple image-to-video ?

These errors typically occur when the image input is encoded incorrectly. We’ve identified that some of these images are encoded using the MJPEG (Motion JPEG) codec. Since MJPEG is a video codec rather than a standard still image format, it leads to decoding issues during processing and results in render failures.

Currently, our API validates based only on file extensions and MIME Type, but this doesn’t catch incorrect codecs like MJPEG. As a result, files encoded with MJPEG are processed as if they were still images (JPEG or PNG), causing errors.

We recommend validating the images on your end to ensure they’re encoded using standard image codecs like JPEG or PNG. Alternatively, re-encode images to a standard format before submitting them to avoid failures.

Thanks for the response.

I’ll try re-encoding all images to a standard format before passing it on to shotstack, and see if it makes any difference.

I can however confirm that supplied files had similar properties yet one failed while the other passed.

file 8ff3136a-fd49-4ec3-9c2c-77fecc81421b.jpeg :
JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, baseline, precision 8, 2000x1331, components 3

file a1a173fb-fe3f-40ba-9ae4-f7c01ef5b6be.jpeg :
JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, baseline, precision 8, 2000x1331, components 3

On a similar note I did get this error too on a couple of occasions:

[ Server ] Webhook received: {

[ Server ] type: ‘edit’,

[ Server ] action: ‘render’,

[ Server ] id: ‘72db6400-477a-473f-9515-ca48bfa6d021’,

[ Server ] owner: ‘y6duidz4gv’,

[ Server ] status: ‘failed’,

[ Server ] url: null,

[ Server ] poster: null,

[ Server ] thumbnail: null,

[ Server ] error: ‘Error: An error occurred when initiating the video generation process: Advanced prompt moderation failed’,

[ Server ] completed: ‘2024-11-08T00:06:33.747Z’

[ Server ] }

Is there a way/checklist to standardize the input so that its acceptable by shotstack api ?

Or if possible, provide a failure response that could be worked upon?

Regards,