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
22f7a060
Commit
22f7a060
authored
May 12, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
automatic framerate selection
Originally committed as revision 3132 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
fcee0164
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
ffmpeg.c
ffmpeg.c
+18
-1
No files found.
ffmpeg.c
View file @
22f7a060
...
...
@@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define HAVE_AV_CONFIG_H
#include <limits.h>
#include "avformat.h"
#include "framehook.h"
...
...
@@ -2751,18 +2752,34 @@ static void opt_output_file(const char *filename)
codec_id
=
video_codec_id
;
video_enc
->
codec_id
=
codec_id
;
codec
=
avcodec_find_encoder
(
codec_id
);
video_enc
->
bit_rate
=
video_bit_rate
;
video_enc
->
bit_rate_tolerance
=
video_bit_rate_tolerance
;
video_enc
->
frame_rate
=
frame_rate
;
video_enc
->
frame_rate_base
=
frame_rate_base
;
if
(
codec
&&
codec
->
supported_framerates
){
const
AVRational
*
p
=
codec
->
supported_framerates
;
AVRational
req
=
(
AVRational
){
frame_rate
,
frame_rate_base
};
const
AVRational
*
best
=
NULL
;
AVRational
best_error
=
(
AVRational
){
INT_MAX
,
1
};
for
(;
p
->
den
!=
0
;
p
++
){
AVRational
error
=
av_sub_q
(
req
,
*
p
);
if
(
error
.
num
<
0
)
error
.
num
*=
-
1
;
if
(
av_cmp_q
(
error
,
best_error
)
<
0
){
best_error
=
error
;
best
=
p
;
}
}
video_enc
->
frame_rate
=
best
->
num
;
video_enc
->
frame_rate_base
=
best
->
den
;
}
video_enc
->
width
=
frame_width
+
frame_padright
+
frame_padleft
;
video_enc
->
height
=
frame_height
+
frame_padtop
+
frame_padbottom
;
video_enc
->
sample_aspect_ratio
=
av_d2q
(
frame_aspect_ratio
*
frame_height
/
frame_width
,
255
);
video_enc
->
pix_fmt
=
frame_pix_fmt
;
codec
=
avcodec_find_encoder
(
codec_id
);
if
(
codec
&&
codec
->
pix_fmts
){
const
enum
PixelFormat
*
p
=
codec
->
pix_fmts
;
for
(;
*
p
!=-
1
;
p
++
){
...
...
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