简体   繁体   中英

compress selected video file before upload in javascript

I have included video upload feature in my javascript project. Selecting the video from local storage in the project is uploading, but I want the size of the video file to be compressed and uploaded. My main focus is to upload recorded video from camera and mobile phone which is of very large size. I have used HTML 5 to select the video file.

<input type= "file" id="fileselect" name="uploadvideo" accept=".mp4, .mov, .webm"/>

The size of the video file should be compressed before it is uploaded.

An mp4 file is a container which will have video and audio tracks in it - these tracks will typically already be compressed by the encoder depending on which codec is used, h.264 for example.

If you want to further compress or re-encode the video it is possible, for example using a browser based ffmpeg solution, but even though these solutions may leverage the latest web assembly language technology this will not be quick and may not give you either the compression or quality you are looking for.

You can see some example here to experiment with: https://github.com/ffmpegwasm/ffmpeg.wasm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM