diff -uN zoneminder.org/PKGBUILD zoneminder/PKGBUILD --- zoneminder.org/PKGBUILD 2025-10-03 23:24:52.000000000 +0200 +++ zoneminder/PKGBUILD 2025-12-04 08:14:49.059051908 +0100 @@ -14,7 +14,7 @@ pkgname=zoneminder pkgver=1.36.36 -pkgrel=1 +pkgrel=2 pkgdesc='A full-featured, open source, state-of-the-art video surveillance software system' arch=('any') url='https://zoneminder.com/' @@ -54,6 +54,7 @@ 'zoneminder-nginx.conf' 'zoneminder-httpd.conf' 'zoneminder-php.ini' + 'zm-ffmpeg8.diff' 'fcgiwrap-multiwatch.service') b2sums=('a1197e81aecf639f9f9a63c02022f45c036e2b054d0dc0f22068d4068aafe9708e8e1dce639360b21f27e5f828e0b65b7b3438a2140094fc6fcd65dc6df22e9f' '7d5b18e1a7a21c967128745591870cd5bf5b380c55a62f7c465f7cf1fd718961fb392b5bc80c941bf9a9819e7c87829ca6217d19505c655ffdc859e50662659c' @@ -62,6 +63,7 @@ '3886117b5471ab62a291a6d068f2bc168c1467da512a68b049a02046ab15ced1078cd96e342222ff8393858ce206ed03fe102b09db4534b97bd3b95d76c3e8cd' '9ce42fe44f2c3c1a1b205d36e08e0703519d3bf955c14538171f4b9eabfeae8847fda37b53bfded8e371e6765ef9ecc6a59d3a719ddc1b0acf4f486a925ed6ba' 'd29126e6bb733a9655573e5e2f1934d248f47d301361dbf4a4b1db67bea1c244d3a902f3d4d3aecca7de64c39eeca88803bde72740bc805163c790a6dbd13a54' + '6315c5b8094f8ce006dde03922e5eba3fb682b1bcfb1e20a69a853adb7bde81084a3e7781a61334c398c81471ff49906c5420141975951914e0b2709890d3e9e' '80354a9fc9de49f87183f2a0d7141b227bdd1eac421cfd5760e08d81e8e93a3c8ef6d9ec64c1c73cf0816a882da12527f9f0e2fce917991f1244900e3d973aef') prepare () { @@ -78,6 +80,9 @@ mv ../CakePHP-Enum-Behavior-1.0-zm/* web/api/app/Plugin/CakePHP-Enum-Behavior mv ../crud-3.2.0/* web/api/app/Plugin/Crud mv ../RtspServer-eab32851421ffe54fec0229c3efc44c642bc8d46/* dep/RtspServer + + # Apply ffmpeg 8 patch + patch -p1 < ../zm-ffmpeg8.diff } build() { diff -uN zoneminder.org/zm-ffmpeg8.diff zoneminder/zm-ffmpeg8.diff --- zoneminder.org/zm-ffmpeg8.diff 1970-01-01 01:00:00.000000000 +0100 +++ zoneminder/zm-ffmpeg8.diff 2025-12-04 08:14:39.163073073 +0100 @@ -0,0 +1,120 @@ +diff -ur zoneminder-1.36.36.org/src/zm_ffmpeg_camera.cpp zoneminder-1.36.36/src/zm_ffmpeg_camera.cpp +--- zoneminder-1.36.36.org/src/zm_ffmpeg_camera.cpp 2025-10-29 14:45:26.933191973 +0100 ++++ zoneminder-1.36.36/src/zm_ffmpeg_camera.cpp 2025-11-05 14:31:49.843777440 +0100 +@@ -595,14 +595,18 @@ + mCanCapture = false; + + if ( mVideoCodecContext ) { ++#if !LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) + avcodec_close(mVideoCodecContext); ++#endif + #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + avcodec_free_context(&mVideoCodecContext); + #endif + mVideoCodecContext = nullptr; // Freed by av_close_input_file + } + if ( mAudioCodecContext ) { ++#if !LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) + avcodec_close(mAudioCodecContext); ++#endif + #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + avcodec_free_context(&mAudioCodecContext); + #endif +diff -ur zoneminder-1.36.36.org/src/zm_ffmpeg.cpp zoneminder-1.36.36/src/zm_ffmpeg.cpp +--- zoneminder-1.36.36.org/src/zm_ffmpeg.cpp 2025-10-29 14:45:26.933191973 +0100 ++++ zoneminder-1.36.36/src/zm_ffmpeg.cpp 2025-11-05 14:31:49.844198254 +0100 +@@ -601,7 +601,9 @@ + + void zm_free_codec(AVCodecContext **ctx) { + if (*ctx) { ++#if !LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) + avcodec_close(*ctx); ++#endif + #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + // We allocate and copy in newer ffmpeg, so need to free it + avcodec_free_context(ctx); +diff -ur zoneminder-1.36.36.org/src/zm_ffmpeg_input.cpp zoneminder-1.36.36/src/zm_ffmpeg_input.cpp +--- zoneminder-1.36.36.org/src/zm_ffmpeg_input.cpp 2025-10-29 14:45:26.933191973 +0100 ++++ zoneminder-1.36.36/src/zm_ffmpeg_input.cpp 2025-11-05 14:31:49.844690762 +0100 +@@ -143,7 +143,9 @@ + int FFmpeg_Input::Close( ) { + if (streams) { + for (unsigned int i = 0; i < input_format_context->nb_streams; i += 1) { ++#if !LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) + avcodec_close(streams[i].context); ++#endif + #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + avcodec_free_context(&streams[i].context); + streams[i].context = nullptr; +diff -ur zoneminder-1.36.36.org/src/zm_mpeg.cpp zoneminder-1.36.36/src/zm_mpeg.cpp +--- zoneminder-1.36.36.org/src/zm_mpeg.cpp 2025-10-29 14:45:26.933191973 +0100 ++++ zoneminder-1.36.36/src/zm_mpeg.cpp 2025-11-05 14:31:49.844920280 +0100 +@@ -498,7 +498,9 @@ + } + /* close each codec */ + if ( ost ) { ++#if !LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) + avcodec_close( codec_context ); ++#endif + av_free( opicture->data[0] ); + av_frame_free( &opicture ); + if ( tmp_opicture ) { +@@ -532,6 +534,9 @@ + if ( codec_and_format ) { + delete codec_and_format; + } ++#if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) ++ avcodec_free_context(&codec_context); ++#endif + } + + double VideoStream::EncodeFrame( const uint8_t *buffer, int buffer_size, bool _add_timestamp, unsigned int _timestamp ) { +diff -ur zoneminder-1.36.36.org/src/zm_remote_camera_rtsp.cpp zoneminder-1.36.36/src/zm_remote_camera_rtsp.cpp +--- zoneminder-1.36.36.org/src/zm_remote_camera_rtsp.cpp 2025-10-29 14:45:26.933191973 +0100 ++++ zoneminder-1.36.36/src/zm_remote_camera_rtsp.cpp 2025-11-05 14:33:07.185734189 +0100 +@@ -84,8 +84,10 @@ + RemoteCameraRtsp::~RemoteCameraRtsp() { + + if ( mVideoCodecContext ) { ++#if !LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) + avcodec_close(mVideoCodecContext); + mVideoCodecContext = nullptr; // Freed by avformat_free_context in the destructor of RtspThread class ++#endif + } + // Is allocated in RTSPThread and is free there as well + mFormatContext = nullptr; +@@ -93,6 +95,9 @@ + if ( capture ) { + Terminate(); + } ++#if LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) ++ avcodec_free_context(&mVideoCodecContext); ++#endif + } + + void RemoteCameraRtsp::Initialise() { +diff -ur zoneminder-1.36.36.org/src/zm_videostore.cpp zoneminder-1.36.36/src/zm_videostore.cpp +--- zoneminder-1.36.36.org/src/zm_videostore.cpp 2025-10-29 14:45:26.933887846 +0100 ++++ zoneminder-1.36.36/src/zm_videostore.cpp 2025-11-05 14:31:49.845456830 +0100 +@@ -754,8 +754,10 @@ + if (video_out_stream) { + video_in_ctx = nullptr; + ++#if !LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) + avcodec_close(video_out_ctx); + Debug(3, "Freeing video_out_ctx"); ++#endif + avcodec_free_context(&video_out_ctx); + if (hw_device_ctx) { + Debug(3, "Freeing hw_device_ctx"); +@@ -772,8 +774,10 @@ + audio_in_codec = nullptr; + + if (audio_out_ctx) { ++#if !LIBAVCODEC_VERSION_CHECK(62, 11, 0, 11, 0) + Debug(4, "Success closing audio_out_ctx"); + avcodec_close(audio_out_ctx); ++#endif + #if LIBAVCODEC_VERSION_CHECK(57, 64, 0, 64, 0) + avcodec_free_context(&audio_out_ctx); + #endif