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
3011d509
Commit
3011d509
authored
Nov 02, 2020
by
Jerome Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable one core multiple run capabilities
parent
d3499d95
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
8 deletions
+39
-8
ffmpeg.c
fftools/ffmpeg.c
+15
-0
multiple-round.test.js
wasm/tests/multiple-round.test.js
+22
-7
utils.js
wasm/tests/utils.js
+2
-1
No files found.
fftools/ffmpeg.c
View file @
3011d509
...
...
@@ -4816,11 +4816,26 @@ static void log_callback_null(void *ptr, int level, const char *fmt, va_list vl)
{
}
static
void
init_variables
()
{
input_streams
=
NULL
;
nb_input_streams
=
0
;
input_files
=
NULL
;
nb_input_files
=
0
;
output_streams
=
NULL
;
nb_output_streams
=
0
;
output_files
=
NULL
;
nb_output_files
=
0
;
filtergraphs
=
NULL
;
nb_filtergraphs
=
0
;
ffmpeg_exited
=
0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
int
i
,
ret
;
BenchmarkTimeStamps
ti
;
init_variables
();
init_dynload
();
register_exit
(
ffmpeg_cleanup
);
...
...
wasm/tests/multiple-round.test.js
View file @
3011d509
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
createFFmpegCore
=
require
(
'../dist/ffmpeg-core'
);
const
{
TIMEOUT
}
=
require
(
'./config'
);
const
{
runFFmpeg
}
=
require
(
'./utils'
);
const
{
runFFmpeg
,
ffmpeg
}
=
require
(
'./utils'
);
const
IN_FILE_NAME
=
'video-1s.avi'
;
const
OUT_FILE_NAME
=
'video.mp4'
;
const
MP4_SIZE
=
38372
;
let
aviData
=
null
;
let
resolve
=
null
;
let
Core
=
null
;
beforeAll
(()
=>
{
beforeAll
(
async
()
=>
{
aviData
=
Uint8Array
.
from
(
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'data'
,
IN_FILE_NAME
)));
});
Core
=
await
createFFmpegCore
({
printErr
:
(
m
)
=>
{
},
print
:
(
m
)
=>
{
if
(
m
.
startsWith
(
'FFMPEG_END'
))
{
resolve
();
}
}
});
},
TIMEOUT
);
test
(
'should transcode to mp4 twice'
,
async
()
=>
{
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
const
args
=
[
'-i'
,
IN_FILE_NAME
,
OUT_FILE_NAME
];
const
{
fileSize
}
=
await
runFFmpeg
(
IN_FILE_NAME
,
aviData
,
args
,
OUT_FILE_NAME
);
expect
(
fileSize
).
toBe
(
MP4_SIZE
);
Core
.
FS
.
writeFile
(
IN_FILE_NAME
,
aviData
);
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
ffmpeg
(
Core
,
args
);
await
new
Promise
((
_resolve
)
=>
{
resolve
=
_resolve
});
expect
(
Core
.
FS
.
readFile
(
OUT_FILE_NAME
).
length
).
toBe
(
MP4_SIZE
);
Core
.
FS
.
unlink
(
OUT_FILE_NAME
);
}
},
TIMEOUT
);
wasm/tests/utils.js
View file @
3011d509
...
...
@@ -15,7 +15,7 @@ const ffmpeg = (Core, args) => {
'proxy_main'
,
'number'
,
[
'number'
,
'number'
],
parseArgs
(
Core
,
[
'ffmpeg'
,
'-nostdin'
,
...
args
]),
parseArgs
(
Core
,
[
'ffmpeg'
,
'-
hide_banner'
,
'-
nostdin'
,
...
args
]),
);
};
...
...
@@ -44,4 +44,5 @@ const runFFmpeg = async (ifilename, data, args, ofilename) => {
module
.
exports
=
{
runFFmpeg
,
ffmpeg
,
};
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