Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-19 10:54:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9bf7b722db09a4dac809a3a944620eb9171b041b
9bf7b722
1 parent
2f0a72d7
fix #119: use iformat and oformat for ffmpeg transcode.
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
61 行增加
和
5 行删除
trunk/conf/full.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_ffmpeg.cpp
trunk/src/app/srs_app_ffmpeg.hpp
trunk/conf/full.conf
查看文件 @
9bf7b72
...
...
@@ -649,6 +649,12 @@ vhost all.transcode.srs.com {
# whether the engine is enabled
# default: off.
enabled
on
;
# input format, can be:
# off, do not specifies the format, ffmpeg will guess it.
# flv, for flv or RTMP stream.
# other format, for example, mp4/aac whatever.
# default: flv
iformat
flv
;
# ffmpeg filters, follows the main input.
vfilter
{
# the logo input file.
...
...
@@ -706,6 +712,12 @@ vhost all.transcode.srs.com {
# audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
profile
:
a
aac_low
;
}
# output format, can be:
# off, do not specifies the format, ffmpeg will guess it.
# flv, for flv or RTMP stream.
# other format, for example, mp4/aac whatever.
# default: flv
oformat
flv
;
# output stream. variables:
# [vhost] the input stream vhost.
# [port] the intput stream port.
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
9bf7b72
...
...
@@ -1965,6 +1965,20 @@ bool SrsConfig::get_engine_enabled(SrsConfDirective* engine)
return
true
;
}
string
SrsConfig
::
get_engine_iformat
(
SrsConfDirective
*
engine
)
{
if
(
!
engine
)
{
return
"flv"
;
}
SrsConfDirective
*
conf
=
engine
->
get
(
"iformat"
);
if
(
!
conf
)
{
return
"flv"
;
}
return
conf
->
arg0
();
}
vector
<
string
>
SrsConfig
::
get_engine_vfilter
(
SrsConfDirective
*
engine
)
{
vector
<
string
>
vfilter
;
...
...
@@ -2211,6 +2225,20 @@ vector<string> SrsConfig::get_engine_aparams(SrsConfDirective* engine)
return
aparams
;
}
string
SrsConfig
::
get_engine_oformat
(
SrsConfDirective
*
engine
)
{
if
(
!
engine
)
{
return
"flv"
;
}
SrsConfDirective
*
conf
=
engine
->
get
(
"oformat"
);
if
(
!
conf
)
{
return
"flv"
;
}
return
conf
->
arg0
();
}
string
SrsConfig
::
get_engine_output
(
SrsConfDirective
*
engine
)
{
if
(
!
engine
)
{
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
9bf7b72
...
...
@@ -605,6 +605,10 @@ public:
*/
virtual
bool
get_engine_enabled
(
SrsConfDirective
*
engine
);
/**
* get the iformat of engine
*/
virtual
std
::
string
get_engine_iformat
(
SrsConfDirective
*
engine
);
/**
* get the vfilter of engine,
* the video filter set before the vcodec of FFMPEG.
*/
...
...
@@ -679,6 +683,10 @@ public:
*/
virtual
std
::
vector
<
std
::
string
>
get_engine_aparams
(
SrsConfDirective
*
engine
);
/**
* get the oformat of engine
*/
virtual
std
::
string
get_engine_oformat
(
SrsConfDirective
*
engine
);
/**
* get the output of engine, for example, rtmp://127.0.0.1/live/livestream,
* @remark, we will use some variable, for instance, [vhost] to substitude with vhost.
*/
...
...
trunk/src/app/srs_app_ffmpeg.cpp
查看文件 @
9bf7b72
...
...
@@ -96,6 +96,7 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine)
{
int
ret
=
ERROR_SUCCESS
;
iformat
=
_srs_config
->
get_engine_iformat
(
engine
);
vfilter
=
_srs_config
->
get_engine_vfilter
(
engine
);
vcodec
=
_srs_config
->
get_engine_vcodec
(
engine
);
vbitrate
=
_srs_config
->
get_engine_vbitrate
(
engine
);
...
...
@@ -111,6 +112,7 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine)
asample_rate
=
_srs_config
->
get_engine_asample_rate
(
engine
);
achannels
=
_srs_config
->
get_engine_achannels
(
engine
);
aparams
=
_srs_config
->
get_engine_aparams
(
engine
);
oformat
=
_srs_config
->
get_engine_oformat
(
engine
);
// ensure the size is even.
vwidth
-=
vwidth
%
2
;
...
...
@@ -241,8 +243,10 @@ int SrsFFMPEG::start()
}
// input.
params
.
push_back
(
"-f"
);
params
.
push_back
(
"flv"
);
if
(
iformat
!=
"off"
)
{
params
.
push_back
(
"-f"
);
params
.
push_back
(
iformat
);
}
params
.
push_back
(
"-i"
);
params
.
push_back
(
input
);
...
...
@@ -342,8 +346,10 @@ int SrsFFMPEG::start()
}
// output
params
.
push_back
(
"-f"
);
params
.
push_back
(
"flv"
);
if
(
oformat
!=
"off"
)
{
params
.
push_back
(
"-f"
);
params
.
push_back
(
oformat
);
}
params
.
push_back
(
"-y"
);
params
.
push_back
(
_output
);
...
...
trunk/src/app/srs_app_ffmpeg.hpp
查看文件 @
9bf7b72
...
...
@@ -51,6 +51,8 @@ private:
private
:
std
::
string
ffmpeg
;
std
::
string
_iparams
;
std
::
string
iformat
;
std
::
string
input
;
std
::
vector
<
std
::
string
>
vfilter
;
std
::
string
vcodec
;
int
vbitrate
;
...
...
@@ -66,8 +68,8 @@ private:
int
asample_rate
;
int
achannels
;
std
::
vector
<
std
::
string
>
aparams
;
std
::
string
oformat
;
std
::
string
_output
;
std
::
string
input
;
public
:
SrsFFMPEG
(
std
::
string
ffmpeg_bin
);
virtual
~
SrsFFMPEG
();
...
...
请
注册
或
登录
后发表评论