Reputation: 7105
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.
Upvotes: 2
Views: 7704
Reputation: 405
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.
Upvotes: 1
Reputation: 175
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
Upvotes: 1