node.js - Is there a way to set maximum duration for browser-based video uploaders? -


vine.co allows videos @ 6 seconds. users upload phones. wonder if can done browsers. thanks.

(i rely on node.js)

it depends how want perform upload.

option 1 - if movie uploaded streaming server in, example, rtsp or rtmp, server can elect drop movie based on duration, determined during upload. accurate , efficient option requires uploader able stream file , server accept stream media server.

option 2 - if movie uploaded file transfer easiest limit movie file size. size can determined heuristics if know bit rate. example, @ 500kbps you'd expect 6 second movie weigh approximately 375kb, might limit uploads 450kb , figure exact boundary while inspecting file on server side. work must know in advance movie's average bit rate.

option 3 - yet option, based on movie metadata: depending on movie format might able determine upfront movie's duration inspecting file headers. in mp4, example, if mov atom @ beginning of file can tell upfront what's movie's duration. however, if mov atom @ end of file or if h.264 stream muxed live streaming mpeg-ts there no way tell upfront movie's duration. note header info in case metadata, non-conforming client (whether accidentally or maliciously) might fool server posting incorrect duration metadata. in other words - method not reliable.

option 4 - more accurate method in case use http/ftp, though labor intensive programming-wise, analyze movie during upload. method highly dependent on movie format , upload method. , still less accurate , responsive first option (upstreaming files).

to summarize, if can compromise on upfront accuracy of quota assertion , wait file on server before accepting or rejecting simplest , recommended solution option 2.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -