Skip to content

Commit

Permalink
fix #502, transcoder support snapshot.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Oct 20, 2015
1 parent 2bae6e0 commit 29122b6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 18 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ Remark:

### History

* v3.0, 2015-10-20, fix [#502][bug #502], support snapshot with http-callback or transcoder. 3.0.5
* v3.0, 2015-09-19, support amf0 and json to convert with each other.
* v3.0, 2015-09-19, json objects support dumps to string.
* v3.0, 2015-09-14, fix [#459][bug #459], support dvr raw api. 3.0.4
Expand Down Expand Up @@ -1277,6 +1278,7 @@ Winlin
[bug #299]: https://github.com/simple-rtmp-server/srs/issues/299
[bug #466]: https://github.com/simple-rtmp-server/srs/issues/466
[bug #468]: https://github.com/simple-rtmp-server/srs/issues/468
[bug #502]: https://github.com/simple-rtmp-server/srs/issues/502
[bug #xxxxxxx]: https://github.com/simple-rtmp-server/srs/issues/xxxxxxx

[r2.0a2]: https://github.com/simple-rtmp-server/srs/releases/tag/2.0a2
Expand Down
2 changes: 2 additions & 0 deletions trunk/conf/full.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,7 @@ vhost example.transcode.srs.com {
# video encoder name, "ffmpeg -vcodec"
# can be:
# libx264: use h.264(libx264) video encoder.
# png: use png to snapshot thumbnail.
# copy: donot encoder the video stream, copy it.
# vn: disable video output.
vcodec libx264;
Expand Down Expand Up @@ -1354,6 +1355,7 @@ vhost example.transcode.srs.com {
# output format, "ffmpeg -f" can be:
# off, do not specifies the format, ffmpeg will guess it.
# flv, for flv or RTMP stream.
# image2, for vcodec png to snapshot thumbnail.
# other format, for example, mp4/aac whatever.
# default: flv
oformat flv;
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/app/srs_app_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ int SrsEncoder::initialize_ffmpeg(SrsFFMPEG* ffmpeg, SrsRequest* req, SrsConfDir
input = "rtmp://";
input += SRS_CONSTS_LOCALHOST;
input += ":";
input += req->port;
input += srs_int2str(req->port);
input += "/";
input += req->app;
input += "?vhost=";
Expand Down
33 changes: 19 additions & 14 deletions trunk/src/app/srs_app_ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ using namespace std;

#ifdef SRS_AUTO_FFMPEG_STUB

#define SRS_RTMP_ENCODER_COPY "copy"
#define SRS_RTMP_ENCODER_NO_VIDEO "vn"
#define SRS_RTMP_ENCODER_NO_AUDIO "an"
#define SRS_RTMP_ENCODER_COPY "copy"
#define SRS_RTMP_ENCODER_NO_VIDEO "vn"
#define SRS_RTMP_ENCODER_NO_AUDIO "an"
// only support libx264 encoder.
#define SRS_RTMP_ENCODER_VCODEC "libx264"
#define SRS_RTMP_ENCODER_VCODEC_LIBX264 "libx264"
#define SRS_RTMP_ENCODER_VCODEC_PNG "png"
// any aac encoder is ok which contains the aac,
// for example, libaacplus, aac, fdkaac
#define SRS_RTMP_ENCODER_ACODEC "aac"
#define SRS_RTMP_ENCODER_LIBAACPLUS "libaacplus"
#define SRS_RTMP_ENCODER_LIBFDKAAC "libfdk_aac"
#define SRS_RTMP_ENCODER_ACODEC "aac"
#define SRS_RTMP_ENCODER_LIBAACPLUS "libaacplus"
#define SRS_RTMP_ENCODER_LIBFDKAAC "libfdk_aac"

SrsFFMPEG::SrsFFMPEG(std::string ffmpeg_bin)
{
Expand Down Expand Up @@ -139,11 +140,11 @@ int SrsFFMPEG::initialize_transcode(SrsConfDirective* engine)
return ret;
}

if (vcodec != SRS_RTMP_ENCODER_COPY && vcodec != SRS_RTMP_ENCODER_NO_VIDEO) {
if (vcodec != SRS_RTMP_ENCODER_VCODEC) {
if (vcodec != SRS_RTMP_ENCODER_COPY && vcodec != SRS_RTMP_ENCODER_NO_VIDEO && vcodec != SRS_RTMP_ENCODER_VCODEC_PNG) {
if (vcodec != SRS_RTMP_ENCODER_VCODEC_LIBX264) {
ret = ERROR_ENCODER_VCODEC;
srs_error("invalid vcodec, must be %s, actual %s, ret=%d",
SRS_RTMP_ENCODER_VCODEC, vcodec.c_str(), ret);
SRS_RTMP_ENCODER_VCODEC_LIBX264, vcodec.c_str(), ret);
return ret;
}
if (vbitrate < 0) {
Expand Down Expand Up @@ -319,11 +320,15 @@ int SrsFFMPEG::start()
params.push_back(srs_int2str(vthreads));
}

params.push_back("-profile:v");
params.push_back(vprofile);
if (!vprofile.empty()) {
params.push_back("-profile:v");
params.push_back(vprofile);
}

params.push_back("-preset");
params.push_back(vpreset);
if (!vpreset.empty()) {
params.push_back("-preset");
params.push_back(vpreset);
}

// vparams
if (!vparams.empty()) {
Expand Down
5 changes: 3 additions & 2 deletions trunk/src/app/srs_app_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,16 @@ int SrsProcess::initialize(string binary, vector<string> argv)

for (int i = 0; i < (int)argv.size(); i++) {
std::string ffp = argv[i];
std::string nffp = (i < (int)argv.size() -1)? argv[i + 1] : "";

// remove the stdout and stderr.
if (ffp == "1") {
if (ffp == "1" && nffp == ">") {
if (i + 2 < (int)argv.size()) {
stdout_file = argv[i + 2];
i += 2;
}
continue;
} else if (ffp == "2") {
} else if (ffp == "2" && nffp == ">") {
if (i + 2 < (int)argv.size()) {
stderr_file = argv[i + 2];
i += 2;
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 4
#define VERSION_REVISION 5

// server info.
#define RTMP_SIG_SRS_KEY "SRS"
Expand Down

0 comments on commit 29122b6

Please sign in to comment.