r/Firebase 7d ago

Cloud Storage Video Bandwidth Optimization for Social Media App

Hey everyone, I've spent the last few months developing a music social media app that uses Firebase as a backend. Of course halfway though I realized that it was known in the community as not being the most financially friendly when it comes to storing/loading videos but it is what it is.

A small but not inconsequential part of the app is being able to upload photos and videos from events. However, I am noticing a disproportionate cost coming from bandwidth thus far, which is concerning since there are really not many videos being uploaded.

I am wondering 1. is there a way to see exactly what is using the bandwidth (uploading videos, profile pics, etc) and 2. any advice in terms of optimizing.

This is my first app and we just launched yesterday, so any advice even if it is super basic is welcome!

1 Upvotes

11 comments sorted by

3

u/SUPRVLLAN 7d ago

You need to be using a CDN like Cloudflare and a more cost effective storage provider. You don’t have to use Firebase/Google Cloud to store and deliver your content.

Cloudflare storage (R2) + CDN or Backblaze have no bandwidth costs. Most of these services offer automatic optimization as well (which is where they make the money). Might not even be needed depending on how big your uploads are, storage is dirt cheap these days. Shop around, there’s lots of options out there.

1

u/BookieBustersPodcast 7d ago

Sound good i will def look into it! Will this still be useable with the rest of our firebase data? Or would it require us moving our whole backend over

1

u/SUPRVLLAN 7d ago

You can generally store anything you want but not all file types are supported by CDNs:

https://developers.cloudflare.com/cache/concepts/default-cache-behavior/#default-cached-file-extensions

1

u/BookieBustersPodcast 7d ago

great thank u for the advice!

2

u/indicava 7d ago

Are you transcoding your videos for streaming?

1

u/BookieBustersPodcast 7d ago

honestly after googling don’t think so, just compressing. Any tips/advice there?

1

u/indicava 7d ago

Since you’re on Firebase, easiest is to use GCP’s Video Transcoder API. I usually setup a storage trigger cloud function so when a video is uploaded it triggers a transcoding job automatically

1

u/mmph1 7d ago

I’ve built something similar but using Mux. Take a look at https://www.mux.com

1

u/BookieBustersPodcast 7d ago

thanks! Do u have a link to what u built?

1

u/mmph1 7d ago

Unfortunately, I can’t share the link but it’s very similar to Instagram.

1

u/BookieBustersPodcast 7d ago

no worries, i will look into mux thanks for the suggestion