Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
2db3c638
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,发现更多精彩内容 >>
提交
2db3c638
编写于
10月 06, 2004
作者:
M
Michael Niedermayer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
user selectable packet_size and mux_rate
Originally committed as revision 3566 to
svn://svn.ffmpeg.org/ffmpeg/trunk
上级
ca377212
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
11 deletion
+33
-11
ffmpeg.c
ffmpeg.c
+15
-0
libavformat/avformat.h
libavformat/avformat.h
+3
-0
libavformat/mpeg.c
libavformat/mpeg.c
+15
-11
未找到文件。
ffmpeg.c
浏览文件 @
2db3c638
...
...
@@ -200,6 +200,9 @@ static int audio_disable = 0;
static
int
audio_channels
=
1
;
static
int
audio_codec_id
=
CODEC_ID_NONE
;
static
int
mux_rate
=
0
;
static
int
mux_packet_size
=
0
;
static
int64_t
recording_time
=
0
;
static
int64_t
start_time
=
0
;
static
int64_t
rec_timestamp
=
0
;
...
...
@@ -3290,6 +3293,9 @@ static void opt_output_file(const char *filename)
exit
(
1
);
}
oc
->
packet_size
=
mux_packet_size
;
oc
->
mux_rate
=
mux_rate
;
/* reset some options */
file_oformat
=
NULL
;
file_iformat
=
NULL
;
...
...
@@ -3649,6 +3655,9 @@ static void opt_target(const char *arg)
audio_bit_rate
=
224000
;
audio_sample_rate
=
44100
;
mux_packet_size
=
2324
;
mux_rate
=
2352
*
75
*
8
;
}
else
if
(
!
strcmp
(
arg
,
"svcd"
))
{
...
...
@@ -3668,6 +3677,8 @@ static void opt_target(const char *arg)
audio_bit_rate
=
224000
;
audio_sample_rate
=
44100
;
mux_packet_size
=
2324
;
}
else
if
(
!
strcmp
(
arg
,
"dvd"
))
{
opt_video_codec
(
"mpeg2video"
);
...
...
@@ -3865,6 +3876,10 @@ const OptionDef options[] = {
{
"tvstd"
,
HAS_ARG
|
OPT_EXPERT
|
OPT_VIDEO
|
OPT_GRAB
,
{(
void
*
)
opt_video_standard
},
"set television standard (NTSC, PAL (SECAM))"
,
"standard"
},
{
"dv1394"
,
OPT_EXPERT
|
OPT_GRAB
,
{(
void
*
)
opt_dv1394
},
"set DV1394 grab"
,
""
},
{
"ad"
,
HAS_ARG
|
OPT_EXPERT
|
OPT_AUDIO
|
OPT_GRAB
,
{(
void
*
)
opt_audio_device
},
"set audio device"
,
"device"
},
/* muxer options */
{
"muxrate"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
mux_rate
},
"set mux rate"
,
"rate"
},
{
"packetsize"
,
OPT_INT
|
HAS_ARG
|
OPT_EXPERT
,
{(
void
*
)
&
mux_packet_size
},
"set packet size"
,
"size"
},
{
NULL
,
},
};
...
...
libavformat/avformat.h
浏览文件 @
2db3c638
...
...
@@ -302,6 +302,9 @@ typedef struct AVFormatContext {
/* av_seek_frame() support */
int64_t
data_offset
;
/* offset of the first packet */
int
index_built
;
int
mux_rate
;
int
packet_size
;
}
AVFormatContext
;
typedef
struct
AVPacketList
{
...
...
libavformat/mpeg.c
浏览文件 @
2db3c638
...
...
@@ -256,11 +256,11 @@ static int mpeg_mux_init(AVFormatContext *ctx)
s
->
is_mpeg2
=
(
ctx
->
oformat
==
&
mpeg2vob_mux
||
ctx
->
oformat
==
&
mpeg2svcd_mux
||
ctx
->
oformat
==
&
mpeg2dvd_mux
);
s
->
is_dvd
=
(
ctx
->
oformat
==
&
mpeg2dvd_mux
);
if
(
s
->
is_vcd
||
s
->
is_svcd
)
s
->
packet_size
=
2324
;
/* VCD/SVCD packet size */
if
(
ctx
->
packet_size
)
s
->
packet_size
=
ctx
->
packet_size
;
else
s
->
packet_size
=
2048
;
s
->
vcd_padding_bytes_written
=
0
;
s
->
vcd_padding_bitrate
=
0
;
...
...
@@ -354,6 +354,16 @@ static int mpeg_mux_init(AVFormatContext *ctx)
else
if
(
stream
->
id
==
VIDEO_ID
)
video_bitrate
+=
codec_rate
;
}
if
(
ctx
->
mux_rate
){
s
->
mux_rate
=
(
ctx
->
mux_rate
+
(
8
*
50
)
-
1
)
/
(
8
*
50
);
}
else
{
/* we increase slightly the bitrate to take into account the
headers. XXX: compute it exactly */
bitrate
+=
bitrate
*
5
/
100
;
bitrate
+=
10000
;
s
->
mux_rate
=
(
bitrate
+
(
8
*
50
)
-
1
)
/
(
8
*
50
);
}
if
(
s
->
is_vcd
)
{
double
overhead_rate
;
...
...
@@ -365,7 +375,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
rate you get a different value because the real pack size is 2324,
not 2352. But the standard explicitly specifies that the mux_rate
field in the header must have this value.*/
s
->
mux_rate
=
2352
*
75
/
50
;
/* = 3528*/
//
s->mux_rate=2352 * 75 / 50; /* = 3528*/
/* The VCD standard states that the muxed stream must be
exactly 75 packs / second (the data rate of a single speed cdrom).
...
...
@@ -382,13 +392,6 @@ static int mpeg_mux_init(AVFormatContext *ctx)
/* Add padding so that the full bitrate is 2324*75 bytes/sec */
s
->
vcd_padding_bitrate
=
2324
*
75
*
8
-
(
bitrate
+
overhead_rate
);
}
else
{
/* we increase slightly the bitrate to take into account the
headers. XXX: compute it exactly */
bitrate
+=
bitrate
*
5
/
100
;
bitrate
+=
10000
;
s
->
mux_rate
=
(
bitrate
+
(
8
*
50
)
-
1
)
/
(
8
*
50
);
}
if
(
s
->
is_vcd
||
s
->
is_mpeg2
)
...
...
@@ -972,6 +975,7 @@ retry:
}
if
(
timestamp_packet
){
//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts/90000.0, timestamp_packet->pts/90000.0, scr/90000.0, best_i);
es_size
=
flush_packet
(
ctx
,
best_i
,
timestamp_packet
->
pts
,
timestamp_packet
->
dts
,
scr
,
trailer_size
);
}
else
{
assert
(
fifo_size
(
&
stream
->
fifo
,
stream
->
fifo
.
rptr
)
==
trailer_size
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录