Video duration calculator application
This Express application allows you to calculate total duration for given video
files without uploading them (almost). Instead of full uploading it reads chunks
from client (i.e. browser) using HTML5 File API & WebSockets and passes that
data to ffprobe
command-line utility.
Requirements
- Node.js (>=0.10.x)
ffprobe
tool (>=1.x). Usually comes withffmpeg
package
Installation & running
$ git clone git://github.com:estliberitas/express-duration-app.git
$ cd express-duration-app
$ npm install
$ PORT=1337 node app.js
- Open
http://127.0.0.1:3000/
in browser (which hopefully supports websockets)
How it works
- When page is opened, WebSocket connection is established using
socket.io
. - Once one presses
Browse
button and selects one or more video files, client sendsget duration
request via websockets with list of files. - For each file backend generates URL
http://127.0.0.1:PORT/data/{SOCKET_ID}/{FILENAME}
and spawnsffprobe [options] URL
. - When
ffprobe
makes HTTP request to URL, backend handler requests file data from client via websockets using range specified byffprobe
in HTTP requestRange
header.