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
d7ccf9bb
Commit
d7ccf9bb
authored
Oct 29, 2020
by
Jerome Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fdk-aac build scripts, tests and examples
parent
f588d9b9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
1 deletion
+81
-1
build.sh
build.sh
+2
-0
build-fdk-aac.sh
wasm/build-scripts/build-fdk-aac.sh
+16
-0
build-ffmpeg.sh
wasm/build-scripts/build-ffmpeg.sh
+1
-1
var.sh
wasm/build-scripts/var.sh
+2
-0
fdk-aac.html
wasm/examples/browser/fdk-aac.html
+42
-0
fdk-aac.test.js
wasm/tests/fdk-aac.test.js
+18
-0
No files found.
build.sh
View file @
d7ccf9bb
...
...
@@ -18,6 +18,8 @@ $SCRIPT_ROOT/build-libvpx.sh
$SCRIPT_ROOT
/build-wavpack.sh
# build lame
$SCRIPT_ROOT
/build-lame.sh
# build fdk-aac
$SCRIPT_ROOT
/build-fdk-aac.sh
# configure FFmpeg with Emscripten
$SCRIPT_ROOT
/configure-ffmpeg.sh
# build ffmpeg.wasm core
...
...
wasm/build-scripts/build-fdk-aac.sh
0 → 100755
View file @
d7ccf9bb
#!/bin/bash
set
-euo
pipefail
source
$(
dirname
$0
)
/var.sh
LIB_PATH
=
third_party/fdk-aac
FLAGS
=
"-s USE_PTHREADS=1
$OPTIM_FLAGS
"
CONF_FLAGS
=(
--prefix
=
$BUILD_DIR
# install library in a build directory for FFmpeg to include
--host
=
i686-linux
# use i686 linux
--disable-shared
# disable shared library
)
echo
"CONF_FLAGS=
${
CONF_FLAGS
[@]
}
"
(
cd
$LIB_PATH
&&
emconfigure ./autogen.sh
&&
emconfigure ./configure
"
${
CONF_FLAGS
[@]
}
"
)
emmake make
-C
$LIB_PATH
clean
emmake make
-C
$LIB_PATH
install
-j
wasm/build-scripts/build-ffmpeg.sh
View file @
d7ccf9bb
...
...
@@ -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
-lvpx
-lwavpack
-lmp3lame
-pthread
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lpostproc
-lm
-lx264
-lvpx
-lwavpack
-lmp3lame
-
lfdk-aac
-
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/var.sh
View file @
d7ccf9bb
...
...
@@ -42,10 +42,12 @@ FFMPEG_CONFIG_FLAGS_BASE=(
--disable-programs
# disable programs build (incl. ffplay, ffprobe & ffmpeg)
--disable-doc
# disable doc
--enable-gpl
# required by x264
--enable-nonfree
# required by fdk-aac
--enable-libx264
# enable x264
--enable-libvpx
# enable libvpx / webm
--enable-libwavpack
# enable libwavpack
--enable-libmp3lame
# enable libmp3lame
--enable-libfdk-aac
# enable libfdk-aac
--disable-debug
# disable debug info, required by closure
--disable-runtime-cpudetect
# disable runtime cpu detect
--disable-autodetect
# disable external libraries auto detect
...
...
wasm/examples/browser/fdk-aac.html
0 → 100644
View file @
d7ccf9bb
<html>
<head>
<style>
html
,
body
{
margin
:
0
;
width
:
100%
;
height
:
100%
}
body
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
}
</style>
</head>
<body>
<h3>
Upload a wav file to transcode to aac and play!
</h3>
<audio
id=
"output-audio"
controls
></audio><br/>
<input
type=
"file"
id=
"uploader"
>
<p
id=
"message"
>
Upload a wav file
</p>
<script
type=
"text/javascript"
src=
"./js/utils.js"
></script>
<script
type=
"text/javascript"
>
const
message
=
document
.
getElementById
(
'message'
);
const
transcode
=
async
({
target
:
{
files
}
})
=>
{
const
IN_FILE_NAME
=
'audio.wav'
;
const
OUT_FILE_NAME
=
'audio.aac'
;
const
args
=
[
'-i'
,
IN_FILE_NAME
,
'-c:a'
,
'libfdk_aac'
,
OUT_FILE_NAME
];
message
.
innerHTML
=
'Writing file to MEMFS'
;
const
data
=
new
Uint8Array
(
await
readFromBlobOrFile
(
files
[
0
]));
const
now
=
Date
.
now
();
console
.
time
(
`[
${
now
}
]
${
files
[
0
].
name
}
execution time`
);
message
.
innerHTML
=
'Start to transcode'
;
const
{
file
}
=
await
runFFmpeg
(
IN_FILE_NAME
,
data
,
args
,
OUT_FILE_NAME
)
const
audio
=
document
.
getElementById
(
'output-audio'
);
audio
.
src
=
URL
.
createObjectURL
(
new
Blob
([
file
.
buffer
],
{
type
:
'audio/aac'
}));
console
.
timeEnd
(
`[
${
now
}
]
${
files
[
0
].
name
}
execution time`
);
};
document
.
getElementById
(
'uploader'
).
addEventListener
(
'change'
,
transcode
);
</script>
<script
type=
"text/javascript"
src=
"../../dist/ffmpeg-core.js"
></script>
</body>
</html>
wasm/tests/fdk-aac.test.js
0 → 100644
View file @
d7ccf9bb
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.aac'
;
const
AAC_SIZE
=
4239
;
let
wavData
=
null
;
beforeAll
(()
=>
{
wavData
=
Uint8Array
.
from
(
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'data'
,
IN_FILE_NAME
)));
});
test
(
'convert wav to aac'
,
async
()
=>
{
const
args
=
[
'-i'
,
IN_FILE_NAME
,
'-c:a'
,
'libfdk_aac'
,
OUT_FILE_NAME
];
const
{
fileSize
}
=
await
runFFmpeg
(
IN_FILE_NAME
,
wavData
,
args
,
OUT_FILE_NAME
);
expect
(
fileSize
).
toBe
(
AAC_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