diff --git a/README.md b/README.md index b4d005ca4..d624534f0 100755 --- a/README.md +++ b/README.md @@ -110,6 +110,7 @@ cd simple-rtmp-server/trunk * [Usage: How to forward stream to other server?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleForward) * [Usage: How to deploy low lantency application?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleRealtime) * [Usage: How to deploy SRS on ARM?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleARM) +* [Usage: How to ingest file/stream/device to SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleIngest) * [Usage: How to use SRS-HTTP-server to delivery HTTP/HLS stream?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleHTTP) * [Usage: How to show the demo of SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo) * [Usage: Solution using SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/Sample) diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 5bc8bed9f..374f89a95 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -116,6 +116,7 @@ vhost ingest.srs.com { # @remark, the output is specified following. engine { # @see enabled of transcode engine. + # if disabled or vcodec/acodec not specified, use copy. # default: off. enable off; # output stream. variables: diff --git a/trunk/conf/ingest.conf b/trunk/conf/ingest.conf new file mode 100644 index 000000000..22d5ae24d --- /dev/null +++ b/trunk/conf/ingest.conf @@ -0,0 +1,19 @@ +# use ffmpeg to ingest file/stream/device to SRS +# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleIngest +# @see full.conf for detail config. + +listen 1935; +vhost __defaultVhost__ { + ingest { + enable on; + input { + type file; + url ./doc/source.200kbps.768x320.flv; + } + ffmpeg ./objs/ffmpeg/bin/ffmpeg; + engine { + enable off; + output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream; + } + } +} diff --git a/trunk/src/app/srs_app_ingest.cpp b/trunk/src/app/srs_app_ingest.cpp index 4943fd6ab..3c84c8a58 100644 --- a/trunk/src/app/srs_app_ingest.cpp +++ b/trunk/src/app/srs_app_ingest.cpp @@ -303,7 +303,9 @@ int SrsIngester::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsConfDirective* vhost, S srs_error("invalid ingest type=%s, ret=%d", input_type.c_str(), ret); } - if (!engine || !_srs_config->get_engine_enabled(engine)) { + std::string vcodec = _srs_config->get_engine_vcodec(engine); + std::string acodec = _srs_config->get_engine_acodec(engine); + if (!engine || !_srs_config->get_engine_enabled(engine) || vcodec.empty() || acodec.empty()) { if ((ret = ffmpeg->initialize_copy()) != ERROR_SUCCESS) { return ret; }