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
62940bb4
Commit
62940bb4
authored
Jun 16, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: initialise encoders earlier.
Fixes choosing supported samplerate and framerate.
parent
9446d759
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
ffmpeg.c
ffmpeg.c
+6
-6
No files found.
ffmpeg.c
View file @
62940bb4
...
...
@@ -2164,6 +2164,8 @@ static int transcode(AVFormatContext **output_files,
abort
();
}
}
else
{
if
(
!
ost
->
enc
)
ost
->
enc
=
avcodec_find_encoder
(
ost
->
st
->
codec
->
codec_id
);
switch
(
codec
->
codec_type
)
{
case
AVMEDIA_TYPE_AUDIO
:
ost
->
fifo
=
av_fifo_alloc
(
1024
);
...
...
@@ -2175,7 +2177,7 @@ static int transcode(AVFormatContext **output_files,
if
(
icodec
->
lowres
)
codec
->
sample_rate
>>=
icodec
->
lowres
;
}
choose_sample_rate
(
ost
->
st
,
codec
->
code
c
);
choose_sample_rate
(
ost
->
st
,
ost
->
en
c
);
codec
->
time_base
=
(
AVRational
){
1
,
codec
->
sample_rate
};
if
(
!
codec
->
channels
)
codec
->
channels
=
icodec
->
channels
;
...
...
@@ -2228,9 +2230,9 @@ static int transcode(AVFormatContext **output_files,
if
(
!
ost
->
frame_rate
.
num
)
ost
->
frame_rate
=
ist
->
st
->
r_frame_rate
.
num
?
ist
->
st
->
r_frame_rate
:
(
AVRational
){
25
,
1
};
if
(
codec
->
codec
&&
codec
->
code
c
->
supported_framerates
&&
!
force_fps
)
{
int
idx
=
av_find_nearest_q_idx
(
ost
->
frame_rate
,
codec
->
code
c
->
supported_framerates
);
ost
->
frame_rate
=
codec
->
code
c
->
supported_framerates
[
idx
];
if
(
ost
->
enc
&&
ost
->
en
c
->
supported_framerates
&&
!
force_fps
)
{
int
idx
=
av_find_nearest_q_idx
(
ost
->
frame_rate
,
ost
->
en
c
->
supported_framerates
);
ost
->
frame_rate
=
ost
->
en
c
->
supported_framerates
[
idx
];
}
codec
->
time_base
=
(
AVRational
){
ost
->
frame_rate
.
den
,
ost
->
frame_rate
.
num
};
...
...
@@ -2297,8 +2299,6 @@ static int transcode(AVFormatContext **output_files,
if
(
ost
->
encoding_needed
)
{
AVCodec
*
codec
=
ost
->
enc
;
AVCodecContext
*
dec
=
input_streams
[
ost
->
source_index
].
st
->
codec
;
if
(
!
codec
)
codec
=
avcodec_find_encoder
(
ost
->
st
->
codec
->
codec_id
);
if
(
!
codec
)
{
snprintf
(
error
,
sizeof
(
error
),
"Encoder (codec id %d) not found for output stream #%d.%d"
,
ost
->
st
->
codec
->
codec_id
,
ost
->
file_index
,
ost
->
index
);
...
...
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