1

I have to make a simple web page on which user can upload a video (max 10 MB) and the page will compress it (to 5 MB or less) and save it to the server.

I have done the front-end part of the webpage using HTML CSS and javascript.

The user should be able to add a video file and my site should compress it on the server side.

So, How can I compress the uploaded video on my server?

screenshot of my page

Saris
  • 13
  • 1
  • 5
  • The compression is supposed to be done using server side languages but not frontend i.e JavaScript. – Mr_Green May 09 '18 at 08:58
  • I think it can become a security issue to compress it client-side. By the way you have not precised what is used front-end (probably javascript?). Client could alter the code as to modify format checks and such. Video should be checked and compressed server-side – Kaddath May 09 '18 at 09:01
  • https://stackoverflow.com/questions/26591690/server-side-video-conversion-and-compression/26591914#26591914 – Hyyan Abo Fakher May 09 '18 at 09:02
  • yes server-side compression @Mr_Green – Saris May 09 '18 at 09:16
  • i've update the question ... i'm looking for server side code to compress the videos uplodad on my site. @Kaddath – Saris May 09 '18 at 09:17
  • Are you sure the code answered in that question works ? @HyyanAboFakher – Saris May 09 '18 at 09:18
  • nothing soo far :( but i'm considering to use FFmpeg on my server @AniketSahrawat – Saris May 09 '18 at 09:24

1 Answers1

1

If you wants to reduce video size without loosing much quality, then you can install and use one of the following programs:

sudo apt-get install ffmpeg
ffmpeg -i videoS1.mp4 -r 30 -s 960x540 output-compress.mp4

OR

sudo apt-get install mencoder
mencoder input.mp4 -vf scale=720:480 -ovc lavc -o output-compress.mp4

OR

sudo apt-get install libav-tools 
avconv -i input.mp4 -s 640x480 output-compress.mp4

Above all commands/programs can be executed using Server side programming language as it's Linux utilities. You may get libraries for various codec support.

Chintan7027
  • 7,115
  • 8
  • 36
  • 50