1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix #119: use iformat and oformat for ffmpeg transcode.

This commit is contained in:
winlin 2014-07-19 15:20:16 +08:00
parent 9bf7b722db
commit f8423dfa90
5 changed files with 15 additions and 6 deletions

View file

@ -208,6 +208,7 @@ Supported operating systems and hardware:
* 2013-10-17, Created.<br/> * 2013-10-17, Created.<br/>
## History ## History
* v1.0, 2014-07-19, fix [#119](https://github.com/winlinvip/simple-rtmp-server/issues/119), use iformat and oformat for ffmpeg transcode. 0.9.163.
* <strong>v1.0, 2014-07-13, [1.0 mainline6(0.9.160)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline8) released. 50029 lines.</strong> * <strong>v1.0, 2014-07-13, [1.0 mainline6(0.9.160)](https://github.com/winlinvip/simple-rtmp-server/releases/tag/1.0.mainline8) released. 50029 lines.</strong>
* v1.0, 2014-07-13, refine the bandwidth check/test, add as/js library, use srs-librtmp for linux tool. 0.9.159 * v1.0, 2014-07-13, refine the bandwidth check/test, add as/js library, use srs-librtmp for linux tool. 0.9.159
* v1.0, 2014-07-12, complete rtmp stack utest. 0.9.156 * v1.0, 2014-07-12, complete rtmp stack utest. 0.9.156

View file

@ -76,6 +76,11 @@ void SrsFFMPEG::set_iparams(string iparams)
_iparams = iparams; _iparams = iparams;
} }
void SrsFFMPEG::set_oformat(string format)
{
oformat = format;
}
string SrsFFMPEG::output() string SrsFFMPEG::output()
{ {
return _output; return _output;
@ -243,7 +248,7 @@ int SrsFFMPEG::start()
} }
// input. // input.
if (iformat != "off") { if (iformat != "off" && !iformat.empty()) {
params.push_back("-f"); params.push_back("-f");
params.push_back(iformat); params.push_back(iformat);
} }
@ -346,7 +351,7 @@ int SrsFFMPEG::start()
} }
// output // output
if (oformat != "off") { if (oformat != "off" && !oformat.empty()) {
params.push_back("-f"); params.push_back("-f");
params.push_back(oformat); params.push_back(oformat);
} }

View file

@ -75,6 +75,7 @@ public:
virtual ~SrsFFMPEG(); virtual ~SrsFFMPEG();
public: public:
virtual void set_iparams(std::string iparams); virtual void set_iparams(std::string iparams);
virtual void set_oformat(std::string format);
virtual std::string output(); virtual std::string output();
public: public:
virtual int initialize(std::string in, std::string out, std::string log); virtual int initialize(std::string in, std::string out, std::string log);

View file

@ -317,12 +317,14 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S
ingest->arg0().c_str(), input_type.c_str(), ret); ingest->arg0().c_str(), input_type.c_str(), ret);
} }
// set output format to flv for RTMP
ffmpeg->set_oformat("flv");
std::string vcodec = _srs_config->get_engine_vcodec(engine); std::string vcodec = _srs_config->get_engine_vcodec(engine);
std::string acodec = _srs_config->get_engine_acodec(engine); std::string acodec = _srs_config->get_engine_acodec(engine);
// whatever the engine config, use copy as default. // whatever the engine config, use copy as default.
if (!engine || vcodec.empty() || acodec.empty() bool engine_disabled = !engine || !_srs_config->get_engine_enabled(engine);
|| !_srs_config->get_engine_enabled(engine) if (engine_disabled || vcodec.empty() || acodec.empty()) {
) {
if ((ret = ffmpeg->initialize_copy()) != ERROR_SUCCESS) { if ((ret = ffmpeg->initialize_copy()) != ERROR_SUCCESS) {
return ret; return ret;
} }

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version // current release version
#define VERSION_MAJOR "0" #define VERSION_MAJOR "0"
#define VERSION_MINOR "9" #define VERSION_MINOR "9"
#define VERSION_REVISION "162" #define VERSION_REVISION "163"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info. // server info.
#define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_KEY "SRS"