Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webassembly version #63

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 10 additions & 3 deletions build/build_all_codecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ make clean
emconfigure ./configure --prefix=$(pwd)/../dist --disable-examples --disable-docs \
--disable-runtime-cpu-detect --disable-multithread --disable-optimizations \
--target=generic-gnu
sed -i.bak -e 's/ARFLAGS = -crs$(if $(quiet),,v)/ARFLAGS = crs$(if $(quiet),,v)/' ./libs-generic-gnu.mk
emmake make
emmake make install
cd ..

# x264-snapshot-20140501-2245
# x264-snapshot-20160910-2245
cd x264
make clean
patch --forward ./configure ../fix_x264_configure.patch
emconfigure ./configure --disable-thread --disable-asm \
--host=i686-pc-linux-gnu \
--disable-cli --enable-static --disable-gpl --prefix=$(pwd)/../dist
--host=i686-pc-linux-gnu \
--disable-cli --enable-static --disable-gpl --prefix=$(pwd)/../dist
emmake make
emmake make install
cd ..
Expand All @@ -53,6 +55,10 @@ emconfigure ./configure --cc="emcc" --prefix=$(pwd)/../dist --extra-cflags="-I$(
--disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file \
--enable-libvpx --enable-gpl --extra-libs="$(pwd)/../dist/lib/libx264.a $(pwd)/../dist/lib/libvpx.a"

# Because there doesn't appear to be a way to tell configure that arc4random isn't actually there
sed -i.bak -e 's/#define HAVE_ARC4RANDOM 1/#define HAVE_ARC4RANDOM 0/' ./config.h
sed -i.bak -e 's/HAVE_ARC4RANDOM=yes/HAVE_ARC4RANDOM=no/' ./config.mak

# If we --enable-libx264 there is an error. Instead just act like it is there, extra-libs seems to work.
sed -i '' 's/define CONFIG_LIBX264 0/define CONFIG_LIBX264 1/' config.h
sed -i '' 's/define CONFIG_LIBX264_ENCODER 0/define CONFIG_LIBX264_ENCODER 1/' config.h
Expand Down Expand Up @@ -83,5 +89,6 @@ cd dist
emcc -s OUTLINING_LIMIT=100000 -s VERBOSE=1 -s TOTAL_MEMORY=33554432 -O2 -v ffmpeg.bc libx264.bc libvpx.bc libz.bc -o ../ffmpeg-all-codecs.js --pre-js ../ffmpeg_pre.js --post-js ../ffmpeg_post.js
cd ..

cp ffmpeg-all-codecs.js* ../demo

echo "Finished Build"
17 changes: 12 additions & 5 deletions build/build_lgpl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ cd ffmpeg
#--enable-small

make clean
emconfigure ./configure --cc="emcc" --prefix=$(pwd)/../dist --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic \

CPPFLAGS="-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 \
--disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file

# Because there doesn't appear to be a way to tell configure that arc4random isn't actually there
sed -i.bak -e 's/#define HAVE_ARC4RANDOM 1/#define HAVE_ARC4RANDOM 0/' ./config.h
sed -i.bak -e 's/HAVE_ARC4RANDOM=yes/HAVE_ARC4RANDOM=no/' ./config.mak

make
make -j4
make install


Expand All @@ -31,12 +36,14 @@ cd dist

rm *.bc

cp lib/libz.a dist/libz.bc
cp lib/libz.a libz.bc
cp ../ffmpeg/ffmpeg ffmpeg.bc

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
emcc -v -s TOTAL_MEMORY=33554432 -Os ffmpeg.bc -o ../ffmpeg.js --pre-js ../ffmpeg_pre.js --post-js ../ffmpeg_post.js -s WASM=1 -s "BINARYEN_METHOD='native-wasm'" -s ALLOW_MEMORY_GROWTH=1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, that's a simple change to get wasm working


cd ..

cp ffmpeg.js* ../demo
cp ffmpeg.wasm* ../demo

echo "Finished Build"
8 changes: 4 additions & 4 deletions build/fetch_sources.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
wget http://ffmpeg.org/releases/ffmpeg-2.3.tar.bz2
tar -xvf ffmpeg-2.3.tar.bz2
mv ffmpeg-2.3 ffmpeg
rm ffmpeg-2.3.tar.bz2
wget http://ffmpeg.org/releases/ffmpeg-3.1.3.tar.bz2
tar -xvf ffmpeg-3.1.3.tar.bz2
mv ffmpeg-3.1.3 ffmpeg
rm ffmpeg-3.1.3.tar.bz2
Loading