Chenna Rao
Chenna Rao

Reputation: 111

How to reduce video size before uploading in asp.net C#

In my asp.net application when i'm going to upload any size of video need to decrease(reduce) the size of video, any one have code please help me Thanks

Upvotes: 0

Views: 3528

Answers (1)

TomTom
TomTom

Reputation: 62101

You can not.

Any reduction in video size would be either compression or recoding to a lower resolution etc.

This is way beyond the scope of a web browser upload - unless you want to implement one or both of those in javascript (!).

Any size reduction would have to be done as a separate step - outside of the website - before uploading.

The whole question begs the concept whether you have understood how web pages work, in principle. There is a very strong separation of responsibilities between the web browser and the server. In particular, the following answer to a comment is - funny:

Okay no need to instantly decrease size, just before save path in database and store file in folder decrease the size, save decreasing file in folder

Ok, lets upload the parth. HOW DOES THIS HELP?

  • The path will be local to the uploaders machine. C:\Videos\LargeVideo.mpg is neither the video file, nor a location your asp.net server can access.
  • This does totally not solve the problem. Unless the user transcodes the file, it still is on the user's machine and too large. This is like saying "ok, the package weights too much - let's write the recipient address in another font". Does not even try to solve the problem.

Only realistic solutions are:

  • Provide the bandwidth.
  • Provide a client side upload application (NOT a webpage) that the user installs that then can not only do the upload, but can do any trans-coding necessary before uploading.

You are stuck in two elements:

  • A very strong client/server separation and
  • A very limited runtime environment on the client (javascript in the web browser).

No whining and not acceptance will every be able to change that. There is no magical way to "nothing to convert any format, all type of videos accepted just simple decrease file size only". This is called transcoding (change from one encoding to another one - and you can for example change the resolution when doing so) and it is a VERY intensive process not just doable in a browser.

Upvotes: 1

Related Questions