diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 2f75a5b47c..40c63f2486 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -74,6 +74,8 @@ static CodecData enc_codecs[] = { { AV_CODEC_ID_H264, "h264", "h264_v4l2m2m", AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P, AV_HWDEVICE_TYPE_NONE, nullptr, nullptr }, { AV_CODEC_ID_AV1, "av1", "av1_qsv", AV_PIX_FMT_YUV420P, AV_PIX_FMT_QSV, AV_HWDEVICE_TYPE_QSV, nullptr, nullptr }, { AV_CODEC_ID_AV1, "av1", "av1_vaapi", AV_PIX_FMT_YUV420P, AV_PIX_FMT_VAAPI, AV_HWDEVICE_TYPE_VAAPI, nullptr, nullptr }, + { AV_CODEC_ID_AV1, "av1", "av1_nvenc", AV_PIX_FMT_NV12, AV_PIX_FMT_NV12, AV_HWDEVICE_TYPE_NONE, nullptr, nullptr }, + { AV_CODEC_ID_VP9, "vp9", "vp9_qsv", AV_PIX_FMT_YUV420P, AV_PIX_FMT_QSV, AV_HWDEVICE_TYPE_QSV, nullptr, nullptr }, #endif { AV_CODEC_ID_H265, "hevc", "libx265", AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P, AV_HWDEVICE_TYPE_NONE, nullptr, nullptr }, { AV_CODEC_ID_H264, "h264", "h264", AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P, AV_HWDEVICE_TYPE_NONE, nullptr, nullptr }, diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index afb6451730..6d6d7fec5c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -97,6 +97,7 @@ set(TEST_SOURCES zm_ffmpeg_fallback.cpp zm_ffmpeg_options.cpp zm_ffmpeg_option_number.cpp + zm_ffmpeg_encoder_choices.cpp zm_go2rtc_check.cpp zm_janus_ids.cpp zm_janus_refresh.cpp diff --git a/tests/zm_ffmpeg_encoder_choices.cpp b/tests/zm_ffmpeg_encoder_choices.cpp new file mode 100644 index 0000000000..ad31524538 --- /dev/null +++ b/tests/zm_ffmpeg_encoder_choices.cpp @@ -0,0 +1,35 @@ +/* + * This file is part of the ZoneMinder Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "zm_catch2.h" + +#include "zm_ffmpeg.h" + +TEST_CASE("every encoder the monitor form offers is selectable", "[ffmpeg]") { + const char *offered[] = { + "libx264", "h264_nvenc", "h264_omx", "h264_qsv", "h264_vaapi", "h264_v4l2m2m", + "libx265", "hevc_nvenc", "hevc_qsv", "hevc_vaapi", + "libvpx-vp9", "vp9_qsv", "libsvtav1", "libaom-av1", "av1_qsv", "av1_vaapi", "av1_nvenc", + }; + for (const char *name : offered) { + CAPTURE(name); + if (!avcodec_find_encoder_by_name(name)) continue; + const auto found = get_encoder_data("", name); + REQUIRE(found.size() == 1); + REQUIRE(std::string(found.front()->codec_name) == name); + } +} diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index f23cbb8c6b..b6e03b64a0 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -1277,7 +1277,7 @@ $videowriter_encoders = array( 'hevc_qsv' => 'hevc_qsv', 'hevc_vaapi' => 'hevc_vaapi', 'libvpx-vp9' => 'libvpx-vp9', - 'vp9-qsv' => 'vp9-qsv', + 'vp9_qsv' => 'vp9_qsv', 'libsvtav1' => 'libsvtav1', 'libaom-av1' => 'libaom-av1', 'av1_qsv' => 'av1_qsv',