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
733cf0ad
Commit
733cf0ad
authored
Apr 11, 2012
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: add -benchmark_all option.
parent
81a9d32f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
1 deletion
+36
-1
Changelog
Changelog
+1
-0
ffmpeg.texi
doc/ffmpeg.texi
+3
-0
ffmpeg.c
ffmpeg.c
+32
-1
No files found.
Changelog
View file @
733cf0ad
...
@@ -24,6 +24,7 @@ version next:
...
@@ -24,6 +24,7 @@ version next:
- removelogo filter
- removelogo filter
- drop support for ffmpeg without libavfilter
- drop support for ffmpeg without libavfilter
- drawtext video filter: fontconfig support
- drawtext video filter: fontconfig support
- ffmpeg -benchmark_all option
version 0.10:
version 0.10:
...
...
doc/ffmpeg.texi
View file @
733cf0ad
...
@@ -716,6 +716,9 @@ Show benchmarking information at the end of an encode.
...
@@ -716,6 +716,9 @@ Show benchmarking information at the end of an encode.
Shows CPU time used and maximum memory consumption.
Shows CPU time used and maximum memory consumption.
Maximum memory consumption is not supported on all systems,
Maximum memory consumption is not supported on all systems,
it will usually display as 0 if not supported.
it will usually display as 0 if not supported.
@item -benchmark
_
all (@emph
{
global
}
)
Show benchmarking information during the encode.
Shows CPU time used in various steps (audio/video encode/decode).
@item -timelimit @var
{
duration
}
(@emph
{
global
}
)
@item -timelimit @var
{
duration
}
(@emph
{
global
}
)
Exit after ffmpeg has been running for @var
{
duration
}
seconds.
Exit after ffmpeg has been running for @var
{
duration
}
seconds.
@item -dump (@emph
{
global
}
)
@item -dump (@emph
{
global
}
)
...
...
ffmpeg.c
View file @
733cf0ad
...
@@ -133,6 +133,7 @@ static const char *subtitle_codec_name = NULL;
...
@@ -133,6 +133,7 @@ static const char *subtitle_codec_name = NULL;
static
int
file_overwrite
=
0
;
static
int
file_overwrite
=
0
;
static
int
no_file_overwrite
=
0
;
static
int
no_file_overwrite
=
0
;
static
int
do_benchmark
=
0
;
static
int
do_benchmark
=
0
;
static
int
do_benchmark_all
=
0
;
static
int
do_hex_dump
=
0
;
static
int
do_hex_dump
=
0
;
static
int
do_pkt_dump
=
0
;
static
int
do_pkt_dump
=
0
;
static
int
do_psnr
=
0
;
static
int
do_psnr
=
0
;
...
@@ -165,6 +166,7 @@ static float dts_error_threshold = 3600*30;
...
@@ -165,6 +166,7 @@ static float dts_error_threshold = 3600*30;
static
int
print_stats
=
1
;
static
int
print_stats
=
1
;
static
int
debug_ts
=
0
;
static
int
debug_ts
=
0
;
static
int
current_time
;
static
uint8_t
*
audio_buf
;
static
uint8_t
*
audio_buf
;
static
unsigned
int
allocated_audio_buf_size
;
static
unsigned
int
allocated_audio_buf_size
;
...
@@ -434,6 +436,23 @@ static int64_t getutime(void)
...
@@ -434,6 +436,23 @@ static int64_t getutime(void)
#endif
#endif
}
}
static
void
update_benchmark
(
const
char
*
fmt
,
...)
{
if
(
do_benchmark_all
)
{
int64_t
t
=
getutime
();
va_list
va
;
char
buf
[
1024
];
if
(
fmt
)
{
va_start
(
va
,
fmt
);
vsnprintf
(
buf
,
sizeof
(
buf
),
fmt
,
va
);
va_end
(
va
);
printf
(
"bench: %8"
PRIu64
" %s
\n
"
,
t
-
current_time
,
buf
);
}
current_time
=
t
;
}
}
static
void
reset_options
(
OptionsContext
*
o
,
int
is_input
)
static
void
reset_options
(
OptionsContext
*
o
,
int
is_input
)
{
{
const
OptionDef
*
po
=
options
;
const
OptionDef
*
po
=
options
;
...
@@ -1101,10 +1120,12 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
...
@@ -1101,10 +1120,12 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
}
}
got_packet
=
0
;
got_packet
=
0
;
update_benchmark
(
NULL
);
if
(
avcodec_encode_audio2
(
enc
,
&
pkt
,
frame
,
&
got_packet
)
<
0
)
{
if
(
avcodec_encode_audio2
(
enc
,
&
pkt
,
frame
,
&
got_packet
)
<
0
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Audio encoding failed (avcodec_encode_audio2)
\n
"
);
av_log
(
NULL
,
AV_LOG_FATAL
,
"Audio encoding failed (avcodec_encode_audio2)
\n
"
);
exit_program
(
1
);
exit_program
(
1
);
}
}
update_benchmark
(
"encode_audio %d.%d"
,
ost
->
file_index
,
ost
->
index
);
ret
=
pkt
.
size
;
ret
=
pkt
.
size
;
...
@@ -1601,7 +1622,9 @@ static void do_video_out(AVFormatContext *s, OutputStream *ost,
...
@@ -1601,7 +1622,9 @@ static void do_video_out(AVFormatContext *s, OutputStream *ost,
big_picture
.
pict_type
=
AV_PICTURE_TYPE_I
;
big_picture
.
pict_type
=
AV_PICTURE_TYPE_I
;
ost
->
forced_kf_index
++
;
ost
->
forced_kf_index
++
;
}
}
update_benchmark
(
NULL
);
ret
=
avcodec_encode_video2
(
enc
,
&
pkt
,
&
big_picture
,
&
got_packet
);
ret
=
avcodec_encode_video2
(
enc
,
&
pkt
,
&
big_picture
,
&
got_packet
);
update_benchmark
(
"encode_video %d.%d"
,
ost
->
file_index
,
ost
->
index
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Video encoding failed
\n
"
);
av_log
(
NULL
,
AV_LOG_FATAL
,
"Video encoding failed
\n
"
);
exit_program
(
1
);
exit_program
(
1
);
...
@@ -1835,7 +1858,9 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams)
...
@@ -1835,7 +1858,9 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams)
}
}
break
;
break
;
case
AVMEDIA_TYPE_VIDEO
:
case
AVMEDIA_TYPE_VIDEO
:
update_benchmark
(
NULL
);
ret
=
avcodec_encode_video2
(
enc
,
&
pkt
,
NULL
,
&
got_packet
);
ret
=
avcodec_encode_video2
(
enc
,
&
pkt
,
NULL
,
&
got_packet
);
update_benchmark
(
"encode_video %d.%d"
,
ost
->
file_index
,
ost
->
index
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Video encoding failed
\n
"
);
av_log
(
NULL
,
AV_LOG_FATAL
,
"Video encoding failed
\n
"
);
exit_program
(
1
);
exit_program
(
1
);
...
@@ -1970,7 +1995,9 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
...
@@ -1970,7 +1995,9 @@ static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
avcodec_get_frame_defaults
(
ist
->
decoded_frame
);
avcodec_get_frame_defaults
(
ist
->
decoded_frame
);
decoded_frame
=
ist
->
decoded_frame
;
decoded_frame
=
ist
->
decoded_frame
;
update_benchmark
(
NULL
);
ret
=
avcodec_decode_audio4
(
avctx
,
decoded_frame
,
got_output
,
pkt
);
ret
=
avcodec_decode_audio4
(
avctx
,
decoded_frame
,
got_output
,
pkt
);
update_benchmark
(
"decode_audio %d.%d"
,
ist
->
file_index
,
ist
->
st
->
index
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
return
ret
;
return
ret
;
}
}
...
@@ -2085,8 +2112,10 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
...
@@ -2085,8 +2112,10 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
pkt
->
dts
=
ist
->
dts
;
pkt
->
dts
=
ist
->
dts
;
*
pkt_pts
=
AV_NOPTS_VALUE
;
*
pkt_pts
=
AV_NOPTS_VALUE
;
update_benchmark
(
NULL
);
ret
=
avcodec_decode_video2
(
ist
->
st
->
codec
,
ret
=
avcodec_decode_video2
(
ist
->
st
->
codec
,
decoded_frame
,
got_output
,
pkt
);
decoded_frame
,
got_output
,
pkt
);
update_benchmark
(
"decode_video %d.%d"
,
ist
->
file_index
,
ist
->
st
->
index
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
@@ -5068,6 +5097,8 @@ static const OptionDef options[] = {
...
@@ -5068,6 +5097,8 @@ static const OptionDef options[] = {
{
"dframes"
,
HAS_ARG
|
OPT_FUNC2
,
{(
void
*
)
opt_data_frames
},
"set the number of data frames to record"
,
"number"
},
{
"dframes"
,
HAS_ARG
|
OPT_FUNC2
,
{(
void
*
)
opt_data_frames
},
"set the number of data frames to record"
,
"number"
},
{
"benchmark"
,
OPT_BOOL
|
OPT_EXPERT
,
{(
void
*
)
&
do_benchmark
},
{
"benchmark"
,
OPT_BOOL
|
OPT_EXPERT
,
{(
void
*
)
&
do_benchmark
},
"add timings for benchmarking"
},
"add timings for benchmarking"
},
{
"benchmark_all"
,
OPT_BOOL
|
OPT_EXPERT
,
{(
void
*
)
&
do_benchmark_all
},
"add timings for each task"
},
{
"timelimit"
,
HAS_ARG
,
{(
void
*
)
opt_timelimit
},
"set max runtime in seconds"
,
"limit"
},
{
"timelimit"
,
HAS_ARG
,
{(
void
*
)
opt_timelimit
},
"set max runtime in seconds"
,
"limit"
},
{
"dump"
,
OPT_BOOL
|
OPT_EXPERT
,
{(
void
*
)
&
do_pkt_dump
},
{
"dump"
,
OPT_BOOL
|
OPT_EXPERT
,
{(
void
*
)
&
do_pkt_dump
},
"dump each input packet"
},
"dump each input packet"
},
...
@@ -5233,7 +5264,7 @@ int main(int argc, char **argv)
...
@@ -5233,7 +5264,7 @@ int main(int argc, char **argv)
exit_program
(
1
);
exit_program
(
1
);
}
}
ti
=
getutime
();
current_time
=
ti
=
getutime
();
if
(
transcode
(
output_files
,
nb_output_files
,
input_files
,
nb_input_files
)
<
0
)
if
(
transcode
(
output_files
,
nb_output_files
,
input_files
,
nb_input_files
)
<
0
)
exit_program
(
1
);
exit_program
(
1
);
ti
=
getutime
()
-
ti
;
ti
=
getutime
()
-
ti
;
...
...
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