Skip to content

Commit

Permalink
Enable JPEG/PNG/ZLIB
Browse files Browse the repository at this point in the history
Should be often needed.

Fixes #47
  • Loading branch information
Kagami committed Apr 25, 2020
1 parent 081ddbd commit 66343d7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ POST_JS_SYNC = build/post-sync.js
POST_JS_WORKER = build/post-worker.js

COMMON_FILTERS = aresample scale crop overlay hstack vstack
COMMON_DEMUXERS = matroska ogg mov mp3 wav concat
COMMON_DECODERS = vp8 h264 vorbis opus mp3 aac pcm_s16le
COMMON_DEMUXERS = matroska ogg mov mp3 wav image2 concat
COMMON_DECODERS = vp8 h264 vorbis opus mp3 aac pcm_s16le mjpeg png

WEBM_MUXERS = webm ogg null
WEBM_ENCODERS = libvpx_vp8 libopus
Expand Down Expand Up @@ -183,7 +183,7 @@ FFMPEG_COMMON_ARGS = \
--disable-sdl2 \
--disable-securetransport \
--disable-xlib \
--disable-zlib
--enable-zlib

build/ffmpeg-webm/ffmpeg.bc: $(WEBM_SHARED_DEPS)
cd build/ffmpeg-webm && \
Expand All @@ -193,7 +193,7 @@ build/ffmpeg-webm/ffmpeg.bc: $(WEBM_SHARED_DEPS)
$(addprefix --enable-muxer=,$(WEBM_MUXERS)) \
--enable-libopus \
--enable-libvpx \
--extra-cflags="-I../libvpx/dist/include" \
--extra-cflags="-s USE_ZLIB=1 -I../libvpx/dist/include" \
--extra-ldflags="-L../libvpx/dist/lib" \
&& \
emmake make -j && \
Expand All @@ -208,7 +208,7 @@ build/ffmpeg-mp4/ffmpeg.bc: $(MP4_SHARED_DEPS)
--enable-gpl \
--enable-libmp3lame \
--enable-libx264 \
--extra-cflags="-I../lame/dist/include" \
--extra-cflags="-s USE_ZLIB=1 -I../lame/dist/include" \
--extra-ldflags="-L../lame/dist/lib" \
&& \
emmake make -j && \
Expand Down
Binary file added test/test-frame1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/test-frame1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/test-frame2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/test-frame2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 18 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ describe("WebM", function() {
expect(file.data).to.be.an.instanceof(Uint8Array);
});

/*it("should encode sequence of frames to WebM", function() {
it("should encode JPEGs to WebM", function() {
var res = ffmpeg_webm({
// FIXME(Kagami): pattern_type=sequence doesn't work with NODEFS
// for some reason.
Expand All @@ -269,7 +269,23 @@ describe("WebM", function() {
var file = res.MEMFS[0];
expect(file.name).to.equal("out.webm");
expect(file.data.length).to.be.above(0);
});*/
});

it("should encode PNGs to WebM", function() {
var res = ffmpeg_webm({
arguments: [
"-pattern_type", "glob",
"-i", "/data/test-frame*.png",
"out.webm",
],
print: noop,
printErr: noop,
mounts: [{type: "NODEFS", opts: {root: "test"}, mountpoint: "/data"}],
});
var file = res.MEMFS[0];
expect(file.name).to.equal("out.webm");
expect(file.data.length).to.be.above(0);
});
});

describe("Worker", function() {
Expand Down

0 comments on commit 66343d7

Please sign in to comment.