Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
15bc38e5
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
15bc38e5
编写于
12月 19, 2004
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
try to guess the fps if they are variable
Originally committed as revision 3760 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
0d00cf38
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
13 deletion
+29
-13
ffmpeg.c
ffmpeg.c
+4
-5
libavformat/flvdec.c
libavformat/flvdec.c
+2
-8
libavformat/utils.c
libavformat/utils.c
+23
-0
未找到文件。
ffmpeg.c
浏览文件 @
15bc38e5
...
...
@@ -2881,14 +2881,13 @@ static void opt_input_file(const char *filename)
if
(
me_threshold
)
enc
->
debug
|=
FF_DEBUG_MV
;
assert
(
enc
->
frame_rate_base
==
rfps_base
);
// should be true for now
if
(
enc
->
frame_rate
!=
rfps
)
{
if
(
enc
->
frame_rate
!=
rfps
||
enc
->
frame_rate_base
!=
rfps_base
)
{
if
(
verbose
>=
0
)
fprintf
(
stderr
,
"
\n
Seems that stream %d comes from film source: %2.2f
->%2.2f
\n
"
,
i
,
(
float
)
enc
->
frame_rate
/
enc
->
frame_rate_base
,
fprintf
(
stderr
,
"
\n
Seems that stream %d comes from film source: %2.2f
(%d/%d) -> %2.2f (%d/%d)
\n
"
,
i
,
(
float
)
enc
->
frame_rate
/
enc
->
frame_rate_base
,
enc
->
frame_rate
,
enc
->
frame_rate_base
,
(
float
)
rfps
/
rfps_base
);
(
float
)
rfps
/
rfps_base
,
rfps
,
rfps_base
);
}
/* update the current frame rate to match the stream frame rate */
frame_rate
=
rfps
;
...
...
libavformat/flvdec.c
浏览文件 @
15bc38e5
...
...
@@ -103,7 +103,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
return
AVERROR_NOMEM
;
av_set_pts_info
(
st
,
24
,
1
,
1000
);
/* 24 bit pts in ms */
st
->
codec
.
frame_rate_base
=
0
;
st
->
codec
.
frame_rate_base
=
1
;
st
->
codec
.
frame_rate
=
1000
;
}
break
;
}
...
...
@@ -123,19 +124,12 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
}
}
else
{
if
(
st
->
codec
.
frame_rate_base
==
0
){
st
->
codec
.
codec_type
=
CODEC_TYPE_VIDEO
;
//guess the frame rate
if
(
pts
){
st
->
codec
.
frame_rate_base
=
1
;
st
->
codec
.
frame_rate
=
(
1000
+
pts
/
2
)
/
pts
;
}
switch
(
flags
&
0xF
){
case
2
:
st
->
codec
.
codec_id
=
CODEC_ID_FLV1
;
break
;
default:
st
->
codec
.
codec_tag
=
flags
&
0xF
;
}
}
}
if
(
av_new_packet
(
pkt
,
size
)
<
0
)
...
...
libavformat/utils.c
浏览文件 @
15bc38e5
...
...
@@ -1726,7 +1726,14 @@ int av_find_stream_info(AVFormatContext *ic)
AVStream
*
st
;
AVPacket
pkt1
,
*
pkt
;
AVPacketList
*
pktl
=
NULL
,
**
ppktl
;
int64_t
last_dts
[
MAX_STREAMS
];
int64_t
best_duration
[
MAX_STREAMS
];
for
(
i
=
0
;
i
<
MAX_STREAMS
;
i
++
){
last_dts
[
i
]
=
AV_NOPTS_VALUE
;
best_duration
[
i
]
=
INT64_MAX
;
}
count
=
0
;
read_size
=
0
;
ppktl
=
&
ic
->
packet_buffer
;
...
...
@@ -1792,6 +1799,15 @@ int av_find_stream_info(AVFormatContext *ic)
if
(
pkt
->
duration
!=
0
)
st
->
codec_info_nb_frames
++
;
if
(
st
->
codec
.
codec_type
==
CODEC_TYPE_VIDEO
){
int64_t
last
=
last_dts
[
pkt
->
stream_index
];
if
(
pkt
->
dts
!=
AV_NOPTS_VALUE
&&
last
!=
AV_NOPTS_VALUE
&&
last
<
pkt
->
dts
&&
best_duration
[
pkt
->
stream_index
]
>
pkt
->
dts
-
last
){
best_duration
[
pkt
->
stream_index
]
=
pkt
->
dts
-
last
;
}
last_dts
[
pkt
->
stream_index
]
=
pkt
->
dts
;
}
/* if still no information, we try to open the codec and to
decompress the frame. We try to avoid that in most cases as
it takes longer and uses more memory. For MPEG4, we need to
...
...
@@ -1823,6 +1839,13 @@ int av_find_stream_info(AVFormatContext *ic)
if
(
st
->
codec
.
codec_type
==
CODEC_TYPE_VIDEO
)
{
if
(
st
->
codec
.
codec_id
==
CODEC_ID_RAWVIDEO
&&
!
st
->
codec
.
codec_tag
&&
!
st
->
codec
.
bits_per_sample
)
st
->
codec
.
codec_tag
=
avcodec_pix_fmt_to_codec_tag
(
st
->
codec
.
pix_fmt
);
if
(
best_duration
[
i
]
<
INT64_MAX
&&
st
->
codec
.
frame_rate_base
*
1000
<=
st
->
codec
.
frame_rate
){
st
->
r_frame_rate
=
st
->
codec
.
frame_rate
;
st
->
r_frame_rate_base
=
av_rescale
(
best_duration
[
i
],
st
->
codec
.
frame_rate
,
AV_TIME_BASE
);
av_reduce
(
&
st
->
r_frame_rate
,
&
st
->
r_frame_rate_base
,
st
->
r_frame_rate
,
st
->
r_frame_rate_base
,
1
<<
15
);
}
/* set real frame rate info */
/* compute the real frame rate for telecine */
if
((
st
->
codec
.
codec_id
==
CODEC_ID_MPEG1VIDEO
||
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录