简体   繁体   中英

Video compression before uploading to Google Cloud Storage

I am a bit confused when it comes to the size of a video. I am currently using a signedUrl in order to send the video from the client phone to the Google Cloud Storage bucket. The part I am confused is in regards to the size of the video. I noticed when I upload a video that is a minute long, the size is over 200mb. Is this normal? or is there a way to decrease the video size since it seems like the cost would be exponential if that was the case.

When retrieving a video currently I have it as

let result = await ImagePicker.launchImageLibraryAsync({
  mediaTypes: ImagePicker.MediaTypeOptions.Videos,
  allowsEditing: true,
  aspect: [4, 3],
  quality: 1,
  videoQuality: 6
});

The videoQuality at 6 from my understanding produces 1280 x 720 resolution. Is the resolution an issue?

Thanks in advance for advice/help in hopefully solving this issue or teaching me what to consider when dealing with videos and uploading them to the cloud (in regards to space and storage).

The videoQuality argument should be of type ImagePicker.UIImagePickerControllerQualityType as mentioned in the docs

The ImagePicker.UIImagePickerControllerQualityType currently has the following possible values as you can see in their repo :

export enum UIImagePickerControllerQualityType {
  High = 0,
  Medium = 1,
  Low = 2,
  VGA640x480 = 3,
  IFrame1280x720 = 4,
  IFrame960x540 = 5,
}

Thus, for a 1280 x 720 output, you should set videoQuality: 4

Moreover, if you would like to further reduce the size of your video files when uploading to Google Cloud Storage, you may want to look into the Decompressive transcoding feature , which automatically decompresses gzip files stored in GCS when they are requested (note that files should be compressed before storing in GCS).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM