2

In my react application i have included a image and video uploading feature. For images, i'm compressing the image before uploading into the server. Now i need to do the same for the videos as well. But i'm not sure if the video compression should be done before uploading (From the Front-end) or after uploading (From the back-end). What would be the best way to do this considering the performance and efficiency?

Thanks.

CraZyDroiD
  • 6,622
  • 30
  • 95
  • 182

2 Answers2

1

For this kind of dedicated and isolated feature, I would really prefer a microservice which sit between frontend and backend (preferably in the same data center as your server).

If you've got good budget some third-party API is presumably performant and trouble-free, like coconut

francox9
  • 175
  • 7
  • 1
    As i understand idea is to decrease file size, while having service will still require to upload full video. And now videos on phone can have very big size. – Anton M. Feb 05 '20 at 12:07
1

For uploads from the web, you’re better off compressing server-side. Compression on the client side is going to be quite CPU heavy and it won’t be a good user experience if their computer freezes for long durations while interacting with your site. Not only that, you’ll have to figure out a way run ffmpeg or a similar tool using web-workers in the browser and it’s mostly not worth the headache.

People generally setup a transcoding pipeline that can compress, resize or convert the formats of the user-generated videos in a batch process usually with ffmpeg or use other cloud-based SAAS platforms if you don’t want to do all the heavy lifting yourself.

Full Disclaimer: we had a similar requirement and ended up starting mediamachine.io because most providers were too expensive for our needs.

GiaNU
  • 405
  • 2
  • 5
  • 10