Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
6d5d9246
Commit
6d5d9246
authored
Jun 28, 2015
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avconv: move handling the 2pass logfile into avconv_opt
It more logically belongs there.
parent
59245e0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
34 deletions
+34
-34
avconv.c
avconv.c
+0
-34
avconv_opt.c
avconv_opt.c
+34
-0
No files found.
avconv.c
View file @
6d5d9246
...
@@ -93,8 +93,6 @@ static int nb_frames_drop = 0;
...
@@ -93,8 +93,6 @@ static int nb_frames_drop = 0;
static
int
transcoding_finished
;
static
int
transcoding_finished
;
#endif
#endif
#define DEFAULT_PASS_LOGFILENAME_PREFIX "av2pass"
InputStream
**
input_streams
=
NULL
;
InputStream
**
input_streams
=
NULL
;
int
nb_input_streams
=
0
;
int
nb_input_streams
=
0
;
InputFile
**
input_files
=
NULL
;
InputFile
**
input_files
=
NULL
;
...
@@ -1860,38 +1858,6 @@ static int transcode_init(void)
...
@@ -1860,38 +1858,6 @@ static int transcode_init(void)
abort
();
abort
();
break
;
break
;
}
}
/* two pass mode */
if
((
enc_ctx
->
flags
&
(
CODEC_FLAG_PASS1
|
CODEC_FLAG_PASS2
)))
{
char
logfilename
[
1024
];
FILE
*
f
;
snprintf
(
logfilename
,
sizeof
(
logfilename
),
"%s-%d.log"
,
ost
->
logfile_prefix
?
ost
->
logfile_prefix
:
DEFAULT_PASS_LOGFILENAME_PREFIX
,
i
);
if
(
!
strcmp
(
ost
->
enc
->
name
,
"libx264"
))
{
av_dict_set
(
&
ost
->
encoder_opts
,
"stats"
,
logfilename
,
AV_DICT_DONT_OVERWRITE
);
}
else
{
if
(
enc_ctx
->
flags
&
CODEC_FLAG_PASS1
)
{
f
=
fopen
(
logfilename
,
"wb"
);
if
(
!
f
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Cannot write log file '%s' for pass-1 encoding: %s
\n
"
,
logfilename
,
strerror
(
errno
));
exit_program
(
1
);
}
ost
->
logfile
=
f
;
}
else
{
char
*
logbuffer
;
size_t
logbuffer_size
;
if
(
cmdutils_read_file
(
logfilename
,
&
logbuffer
,
&
logbuffer_size
)
<
0
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Error reading log file '%s' for pass-2 encoding
\n
"
,
logfilename
);
exit_program
(
1
);
}
enc_ctx
->
stats_in
=
logbuffer
;
}
}
}
}
}
}
}
...
...
avconv_opt.c
View file @
6d5d9246
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
#include "libavutil/pixdesc.h"
#include "libavutil/pixdesc.h"
#include "libavutil/pixfmt.h"
#include "libavutil/pixfmt.h"
#define DEFAULT_PASS_LOGFILENAME_PREFIX "av2pass"
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
#define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
{\
{\
int i, ret;\
int i, ret;\
...
@@ -1174,6 +1176,38 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
...
@@ -1174,6 +1176,38 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
!
(
ost
->
logfile_prefix
=
av_strdup
(
ost
->
logfile_prefix
)))
!
(
ost
->
logfile_prefix
=
av_strdup
(
ost
->
logfile_prefix
)))
exit_program
(
1
);
exit_program
(
1
);
if
(
do_pass
)
{
char
logfilename
[
1024
];
FILE
*
f
;
snprintf
(
logfilename
,
sizeof
(
logfilename
),
"%s-%d.log"
,
ost
->
logfile_prefix
?
ost
->
logfile_prefix
:
DEFAULT_PASS_LOGFILENAME_PREFIX
,
i
);
if
(
!
strcmp
(
ost
->
enc
->
name
,
"libx264"
))
{
av_dict_set
(
&
ost
->
encoder_opts
,
"stats"
,
logfilename
,
AV_DICT_DONT_OVERWRITE
);
}
else
{
if
(
video_enc
->
flags
&
CODEC_FLAG_PASS1
)
{
f
=
fopen
(
logfilename
,
"wb"
);
if
(
!
f
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Cannot write log file '%s' for pass-1 encoding: %s
\n
"
,
logfilename
,
strerror
(
errno
));
exit_program
(
1
);
}
ost
->
logfile
=
f
;
}
else
{
char
*
logbuffer
;
size_t
logbuffer_size
;
if
(
cmdutils_read_file
(
logfilename
,
&
logbuffer
,
&
logbuffer_size
)
<
0
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Error reading log file '%s' for pass-2 encoding
\n
"
,
logfilename
);
exit_program
(
1
);
}
video_enc
->
stats_in
=
logbuffer
;
}
}
}
MATCH_PER_STREAM_OPT
(
forced_key_frames
,
str
,
ost
->
forced_keyframes
,
oc
,
st
);
MATCH_PER_STREAM_OPT
(
forced_key_frames
,
str
,
ost
->
forced_keyframes
,
oc
,
st
);
if
(
ost
->
forced_keyframes
)
if
(
ost
->
forced_keyframes
)
ost
->
forced_keyframes
=
av_strdup
(
ost
->
forced_keyframes
);
ost
->
forced_keyframes
=
av_strdup
(
ost
->
forced_keyframes
);
...
...
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