Why is my video or thumbnail transformation not returning an image and showing an "asset being prepared" message?

I have read the documentation and added the correct transformation. But one first load I do not get the file. On subsequent refresh I get the thumbnail. This happens with any other video transformation as well. Why?

Videos can take a little longer to get processed.

There are two steps of video processing

  1. Downloading of the original video which could be a few hundred MBs and the time for this step depends on size of the video itself and how quickly does the origin server connected to ImageKit responds (if the video is stored there)

  2. Processing of the video itself - It is a computationally intensive operation with longer, very high resolution videos taking longer to process than shorter, low-res videos.

Irrespective of the transformation requested, ImageKit waits for a few seconds for the video processing to complete in the same request. This time usually depends on the Video Polling duration that you set in the video delivery settings in the dashboard.

But, if the processing does not complete in that timeframe, then an intermediate response is returned indicating that the request is being processed. The processing meanwhile continues in the background. Once the processing gets completed, the same URL starts responding with the expected output.

Depending on the output type, the intermediate response can be different

  1. If the output requested is going to be a video, then the intermediate response will redirect to the original video till the processing is completed.
  2. If the output requested is a video thumbnail or an adaptive stream like HLS or DASH, then the intermediate response indicates that the thumbnail is being generated and no content otherwise is returned.

Read more about this behaviour here.