Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFMPEG commands in JavaScript

Is it possible to use command like: ffmpeg -i video_1920.mp4 -vf scale=640:360 video_640.mp4 -hide_banner to reduce the resolution of a video in the pure JavaScript. For example I got a dropdown menu in which I have < a > tag, so I want to do a video quality selection by clicking on that menu hyperlink with JS. How to implement that properly, please help.

like image 263
Vladyslav Semeniuk Avatar asked Jan 15 '18 18:01

Vladyslav Semeniuk


People also ask

What is FFmpeg command?

Command line tools ffmpeg is a command-line tool that converts audio or video formats.


1 Answers

If you want to do the work in the browser, i.e. on the users machine rather than your server, there are a number of projects which provide an ffmpeg wrapper in Javascript. This one is the most popular at the moment, I believe:

  • https://github.com/Kagami/ffmpeg.js?files=1

You would need to do some testing - video processing is very compute intensive and may not work well for you in the browser.

If you want to do it server side, in a Javascript based server like node for example, then again there are libraries available - e.g.:

  • https://github.com/fluent-ffmpeg/node-fluent-ffmpeg
like image 85
Mick Avatar answered Nov 14 '22 20:11

Mick