Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d30ad812
Commit
d30ad812
authored
Nov 13, 2020
by
Jerome Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add opus build scripts and tests
parent
29c72e41
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
1 deletion
+45
-1
build.sh
build.sh
+2
-0
build-ffmpeg.sh
wasm/build-scripts/build-ffmpeg.sh
+1
-1
build-opus.sh
wasm/build-scripts/build-opus.sh
+23
-0
configure-ffmpeg.sh
wasm/build-scripts/configure-ffmpeg.sh
+1
-0
opus.test.js
wasm/tests/opus.test.js
+18
-0
No files found.
build.sh
View file @
d30ad812
...
...
@@ -28,6 +28,8 @@ $SCRIPT_ROOT/build-ogg.sh
$SCRIPT_ROOT
/build-vorbis.sh
# build theora
$SCRIPT_ROOT
/build-theora.sh
# build opus
$SCRIPT_ROOT
/build-opus.sh
# build freetype2
$SCRIPT_ROOT
/build-freetype2.sh
# build aom (disabled as it is extremely slow)
...
...
wasm/build-scripts/build-ffmpeg.sh
View file @
d30ad812
...
...
@@ -9,7 +9,7 @@ FLAGS=(
-I
.
-I
./fftools
-I
$BUILD_DIR
/include
-Llibavcodec
-Llibavdevice
-Llibavfilter
-Llibavformat
-Llibavresample
-Llibavutil
-Llibpostproc
-Llibswscale
-Llibswresample
-L
$BUILD_DIR
/lib
-Wno-deprecated-declarations
-Wno-pointer-sign
-Wno-implicit-int-float-conversion
-Wno-switch
-Wno-parentheses
-Qunused-arguments
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lx264
-lx265
-lvpx
-lwavpack
-lmp3lame
-lfdk-aac
-lvorbis
-lvorbisenc
-lvorbisfile
-logg
-ltheora
-ltheoraenc
-ltheoradec
-lz
-lfreetype
-pthread
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lx264
-lx265
-lvpx
-lwavpack
-lmp3lame
-lfdk-aac
-lvorbis
-lvorbisenc
-lvorbisfile
-logg
-ltheora
-ltheoraenc
-ltheoradec
-lz
-lfreetype
-
lopus
-
pthread
fftools/ffmpeg_opt.c fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/cmdutils.c fftools/ffmpeg.c
-o
wasm/dist/ffmpeg-core.js
-s
USE_SDL
=
2
# use SDL2
...
...
wasm/build-scripts/build-opus.sh
0 → 100755
View file @
d30ad812
#!/bin/bash
set
-euo
pipefail
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/opus
CFLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-gnu
# use i686 linux
--enable-shared
=
no
# not to build shared library
--disable-asm
# not to use asm
--disable-rtcd
# not to detect cpu capabilities
--disable-doc
# not to build docs
--disable-extra-programs
# not to build demo and tests
--disable-stack-protector
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
\
emconfigure ./autogen.sh
&&
\
CFLAGS
=
$CFLAGS
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/configure-ffmpeg.sh
View file @
d30ad812
...
...
@@ -17,6 +17,7 @@ FLAGS=(
--enable-libtheora
# enable libtheora
--enable-libvorbis
# enable libvorbis
--enable-libfreetype
# enable freetype
--enable-libopus
# enable opus
# --enable-libaom # enable libaom
)
echo
"FFMPEG_CONFIG_FLAGS=
${
FLAGS
[@]
}
"
...
...
wasm/tests/opus.test.js
0 → 100644
View file @
d30ad812
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
{
TIMEOUT
}
=
require
(
'./config'
);
const
{
runFFmpeg
}
=
require
(
'./utils'
);
const
IN_FILE_NAME
=
'audio-1s.wav'
;
const
OUT_FILE_NAME
=
'audio.opus'
;
const
FILE_SIZE
=
12793
;
let
wavData
=
null
;
beforeAll
(()
=>
{
wavData
=
Uint8Array
.
from
(
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'data'
,
IN_FILE_NAME
)));
});
test
(
'convert wav to mp3'
,
async
()
=>
{
const
args
=
[
'-i'
,
IN_FILE_NAME
,
'-c:a'
,
'libopus'
,
OUT_FILE_NAME
];
const
{
fileSize
}
=
await
runFFmpeg
(
IN_FILE_NAME
,
wavData
,
args
,
OUT_FILE_NAME
);
expect
(
fileSize
).
toBe
(
FILE_SIZE
);
},
TIMEOUT
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment