Skip to content

Commit

Permalink
Transcode: More generic h264/h265 codec support. v7.0.1 (#4131)
Browse files Browse the repository at this point in the history
Sorry this is another pull request with same intention. But there is
more variants of h264 und h265 codecs and I think it is good to support
them all.

---------

Co-authored-by: winlin <[email protected]>
  • Loading branch information
jb-alvarado and winlinvip committed Aug 12, 2024
1 parent 7478311 commit 2e211f6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 6 additions & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

The changelog for SRS.

<a name="v7-changes"></a>

## SRS 7.0 Changelog
* v7.0, 2024-08-12, Merge [#4131](https://github.com/ossrs/srs/pull/4131): Transcode: More generic h264/h265 codec support. v7.0.1 (#4131)
* v7.0, 2024-08-12, Init SRS 7 branch. v7.0.0

<a name="v6-changes"></a>

## SRS 6.0 Changelog
Expand Down
14 changes: 6 additions & 8 deletions trunk/src/app/srs_app_ffmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ using namespace std;
#define SRS_RTMP_ENCODER_COPY "copy"
#define SRS_RTMP_ENCODER_NO_VIDEO "vn"
#define SRS_RTMP_ENCODER_NO_AUDIO "an"
// only support libx264, libx265 and h264_qsv encoder.
#define SRS_RTMP_ENCODER_VCODEC_LIBX264 "libx264"
#define SRS_RTMP_ENCODER_VCODEC_LIBX265 "libx265"
#define SRS_RTMP_ENCODER_VCODEC_H264QSV "h264_qsv"
// only support encoder: h264, h265 and other variants like libx264 etc.
#define SRS_RTMP_ENCODER_VCODEC_H264 "264"
#define SRS_RTMP_ENCODER_VCODEC_H265 "265"
#define SRS_RTMP_ENCODER_VCODEC_HEVC "hevc"
#define SRS_RTMP_ENCODER_VCODEC_PNG "png"
// any aac encoder is ok which contains the aac,
// for example, libaacplus, aac, fdkaac
Expand Down Expand Up @@ -125,10 +125,8 @@ srs_error_t SrsFFMPEG::initialize_transcode(SrsConfDirective* engine)
}

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 && vcodec != SRS_RTMP_ENCODER_VCODEC_LIBX265 && vcodec != SRS_RTMP_ENCODER_VCODEC_H264QSV) {
return srs_error_new(
ERROR_ENCODER_VCODEC, "invalid vcodec, must be %s, %s or %s, actual %s",
SRS_RTMP_ENCODER_VCODEC_LIBX264, SRS_RTMP_ENCODER_VCODEC_LIBX265, SRS_RTMP_ENCODER_VCODEC_H264QSV, vcodec.c_str());
if (vcodec.find(SRS_RTMP_ENCODER_VCODEC_H264) != string::npos && vcodec.find(SRS_RTMP_ENCODER_VCODEC_H265) != string::npos && vcodec.find(SRS_RTMP_ENCODER_VCODEC_HEVC) != string::npos) {
return srs_error_new(ERROR_ENCODER_VCODEC, "invalid vcodec, must be h264, h265 or one of their variants, actual %s", vcodec.c_str());
}
if (vbitrate < 0) {
return srs_error_new(ERROR_ENCODER_VBITRATE, "invalid vbitrate: %d", vbitrate);
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version7.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 7
#define VERSION_MINOR 0
#define VERSION_REVISION 0
#define VERSION_REVISION 1

#endif

0 comments on commit 2e211f6

Please sign in to comment.