From 2e211f6abe43c7b350189e11727a231629873c88 Mon Sep 17 00:00:00 2001 From: jb-alvarado <2212056+jb-alvarado@users.noreply.github.com> Date: Mon, 12 Aug 2024 10:15:57 +0200 Subject: [PATCH] Transcode: More generic h264/h265 codec support. v7.0.1 (#4131) 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 --- trunk/doc/CHANGELOG.md | 6 ++++++ trunk/src/app/srs_app_ffmpeg.cpp | 14 ++++++-------- trunk/src/core/srs_core_version7.hpp | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index fc576ec7c..7366f8aa7 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -4,6 +4,12 @@ The changelog for SRS. + + +## 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 + ## SRS 6.0 Changelog diff --git a/trunk/src/app/srs_app_ffmpeg.cpp b/trunk/src/app/srs_app_ffmpeg.cpp index d4cb94857..43583ce76 100644 --- a/trunk/src/app/srs_app_ffmpeg.cpp +++ b/trunk/src/app/srs_app_ffmpeg.cpp @@ -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 @@ -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); diff --git a/trunk/src/core/srs_core_version7.hpp b/trunk/src/core/srs_core_version7.hpp index a22d8fbdb..54280c2db 100644 --- a/trunk/src/core/srs_core_version7.hpp +++ b/trunk/src/core/srs_core_version7.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 7 #define VERSION_MINOR 0 -#define VERSION_REVISION 0 +#define VERSION_REVISION 1 #endif \ No newline at end of file