0

I'm developing a app in GCP that process a video file in Cloud Run for get the frames and storage the frames in other Bucket.

But my Cloud Run application need to download the whole file and save it in the container instance, and process the video frame by frame.

So, i changed to process the video in parallel by each instance process in block of frames, but continue downloading the whole video file in each container.

This process is relative fast for short videos, but large videos of 20 GB or more can take a long time and the resources is a bit large.

So, my idea is to only download 500 MB (or less) of the video by container and process this fragment only.

So, my question is:

  1. How can optimize the download of the video for only download the frames necessary without download the whole video?

  2. Can donwload the video of Cloud Storage in streaming by only the need block of frames?

Johan Valero
  • 51
  • 1
  • 5
  • I think you can read partial part of file. I saw that in different answer, but I never use it. Here a sample https://stackoverflow.com/questions/14248333/google-cloud-storage-seeking-within-files – guillaume blaquiere Jul 20 '22 at 21:17
  • Yeah, i'm reading it with blob extracting the bytes needed But it's in format mp4 then reading documentation for read mp4 headers My current documentation for this taks is: https://cloud.google.com/python/docs/reference/storage/latest/google.cloud.storage.blob.Blob#google_cloud_storage_blob_Blob_download_as_bytes (Cloud Storage documentation for download the bytes of the file) https://stackoverflow.com/questions/18178374/how-can-html5-videos-byte-range-requests-pseudo-streaming-work (Streaming video in HTML) https://stackoverflow.com/questions/29565068/mp4-file-format-specification – Johan Valero Jul 20 '22 at 21:26
  • Did you consider to preprocess the video, split it in several small piece and use Cloud Run jobs to process all of them concurrently? – guillaume blaquiere Jul 20 '22 at 21:31
  • Yeah, but for process the video in short videos need to download the video in memory or disk for divide it and save the pieces, for after process it the pieces. So, it's time processing 20GB for after save it and process it again. Maybe be an option that compare the perfomance. – Johan Valero Jul 20 '22 at 21:40

0 Answers0