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
fe28bd14
Commit
fe28bd14
authored
Sep 02, 2020
by
Jerome Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update build scripts and add ffmpeg.js
parent
359abee7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
8 deletions
+47
-8
main.yml
.github/workflows/main.yml
+3
-3
.gitmodules
.gitmodules
+3
-0
testdata
testdata
+1
-0
.gitignore
wasm/.gitignore
+1
-0
build-ffmpeg.sh
wasm/build-scripts/build-ffmpeg.sh
+9
-4
configure.sh
wasm/build-scripts/configure.sh
+1
-1
ffmpeg.js
wasm/ffmpeg.js
+29
-0
No files found.
.github/workflows/main.yml
View file @
fe28bd14
name
:
Pt.3 FFmpeg
with x264
name
:
Pt.3 FFmpeg
v0.1
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on
:
...
...
@@ -22,7 +22,7 @@ jobs:
bash build-with-docker.sh
-
uses
:
actions/upload-artifact@master
with
:
name
:
ffmpeg-linux
name
:
ffmpeg-
core-
linux
path
:
wasm/dist
macos-build
:
runs-on
:
macos-latest
...
...
@@ -45,7 +45,7 @@ jobs:
bash build.sh
-
uses
:
actions/upload-artifact@master
with
:
name
:
ffmpeg-macos
name
:
ffmpeg-
core-
macos
path
:
wasm/dist
# Not working with error messsage:
# C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\bin\ar.exe: libavfilter/vsink_null: No such file or directory
...
...
.gitmodules
0 → 100644
View file @
fe28bd14
[submodule "testdata"]
path = testdata
url = https://github.com/ffmpegwasm/testdata.git
testdata
@
de377941
Subproject commit de37794135511be2806ff02bd4dea28adbbf27db
wasm/.gitignore
0 → 100644
View file @
fe28bd14
*.mp4
wasm/build-scripts/build-ffmpeg.sh
View file @
fe28bd14
...
...
@@ -7,10 +7,15 @@ ARGS=(
-I
.
-I
./fftools
-Llibavcodec
-Llibavdevice
-Llibavfilter
-Llibavformat
-Llibavresample
-Llibavutil
-Llibpostproc
-Llibswscale
-Llibswresample
-Qunused-arguments
-o
wasm/dist/ffmpeg.js fftools/ffmpeg_opt.c fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/cmdutils.c fftools/ffmpeg.c
-o
wasm/dist/ffmpeg
-core
.js fftools/ffmpeg_opt.c fftools/ffmpeg_filter.c fftools/ffmpeg_hw.c fftools/cmdutils.c fftools/ffmpeg.c
-lavdevice
-lavfilter
-lavformat
-lavcodec
-lswresample
-lswscale
-lavutil
-lm
-s
USE_SDL
=
2
# use SDL2
-s
USE_PTHREADS
=
1
# enable pthreads support
-s
INITIAL_MEMORY
=
33554432
# 33554432 bytes = 32 MB
-O3
# Optimize code with performance first
-s
USE_SDL
=
2
# use SDL2
-s
USE_PTHREADS
=
1
# enable pthreads support
-s
PROXY_TO_PTHREAD
=
1
# detach main() from browser/UI main thread
-s
INVOKE_RUN
=
0
# not to run the main() in the beginning
-s
EXPORTED_FUNCTIONS
=
"[_main, _proxy_main]"
# export main and proxy_main funcs
-s
EXTRA_EXPORTED_RUNTIME_METHODS
=
"[FS, cwrap, setValue, writeAsciiToMemory]"
# export preamble funcs
-s
INITIAL_MEMORY
=
33554432
# 33554432 bytes = 32 MB
)
emcc
"
${
ARGS
[@]
}
"
wasm/build-scripts/configure.sh
View file @
fe28bd14
...
...
@@ -2,7 +2,7 @@
set
-eo
pipefail
CFLAGS
=
"-s USE_PTHREADS"
CFLAGS
=
"-s USE_PTHREADS
-O3
"
LDFLAGS
=
"
$CFLAGS
-s INITIAL_MEMORY=33554432"
# 33554432 bytes = 32 MB
ARGS
=(
--target-os
=
none
# use none to prevent any os specific configurations
...
...
wasm/ffmpeg.js
0 → 100644
View file @
fe28bd14
const
fs
=
require
(
'fs'
);
const
Module
=
require
(
'./dist/ffmpeg-core'
);
Module
.
onRuntimeInitialized
=
()
=>
{
const
data
=
Uint8Array
.
from
(
fs
.
readFileSync
(
'../testdata/flame.avi'
));
Module
.
FS
.
writeFile
(
'flame.avi'
,
data
);
const
ffmpeg
=
Module
.
cwrap
(
'proxy_main'
,
'number'
,
[
'number'
,
'number'
]);
const
args
=
[
'ffmpeg'
,
'-hide_banner'
,
'-i'
,
'flame.avi'
,
'flame.mp4'
];
const
argsPtr
=
Module
.
_malloc
(
args
.
length
*
Uint32Array
.
BYTES_PER_ELEMENT
);
args
.
forEach
((
s
,
idx
)
=>
{
const
buf
=
Module
.
_malloc
(
s
.
length
+
1
);
Module
.
writeAsciiToMemory
(
s
,
buf
);
Module
.
setValue
(
argsPtr
+
(
Uint32Array
.
BYTES_PER_ELEMENT
*
idx
),
buf
,
'i32'
);
});
ffmpeg
(
args
.
length
,
argsPtr
);
/*
* The execution of ffmpeg is not synchronized,
* so we need to set a timer to wait for it completes.
*/
const
timer
=
setInterval
(()
=>
{
if
(
Module
.
FS
.
readdir
(
'.'
).
find
(
f
=>
f
===
'flame.mp4'
)
!==
-
1
)
{
clearInterval
(
timer
);
const
output
=
Module
.
FS
.
readFile
(
'flame.mp4'
);
fs
.
writeFileSync
(
'flame.mp4'
,
output
);
}
},
500
);
};
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