Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
mad goal: port avconv to javascript (part 2 of 2)
(perform steps 0 - 7 from first)
8. final step: port avconv to javascript!!
> cd avconv
> sudo find . -iname "*.o" -exec rm {} \;
> sudo make clean
> sudo make distclean
> git pull
> git clean -f
> 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"
> sudo ./../emscripten/emmake make
> sudo rm libavcodec/log2_tab.o
> sudo rm libavformat/log2_tab.o
> sudo ./../emscripten/emcc -O2 libavutil/*.o libavcodec/*.o libavformat/*.o libavdevice/*.o libavfilter/*.o libavresample/*.o libswscale/*.o *.o -o avconv.js --pre-js avconv_pre.js
in avconv_pre.js we have:
var fs = require('fs')
, path = require('path');
var source = 'tmp/images/'
, destination = 'tmp/video/';
var Module = {
'preRun': function() {
var sourcePath = FS.createPath('/', source, true, false)
, destinationPath = FS.createPath('/', destination, false, true);
var files = fs.readdirSync(source);
files.forEach(function(filename) {
var file = path.join(source, filename);
if (path.extname(filename) == '.jpg') {
var data = fs.readFileSync(file);
FS.createDataFile(sourcePath, filename, data, true, false);
'arguments': [
'-f', 'image2',
'-r', 15,
'-i', source + '%d.jpg',
'-an', // disable sound
'-b:v', '512k',
'-loglevel', 'info',
'-c:v', 'libvpx',
'-r', '25',
'-y', destination + 'test.webm'

This comment has been minimized.

Copy link
Owner Author

@binarykitchen binarykitchen commented May 14, 2013

And here I am stuck. ported avconv.js is unable to read local images, see unsolved github issue emscripten-core/emscripten#1042

how to reproduce? just put an image sequence in the sub-folder tmp/images and run node avconv.js. then you should see this error message:
... tmp/images/%d.jpg: No such file or directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment