Giter Club home page Giter Club logo

videoconverter.js's Introduction

#videoconverter.js

videoconverter.js is a library that allows you to convert and manipulate videos inside of your web browser.

This is achieved by converting the popular FFmpeg library into JavaScript, using Emscripten.

It was originally conceived for a project called Video Funhouse in Node Knockout 2013.

Demo

Want to jump straight to a demo?

Documentation and Build Instructions

For more information about building and using the project, visit the project homepage at http://bgrins.github.io/videoconverter.js/.

Questions and Comments

Feel free to ping @bgrins or @aaronm67.

Contributing

Interested in helping out? We have added a section about contributing on the project page: http://bgrins.github.io/videoconverter.js#contributing.

videoconverter.js's People

Contributors

bgrins avatar nikai3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

videoconverter.js's Issues

Compiled with all Filters

Hi, We have made a build using Emscripten but where images in the demos eg Video to Gif etc are held on our server, I am better trying to understand how you would take an image from the web.

Any advice would be greatly apprecaited

convert Video To ScreenShots

I am trying to convert video to screenshots .
Your given example works perfectly fine , but when i tried on from my given video i.e(sample.mp4)
it doesnt find the file in the directory
here's my command
-i sample.mp4 -s 100x100 -f image2 -vf fps=fps=1,showinfo -an out%d.jpeg

Here's the output
Worker has received command
Received command: -i sample.mp4 -s 100x100 -f image2 -vf fps=fps=1,showinfo -an out%d.jpeg. Processing with 268435456 bits.
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Jun 9 2014 20:24:32 with emcc (Emscripten GCC-like replacement) 1.12.0 (commit 6960d2296299e96d43e694806f5d35799ef8d39c)
configuration: --cc=emcc --prefix=/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist --extra-cflags='-I/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/include -v' --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network --disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file --enable-libvpx --enable-gpl --extra-libs='/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libx264.a /Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libvpx.a'
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
sample.mp4: Invalid data found when processing input
Finished processing (took 2884ms)

This is what i change in Terminal.js From (input.webm to sample.mp4)
function runCommand(text) {
if (isReady()) {
startRunning();
var args = parseArguments(text);
console.log(args);
worker.postMessage({
type: "command",
arguments: args,
files: [
{
"name": "input.jpeg",
"data": sampleImageData
},
{
"name": "sample.mp4",
"data": sampleVideoData
}
]
});
}
}

function retrieveSampleVideo() {
var oReq = new XMLHttpRequest();
oReq.open("GET", "sample.mp4", true);
oReq.responseType = "arraybuffer";

oReq.onload = function (oEvent) {
var arrayBuffer = oReq.response;
if (arrayBuffer) {
sampleVideoData = new Uint8Array(arrayBuffer);
}
};

oReq.send(null);
}

Can you please tell what wrong am i doing here . Thanks Alot

How to cut videos ?

i want to cut video i.e ( extract part from a video )
on cmd it works fine but on your given terminal it doesnt

i use below command to cut video in cmd .
$cmd = "ffmpeg -ss $start -t $end -i $video video/cut".$i.".mp4"; // for cutting video

i tried this commad
-ss 0 -t 5 -i input.webm samp.webm
on the demo link
http://bgrins.github.io/videoconverter.js/demo/

it gives the file but the file doesnt have any video ,Need help regarding this Thanks,

How to use complex filters to add an image overlaying a video.

Hi,

Thanks for this very helpful library.

I would like to add overlaying images to a video. I know which command can do that but I can't execute it with videoconverter.js. How can I include this functionality in the library, I've never used emscripten and I would like to know what are the steps to do such a thing.

This is my command:
ffmpeg -i input.mp4 -i img1.png -i img2.png -filter_complex overlay=0:0:enable='between(t,0,10)' overlay=0:0:enable='between(t,5,20)' -pix_fmt tuv420p -c:a copy out.mp4

Thanks a lot for your help.

Quentin

Make node.js working

Hello,

First, great job on this project,

But i'm stuck with this node.js ! I really want to try it with local datas, and check the performances.

Thanks :)

Compile ffmpeg with only libmp3lame

Dear developer,

I want to compile ffmpeg with only libmp3lame (emscripten)

I trying this over 1 week. But I always failed with lot of different errors.

Can you please help me?

Create wav file with opus codec

Hello,

It is possible to decode opus audio with your library?
With this arguments :

arguments: [ '-i', 'audio.wav', '-c:a', 'vorbis', '-b:a', '4800k', '-acodec', 'libopus', '-strict', 'experimental', 'output.mp4' ], files: [ { data: new Uint8Array(BlobAudio), name: 'audio.wav' } ]

I get this error : Unknown encoder 'libopus'.

If i don't explicitly put libopus encode, i got this error from chrome :

Input #0, matroska,webm, from 'audio.wav':
client_bebe.js:83 Metadata:
client_bebe.js:83 encoder : Chrome
client_bebe.js:83 Duration: N/A, start: 0.000000, bitrate: N/A
client_bebe.js:83 Stream #0:0(eng): Audio: opus, 48000 Hz, mono (default)
client_bebe.js:83 [abuffer @ 0xeda700] Unable to parse option value "(null)" as sample format
client_bebe.js:83 Last message repeated 1 times
Last message repeated 1 times
client_bebe.js:83 [abuffer @ 0xeda700] Error setting option sample_fmt to value (null).
client_bebe.js:83 [graph 0 input from stream 0:0 @ 0xeda660] Error applying options to the filter.
client_bebe.js:83 Error opening filters!

Opus is the only way i can get my audio.

RTSP stream conversion

Hi,

I was wondering if it was possible to use this to convert and rtsp stream? The following ffmpeg arguments give me a 'Protocol not found' error.

arguments: [
"-i", input, "-vcodec", "copy", "-f", "mp4", "-movflags", "frag_keyframe+empty_moov", "-r", "25",
"-reset_timestamps", "1", "-vsync", "1","-flags", "global_header", "-bsf:v", "dump_extra", "-y", "-"
]

Is there something i'm missing?

wav to mp3 conversion

Hello,

I'm trying to use videoconverter plugin to merge two wav files and transform them to mp3. The command im using is

                            arguments: ['-i', 'one.wav','-i', 'two.wav',
                                  '-filter_complex', 'amix=inputs=2' ,(new Date().toUTCString()+'.mp3') ],
                                  files: [
                                    {
                                      data: new Uint8Array(data1),
                                      name: "one.wav"
                                    },
                                    {
                                      data: new Uint8Array(data2),
                                      name: "two.wav"
                                    },
                                  ]
                                });

and i'm getting this error:

Encoder (codec none) not found for output stream #0:0

Anybody knows what i'm doing wrong ?

Thank you for help !

CDN for ffmpeg.js

I'm using ffmpeg.js for the audio recorder in this project, however I am uncertain which hosts I can use for the file because it is so large. I am currently using the version hosted on the gh-page for this repository. Is that alright to do? If not, would it be possible to put a version on https://cdnjs.com/ ?

Would be nice to compile a "light" version, which supports only stream copying

Hi!
In my opinion it would be nice and useful to compile and provide a "light" version too, which supports only the stream copying mode of ffmpeg (-c copy). For example when saving online audio streams, or saving radio programmes from live streams. Folks usually use such a simple commands to save from online audio streams:
ffmpeg -i http://stream.example.com/stream_20160518_0630.mp3 -c copy -t 3600 programme.mp3

Then it would be possible to provide those saveable streams on a webpage by pure Javascript, and without a costly server backend. Is it possible to compile this subset of FFMpeg into Javascript for myself?

Build size too small

Hello,
I've managed to compile ffmpeg.js and ffmpeg-all-codecs using the advice in topic #29 amongst other things.
I am using 1.34.3 on a new build ubuntu machine. so everything is probably the latest build.

The problem is that my ffmpeg.js and ffmpeg-all-codecs.js are around 6mb smaller than those already compiled on the hub. (17.1mb & 19.9mb) They wont run in the demo page, so i am sure this is why.

I am not sure where to go next with this, as its been a struggle for me to get this far!

MY goal is that I am hoping to build a version libvordis & libogg - which I have managed to successfully compile.

Any help appreciated.

Simple help command not working in node.js

Hi, here is my srcipt:

eval(fs.readFileSync("./ffmpeg-all-codecs.js", "utf-8"))
var result = ffmpeg_run({
  print: console.log,
  printErr: console.log,
  files: [],
  arguments: ["-h"],
  TOTAL_MEMORY: 268435456
  // Can play around with this option - must be a power of 2
  // TOTAL_MEMORY: 268435456
});
console.log(result);
console.log("Done");

And the output

$ node test
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  9 2014 20:24:32 with emcc (Emscripten GCC-like replacement) 1.12.0 (commit 6960d2296299e96d43e694806f5d35799ef8d39c)
  configuration: --cc=emcc --prefix=/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist --extra-cflags='-I/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/include -v' --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network --disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file --enable-libvpx --enable-gpl --extra-libs='/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libx264.a /Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libvpx.a'
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  9 2014 20:24:32 with emcc (Emscripten GCC-like replacement) 1.12.0 (commit 6960d2296299e96d43e694806f5d35799ef8d39c)
  configuration: --cc=emcc --prefix=/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist --extra-cflags='-I/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/include -v' --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network --disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file --enable-libvpx --enable-gpl --extra-libs='/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libx264.a /Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libvpx.a'
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
undefined
Done

I am using nodejs x64 under windows 7 x64

Has issue when encoder is QTmuxingAppLibWebM-0.0.1

I use webrtc to record audio and video. I then use this to convert. If the recording has no idea it works fine (if I remove _madvise).

With and without _madvise though, if the recording has audio it keeps telling me Error opening filters!

I forked your repo and changed the input.webm file to cant gif.webm here - http://noitforks.github.io/videoconverter.js/demo/

Clicking the "Convert to mp4" will give you this full error:

Worker has received command
Received command: -i input.webm -vf showinfo -strict -2 output.mp4.  Processing with 268435456 bits.
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  9 2014 20:24:32 with emcc (Emscripten GCC-like replacement) 1.12.0 (commit 6960d2296299e96d43e694806f5d35799ef8d39c)
  configuration: --cc=emcc --prefix=/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist --extra-cflags='-I/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/include -v' --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network --disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file --enable-libvpx --enable-gpl --extra-libs='/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libx264.a /Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libvpx.a'
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[vp8 @ 0xed8610] Warning: not compiled with thread support, using thread emulation
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, matroska,webm, from 'input.webm':
  Metadata:
    encoder         : QTmuxingAppLibWebM-0.0.1
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: vp8, yuv420p, 1920x1200, SAR 1:1 DAR 8:5, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: opus, 44100 Hz, mono (default)
[abuffer @ 0xec7410] Unable to parse option value "(null)" as sample format
    Last message repeated 1 times
    Last message repeated 1 times
[abuffer @ 0xec7410] Error setting option sample_fmt to value (null).
[graph 1 input from stream 0:1 @ 0xec7390] Error applying options to the filter.
Error opening filters!
Finished processing (took 96ms)

Can you please advise on how to fix this?

Thanks

Firefox supported?

Both the demo's are not working on Firefox 25.0.1 but works fine on Google Chrome, the processing animation keeps rotating and nothing happens any ideas why?

Compile problem with stock Ubuntu 13.10 emscripten

Hi!

I'm trying to compile videoconvert.js with emscripten. I've installed Ubuntu 13.10 into Virtualbox and simply installed emscripten from the universe packages using apt.

This gives me the following Emscripten version:

user@ubuntu-emscripten:~/videoconverter.js/build$ emcc -v
emcc (Emscripten GCC-like replacement + linker emulating GNU ld ) 2.0
Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: i386-pc-linux-gnu
Thread model: posix

When i try to compile videoconvert.js using build/build_lgpl.sh compilation halts at this point:

WARNING  emcc: -Ox flags ignored, since not generating JavaScript
CC      libavutil/error.o
libavutil/error.c:68:15: error: invalid argument type 'char *' to unary expression
        ret = AVERROR(strerror_r(AVUNERROR(errnum), errbuf, errbuf_size));
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavutil/error.h:39:21: note: expanded from macro 'AVERROR'
#define AVERROR(e) (-(e))   ///< Returns a negative error code from a POSIX error code, to return from library functions.
                    ^~~~
1 error generated.
ERROR    emcc: compiler frontend failed to generate LLVM bitcode, halting
make: *** [libavutil/error.o] Error 1

I'm very new to emscripten so i don't really know how should i move forward. Is this an environment error or a bug?

Reduce file size

I know, this is not easy but probably one of the biggest pitfalls of this project.

Emscripten generates lots of Javascript and I wonder how many of these lines are really not necessary?

I see you disabled a lot in the build script which is great. But I see you can optimize it further. You encode video based on images only, am I right? Then you won't need all demuxers. Have a look at my way:

> sudo ./../emscripten/emconfigure ./configure --enable-cross-compile 
--target-os=none --arch=x86_32 --cpu=generic --cc="./../emscripten/emcc" 
--extra-cflags="-m32" --extra-ldflags="-m32" --disable-avplay 
--disable-avprobe --disable-avserver --disable-doc --disable-pthreads 
--disable-w32threads --disable-network --disable-decoders 
--disable-hwaccels --disable-filters --disable-asm --disable-protocols 
--disable-parsers --disable-bsfs --disable-optimizations --disable-everything 
--enable-muxer=webm --enable-demuxer=image2 --enable-encoder="mjpeg,png,vp8,libvpx"

(taken from https://gist.github.com/binarykitchen/5329825)

Try to copy some of my above parameters and see if that helps reducing the file size. Especially the muxer/demuxers. And maybe the filters too (who neeeds these?) and so on ...

And at last, you always can optimize Javascipt the old fashioned way with an agressive minifier and gzip that?

Convert video more than 20s

Hi

We are using videoconverter.js in our project , it is very good project .

Only problem is we want convert video more than 20s and is not possible it take to long and trow a error about ram usage

Compiling into WebAssembly

What about compiling videoconverter.js to WebAssembly?

There are experimental native WebAssembly implementations for Google Chrome, Mozilla Firefox, Microsoft Edge and Apple Safari.

Does it upload?

hi
If the file s selected does the file uploaded to the server? sorry if its so dumb .

Browser crashes when loading large video files

When trying to load large files as ArrayBuffer, FileReader will try to load the entire file in the memory which eventually will cause the browser to crash. Is there a way to avoid this from happening?
In my use case I just need to extract the video metadata, so I tried slicing but it doesn't really help if the moov atom is at the end of the file. Any other suggestions will be appreciated!

Include x264 and libvpx

Hello again

Just to make it public, I'd welcome support for MP4 and WebM video files. With that support the videos would become compatible for the whole web for any browsers, yeah!

If you look at https://gist.github.com/binarykitchen/5230096 + https://gist.github.com/binarykitchen/5329825 you can see I managed to port x264 to Javascript at step 6 and libvpx to Javascript at step 7 but failed at the last step to port avconv.

Isn't it funny that you managed the one thing and I the other part? Together it might work ...

Do you think you could try the instructions at step 6 + 7 to make it work with the way you emscripten ffmpeg?

missing function: madvise when using ffmpeg-all-codecs.js -c:v libx264

The command arguments I'm using are:

arguments: ['-t','1', '-ss',startTime.toString(), '-i', 'name.mp4', '-vf', 'showinfo', '-strict',
'-2', '-c:v', 'libx264', 'output.mp4'],

my worker.js is importing ffmpeg-all-codec.js

output says its missing the function madvise (at the bottom)

output:

[h264 @ 0xee09b0] Warning: not compiled with thread support, using thread emulation

[aac @ 0xedf280] Warning: not compiled with thread support, using thread emulation

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'WIN_20151010_193627.MP4':

Metadata:

major_brand     : mp42

minor_version   : 0

compatible_brands: mp41isom

creation_time   : 2015-10-10 23:36:28

Duration: 00:00:03.32, start: 0.000000, bitrate: 5484 kb/s

Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], 5328 kb/s, 15.09 fps, 14.92 tbr, 30k tbn, 60 tbc (default)

Metadata:

  creation_time   : 2015-10-10 23:36:28

  handler_name    : VideoHandler

Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 161 kb/s (default)

Metadata:

  creation_time   : 2015-10-10 23:36:28

  handler_name    : SoundHandler

No pixel format specified, yuvj420p for H.264 encoding chosen.

Use -pix_fmt yuv420p for compatibility with outdated media players.

[libx264 @ 0xed9740] Warning: not compiled with thread support, using thread emulation

[libx264 @ 0xed9740] using SAR=1/1

[libx264 @ 0xed9740] using cpu capabilities: none!

missing function: madvise
-1
-1
ffmpeg-all-codecs.js:65913 Uncaught abort() at Error
at stackTrace (/scripts/ffmpeg-all-codecs.js:1082:15)
at abort (
/scripts/ffmpeg-all-codecs.js:65997:25)
at _madvise (/scripts/ffmpeg-all-codecs.js:62870:52)
at MLb (
/scripts/ffmpeg-all-codecs.js:64078:1057420)
at ULb (/scripts/ffmpeg-all-codecs.js:64078:1073603)
at Array.cPa (
/scripts/ffmpeg-all-codecs.js:64086:238174)
at _4a (/scripts/ffmpeg-all-codecs.js:64098:652222)
at Qh (
/scripts/ffmpeg-all-codecs.js:64070:157892)
at Object.Nh as _main
at Object.callMain (~/scripts/ffmpeg-all-codecs.js:65894:

same thing appears to happen even without the -c:v libx264 arguments. Any help?

Cannot Convert in mobile devices

When we try to convert the video through mobile we are not able to convert. And also in I.E and Firefox not able to convert the videos the scripts keeps running..

Quit command while running

Hey there,

I am trying to quit the encoding/decoding of a video.
The application is telling me to press [q] to stop or [?] for help.

Passing a q to videoconverter.js doesn't help ;)

Anyway, do you know of quitting the running command?

Live Video Streaming

After i discovered videoconverter.js i was of the idea of building an app like livestream procatser for a client.
Is it possible to stream video as normally done via ffmpeg

Thanks

'Pipe' raw image data to videoconverter.js

This is an absolutely awesome project - I've been waiting for something like this for ages!

Suppose I had a source of a lot of RGB pixel data coming out of JavaScript on a web page (maybe a Canvas or WebGL context) - how would I go about getting this into videoconverter?

There are examples of what you'd do on the command-line for ffmpeg, like these - but once I'd set up a web worker as in your examples, how could I go about pushing data into stdin?

The idea is I might be rendering something maybe a few minutes long with WebGL, and there would be too much data to store in RAM - so ideally I'd push each frame into the webworker when it was ready.

... or is it not possible as it is - since there's just the ffmpeg_run function which only returns when it's finished?

I guess potentially I could call ffmpeg with a few frames of uncompressed data, and ask it to append them to an existing video?

Progress information

Everything works fine but the progress info is outputs via stderr AS A SINGLE MESSAGE when the operation has completed. That's not very useful! The progress info should output as it happens. Is there an argument that will fix this? Or a Module property?

Converting Gif to WebM creates a corrupted video

I'm attempting to create a .webm video from a gif. I was able to use this rather bloated command passed to a web worker to create a .mp4 from a gif.

-i $input -y -strict experimental -acodec acc -ac 2 -ab 160k -vcodec libx264 -s $size -pix_fmt yuv420p -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 output.mp4

where $input is the name of the user file and $size is the size of the gif. For .webm conversion I'm using the following command.

-i $input -c:v libvpx -crf 12 -b:v 500k output.webm

This command works fine when run in the terminal of my local machine, but when run in my application or against the demo application it results in either an empty .webm file or one like this:
screenshot 2014-10-19 18 13 33

Any help would be appreciated.

%1 is not a valid win32 application

Hi Guys,

I was trying to compile ffmpeg using emscripten and i am getting %1 is not a valid win32 application on Windows 10 x64 bit machine.

Can you please help me out in this?

FirefoxOS app

It would be great to have a FxOS app for videoconverter.js, maybe with a reduced set of codecs. It will be a useful functionality for that OS to be able to reencode videos to reduce quality/size before sending them for example.

Closure compiler

I'd like to use closure compiler to minify the ffmpeg-all-codecs.js file but I can't. I tried running it locally and it ran out of ram. So I tried running it on the server and it said that the file has to be below 5000kb. Can you upload a "closure compiled" version please.

How to exec a concat filter?

Hey Guys,

your work is awesome.
I want to use it to concatenate 2 videos.
In Terminal it just works fine with normal ffmpeg

ffmpeg -i /Users/mduve/Desktop/big_buck_bunny.mp4 -i /Users/mduve/Desktop/big_buck_bunny.mp4 -filter_complex '[0:v] [0:a:0] [1:v] [1:a:0] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' output.mp4

If I try it in browser i got errors:

.....................................
[AVFilterGraph @ 0xf71020] No such filter: ''
Error configuring filters.

My call is:

worker.postMessage({
                type: 'command',
                arguments: [
                    "-i",
                    "big_buck_bunny.mp4",
                    "-i",
                    "big_buck_bunny_new.mp4",
                    "-filter_complex",
                    "[0:v]", "[0:a:0]" ,"[1:v]", "[1:a:0]", "concat=n=2:v=1:a=1", "[v]", "[a]",
                    "-map",
                    "'[v]'",
                    "-map" ,
                    "'[a]'",
                    "output.mp4"
                ],
                files: [{
                        data: vid1,
                        name: "big_buck_bunny.mp4"
                    },
                    {
                        data: vid2,
                        name: "big_buck_bunny_new.mp4"
                    }
                ]
            });

Can u help me finding my mistake?

Compiling problem with recent emscripten (1.29.4 or 1.31.0)

@bgrins Which version of emscripten can successfully build current videoconverter.js?

I try to build this project with emscripten 1.29.4 or 1.31.0 on linux, but encountered a few problems (using build_lgpl.sh), and I didn't find a solution to the last one.

  1. zlib build error
    Building of zlib generated this error:

    ERROR root: adler32.lo: Input file has an unknown suffix, don't know what to do with it!

    It seems we have to add --static to configure of zlib. Recently emscripten started to support shared library, and configure of zlib detected this and enabled shared library build. However, shared library build of zlib uses .lo file, which is not supported by emscripten, so the build failed. So we have to add --static to enforce static build.

  2. ffmpeg build error
    When emmake ffmpeg:

    libavformat/segment.c:694:13: error: implicit declaration of function
        'localtime_r' is invalid in C99
        [-Werror,-Wimplicit-function-declaration]
              localtime_r(&sec, &ti);
    

    It seems we may define -D_XOPEN_SOURCE=600 before configure of ffmpeg to make such code compile:

    CPPFLAGS="-D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" emconfigure ./configure --cc="emcc" --prefix=$(pwd)/../dist --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic \
    --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network \
    --disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file
    
  3. ffmpeg.js build error
    When excuting
    emcc -s OUTLINING_LIMIT=100000 -s VERBOSE=1 -s TOTAL_MEMORY=33554432 -O2 -v ffmpeg.bc -o ../ffmpeg.js --pre-js ../ffmpeg_pre.js --post-js ../ffmpeg_post.js

    Error is thrown:

    AssertionError: Error in optimizer: Assertion failed: undefined
    
    events.js:72
        throw er; // Unhandled 'error' event
              ^
    Error: write EPIPE
    at errnoException (net.js:901:11)
    at Object.afterWrite (net.js:718:19)
    
    events.js:72
        throw er; // Unhandled 'error' event
              ^
    Error: write EPIPE
    at errnoException (net.js:901:11)
    at Object.afterWrite (net.js:718:19)
    

Doubt related to Join and Merge Operations using compiled ffmpeg.js using emscripten

Hi,
I see that you have done quite a lot of great work on ffmpeg.js, so I thought you would help me in this.
I have been trying to use ffmpeg.js to join two audio files

The syntax is similar to :
-i female.mp3 -i female.mp3 -filter_complex "[0:0] [1:0] concat=n=2:v=0:a=1 [a]" -map "[a]" out.mp3

I keep getting this error:
Invalid stream specifier: "[a]"
Last message repeated 1 times
Stream map '"[a]"' matches no streams.

What am I doing wrong here. Am I not including the required libraries during compiling using emscripten or is it not possible to do this join/merge operation using ffmpeg.js at all.

Your advice would help me a great deal..
Thank you.

x264 comitted, but supported? Typo in docs

Hi there,
I am trying to run this command: -i input.webm -vcodec libx264 -pix_fmt yuv420p -strict -2 -acodec aac output.mp4

Here is my code:

var command = [ // https://twittercommunity.com/t/ffmpeg-mp4-upload-to-twitter-unsupported-error/68602/2?u=noitidart
    '-i', 'input.webm',
    '-vcodec', 'libx264',
    '-pix_fmt', 'yuv420p',
    '-strict', '-2',
    '-acodec', 'aac',
    'output.mp4'
]

var converted_files = ffmpeg_run({
    arguments: command,
    files: [{ data:(new Uint8Array(rec.arrbuf)), name:'input.webm' }],
    TOTAL_MEMORY: 268435456
});

I see x264 support was added in this commit - https://github.com/bgrins/videoconverter.js/tree/fe606e414d27ab7297a5d444bdba05ae839d035a

Can you please help me to run this command.

Error in documentation

Hi there, first of all congrats on this project, this is some js awesomeness!

I was playing around with the script, and noticed an error in the documentation on http://bgrins.github.io/videoconverter.js/ :

Just before running the command, the worker posts a "starting" message :

  postMessage({
    'type' : 'starting',
    'data' : module.arguments
  });

But in the page, the onmessage expects "start" :

  } else if (message.type == "start") {
    outputElement.textContent = "Worker has received command\n";
  }

Or am i dumb and did i misread something?

Bye
D

Add ability to decode opus codec

Is it possible to add the ability to decode the opus codec?

Running -codec returns a line like this on the all codecs version of ffmpeg.js

  E opus            Opus

How would I go about doing this?

I'm actually trying to do this, as a result of the missing opus codec I can't process the file:
-i input.webm output.webm

and get this

Received command: -i input.webm output.webm.  Processing with 268435456 bits.
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  9 2014 20:24:32 with emcc (Emscripten GCC-like replacement) 1.12.0 (commit 6960d2296299e96d43e694806f5d35799ef8d39c)
  configuration: --cc=emcc --prefix=/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist --extra-cflags='-I/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/include -v' --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network --disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file --enable-libvpx --enable-gpl --extra-libs='/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libx264.a /Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libvpx.a'
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[vp8 @ 0xed8c00] Warning: not compiled with thread support, using thread emulation
Guessed Channel Layout for  Input Stream #0.0 : mono
Input #0, matroska,webm, from 'input.webm':
  Metadata:
    encoder         : Chrome
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Audio: opus, 48000 Hz, mono (default)
    Stream #0:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
[abuffer @ 0xedd670] Unable to parse option value "(null)" as sample format
    Last message repeated 1 times
    Last message repeated 1 times
[abuffer @ 0xedd670] Error setting option sample_fmt to value (null).
[graph 1 input from stream 0:0 @ 0xedd600] Error applying options to the filter.
Error opening filters!
Finished processing (took 673ms)

When generate ffmpeg.js occurs error 'IndexError: string index out of range'

DEBUG root: invocation: /usr/bin/emcc -s OUTLINING_LIMIT=100000 -s VERBOSE=1 -s TOTAL_MEMORY=33554432 -O2 -v ffmpeg.bc --pre-js ../ffmpeg_pre.js --post-js ../ffmpeg_post.js
Traceback (most recent call last):
File "/usr/bin/emcc", line 1087, in
elif arg_ending.endswith(ASSEMBLY_ENDINGS) or shared.Building.is_bitcode(arg): # this should be bitcode, make sure it is valid
File "/usr/share/emscripten/tools/shared.py", line 1454, in is_bitcode
if b[0] == 'B' and b[1] == 'C':
IndexError: string index out of range

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.