1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 11:21:52 +00:00

fix #502, transcoder support snapshot.

This commit is contained in:
winlin 2015-10-20 14:52:34 +08:00
parent 2bae6e09d3
commit 29122b6e70
6 changed files with 28 additions and 18 deletions

View file

@ -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
@ -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

View file

@ -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;
@ -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;

View file

@ -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=";

View file

@ -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)
{
@ -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) {
@ -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()) {

View file

@ -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;

View file

@ -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"