git: 981b361efddf - main - multimedia/mediamtx: New Port: Ready-to-use RTSP / RTMP / LL-HLS / WebRTC server and proxy
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 02 Feb 2025 18:48:11 UTC
The branch main has been updated by diizzy: URL: https://cgit.FreeBSD.org/ports/commit/?id=981b361efddf111d3ed5def597ce365672ac4a9e commit 981b361efddf111d3ed5def597ce365672ac4a9e Author: Daniel Engberg <diizzy@FreeBSD.org> AuthorDate: 2025-02-02 18:44:26 +0000 Commit: Daniel Engberg <diizzy@FreeBSD.org> CommitDate: 2025-02-02 18:47:27 +0000 multimedia/mediamtx: New Port: Ready-to-use RTSP / RTMP / LL-HLS / WebRTC server and proxy Remove rpicamera support, patch obtained from Alpine Linux MediaMTX is a ready-to-use and zero-dependency real-time media server and media proxy that allows to publish, read, proxy, record and playback video and audio streams. It supports multiple protocols such as SRT, WebRTC, RTSP, RTMP, HLS, UDP/MPEG-TS and also able to record and serve media on demand. WWW: https://github.com/bluenviron/mediamtx Source: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/79233 --- GIDs | 2 +- UIDs | 2 +- multimedia/Makefile | 1 + multimedia/mediamtx/Makefile | 35 +++++++++ multimedia/mediamtx/distinfo | 7 ++ multimedia/mediamtx/files/mediamtx.in | 49 +++++++++++++ multimedia/mediamtx/files/patch-mediamtx.yml | 106 +++++++++++++++++++++++++++ multimedia/mediamtx/files/patch-rpicamera | 88 ++++++++++++++++++++++ multimedia/mediamtx/files/pkg-message.in | 11 +++ multimedia/mediamtx/pkg-descr | 4 + multimedia/mediamtx/pkg-plist | 2 + 11 files changed, 305 insertions(+), 2 deletions(-) diff --git a/GIDs b/GIDs index 81a5275cc3c2..58cbe5ed30d2 100644 --- a/GIDs +++ b/GIDs @@ -805,7 +805,7 @@ plocate:*:860: # free: 861 # free: 862 # free: 863 -# free: 864 +mediamtx:*:864: z2m:*:865: vglusers:*:866: sqlpage:*:867: diff --git a/UIDs b/UIDs index f79658aa4f96..4451ad11aa8b 100644 --- a/UIDs +++ b/UIDs @@ -811,7 +811,7 @@ opensearch:*:855:855::0:0:opensearch user:/nonexistent:/usr/sbin/nologin # free: 861 # free: 862 # free: 863 -# free: 864 +mediamtx:*:864:864::0:0:mediamtx:/nonexistent:/usr/sbin/nologin z2m:*:865:865::0:0:zigbee2mqtt:/usr/local/z2m:/usr/sbin/nologin # free: 866 sqlpage:*:867:867::0:0:SQLPage:/nonexistent:/usr/sbin/nologin diff --git a/multimedia/Makefile b/multimedia/Makefile index 6f78b658a22c..8597cd5ba7d8 100644 --- a/multimedia/Makefile +++ b/multimedia/Makefile @@ -225,6 +225,7 @@ SUBDIR += makemkv SUBDIR += mediaelch SUBDIR += mediainfo + SUBDIR += mediamtx SUBDIR += mencoder SUBDIR += minisatip SUBDIR += minitube diff --git a/multimedia/mediamtx/Makefile b/multimedia/mediamtx/Makefile new file mode 100644 index 000000000000..8c28600610ff --- /dev/null +++ b/multimedia/mediamtx/Makefile @@ -0,0 +1,35 @@ +PORTNAME= mediamtx +DISTVERSIONPREFIX= v +DISTVERSION= 1.11.2 +CATEGORIES= multimedia net +MASTER_SITES+= https://github.com/video-dev/hls.js/releases/download/v1.5.20/ +DISTFILES+= release.zip + +MAINTAINER= diizzy@FreeBSD.org +COMMENT= Ready-to-use RTSP / RTMP / LL-HLS / WebRTC server and proxy that allows to read, publish and proxy video and audio streams +WWW= https://github.com/bluenviron/mediamtx + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go:1.23,modules +GO_MODULE= github.com/bluenviron/mediamtx + +USE_RC_SUBR= mediamtx + +USERS= mediamtx +GROUPS= mediamtx + +SUB_FILES= pkg-message +SUB_LIST= USER=${USERS} GROUP=${GROUPS} + +post-extract: + ${MV} ${WRKDIR}/dist/hls.min.js ${WRKSRC}/internal/servers/hls + +pre-configure: + ${ECHO} ${DISTVERSIONFULL} > ${WRKSRC}/internal/core/VERSION + +post-install: + ${INSTALL_DATA} ${WRKSRC}/mediamtx.yml ${STAGEDIR}${PREFIX}/etc/mediamtx.yml.sample + +.include <bsd.port.mk> diff --git a/multimedia/mediamtx/distinfo b/multimedia/mediamtx/distinfo new file mode 100644 index 000000000000..018467e448e5 --- /dev/null +++ b/multimedia/mediamtx/distinfo @@ -0,0 +1,7 @@ +TIMESTAMP = 1738490306 +SHA256 (go/multimedia_mediamtx/mediamtx-v1.11.2/release.zip) = b67b84ce6aedbed53f7907b516aceee1ae40e6082103915bc7024a62fa562841 +SIZE (go/multimedia_mediamtx/mediamtx-v1.11.2/release.zip) = 4585318 +SHA256 (go/multimedia_mediamtx/mediamtx-v1.11.2/v1.11.2.mod) = a31f2a05cda0abb1860f0cab0a5293671c918edfaf7d58770001d8ba30f0b06a +SIZE (go/multimedia_mediamtx/mediamtx-v1.11.2/v1.11.2.mod) = 4535 +SHA256 (go/multimedia_mediamtx/mediamtx-v1.11.2/v1.11.2.zip) = 30a3d0fc5578faa0f2aa3cda86959389974fc2d0d0d2f6139761163e6e23a715 +SIZE (go/multimedia_mediamtx/mediamtx-v1.11.2/v1.11.2.zip) = 600864 diff --git a/multimedia/mediamtx/files/mediamtx.in b/multimedia/mediamtx/files/mediamtx.in new file mode 100644 index 000000000000..5888592ca22e --- /dev/null +++ b/multimedia/mediamtx/files/mediamtx.in @@ -0,0 +1,49 @@ +#!/bin/sh + +# PROVIDE: mediamtx +# REQUIRE: DAEMON +# KEYWORD: shutdown + +# +# Add the following line to /etc/rc.conf to enable mediamtx: +# mediamtx_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable mediamtx. +# mediamtx_conf_dir (str): Directory where ${name} configuration +# data is stored. + +. /etc/rc.subr + +name="mediamtx" +rcvar=mediamtx_enable + +load_rc_config ${name} + +: ${mediamtx_enable:="NO"} +: ${mediamtx_user:="%%USER%%"} +: ${mediamtx_group:="%%GROUP%%"} +: ${mediamtx_conf_dir="%%PREFIX%%/etc"} + +start_precmd=mediamtx_precmd +stop_postcmd=mediamtx_stop_postcmd + +procname="%%PREFIX%%/bin/${name}" +pidfile="/var/run/mediamtx/mediamtx.pid" +required_files="${mediamtx_conf_dir}/mediamtx.yml" + +command="/usr/sbin/daemon" +command_args="-f -t ${name} -p ${pidfile} ${procname} ${required_files}" + +mediamtx_precmd() +{ + local rundir=${pidfile%/*} + if [ ! -d $rundir ] ; then + install -d -m 0755 -o %%USER%% -g %%GROUP%% $rundir + fi +} + +mediamtx_stop_postcmd() +{ + rm -f "$rundir" +} + +run_rc_command "$1" diff --git a/multimedia/mediamtx/files/patch-mediamtx.yml b/multimedia/mediamtx/files/patch-mediamtx.yml new file mode 100644 index 000000000000..510b64f9765a --- /dev/null +++ b/multimedia/mediamtx/files/patch-mediamtx.yml @@ -0,0 +1,106 @@ +--- mediamtx.yml.orig 2025-02-02 14:33:21 UTC ++++ mediamtx.yml +@@ -419,7 +419,6 @@ pathDefaults: + # * whep://existing-url -> the stream is pulled from another WebRTC server / camera + # * wheps://existing-url -> the stream is pulled from another WebRTC server / camera with HTTPS + # * redirect -> the stream is provided by another path or server +- # * rpiCamera -> the stream is provided by a Raspberry Pi Camera + # The following variables can be used in the source string: + # * $MTX_QUERY: query parameters (passed by first reader) + # * $G1, $G2, ...: regular expression groups, if path name is +@@ -504,95 +503,6 @@ pathDefaults: + + # RTSP URL which clients will be redirected to. + sourceRedirect: +- +- ############################################### +- # Default path settings -> Raspberry Pi Camera source (when source is "rpiCamera") +- +- # ID of the camera +- rpiCameraCamID: 0 +- # Width of frames +- rpiCameraWidth: 1920 +- # Height of frames +- rpiCameraHeight: 1080 +- # Flip horizontally +- rpiCameraHFlip: false +- # Flip vertically +- rpiCameraVFlip: false +- # Brightness [-1, 1] +- rpiCameraBrightness: 0 +- # Contrast [0, 16] +- rpiCameraContrast: 1 +- # Saturation [0, 16] +- rpiCameraSaturation: 1 +- # Sharpness [0, 16] +- rpiCameraSharpness: 1 +- # Exposure mode. +- # values: normal, short, long, custom +- rpiCameraExposure: normal +- # Auto-white-balance mode. +- # values: auto, incandescent, tungsten, fluorescent, indoor, daylight, cloudy, custom +- rpiCameraAWB: auto +- # Auto-white-balance fixed gains. This can be used in place of rpiCameraAWB. +- # format: [red,blue] +- rpiCameraAWBGains: [0, 0] +- # Denoise operating mode. +- # values: off, cdn_off, cdn_fast, cdn_hq +- rpiCameraDenoise: "off" +- # Fixed shutter speed, in microseconds. +- rpiCameraShutter: 0 +- # Metering mode of the AEC/AGC algorithm. +- # values: centre, spot, matrix, custom +- rpiCameraMetering: centre +- # Fixed gain +- rpiCameraGain: 0 +- # EV compensation of the image [-10, 10] +- rpiCameraEV: 0 +- # Region of interest, in format x,y,width,height (all normalized between 0 and 1) +- rpiCameraROI: +- # Whether to enable HDR on Raspberry Camera 3. +- rpiCameraHDR: false +- # Tuning file +- rpiCameraTuningFile: +- # Sensor mode, in format [width]:[height]:[bit-depth]:[packing] +- # bit-depth and packing are optional. +- rpiCameraMode: +- # frames per second +- rpiCameraFPS: 30 +- # Autofocus mode +- # values: auto, manual, continuous +- rpiCameraAfMode: continuous +- # Autofocus range +- # values: normal, macro, full +- rpiCameraAfRange: normal +- # Autofocus speed +- # values: normal, fast +- rpiCameraAfSpeed: normal +- # Lens position (for manual autofocus only), will be set to focus to a specific distance +- # calculated by the following formula: d = 1 / value +- # Examples: 0 moves the lens to infinity. +- # 0.5 moves the lens to focus on objects 2m away. +- # 2 moves the lens to focus on objects 50cm away. +- rpiCameraLensPosition: 0.0 +- # Specifies the autofocus window, in the form x,y,width,height where the coordinates +- # are given as a proportion of the entire image. +- rpiCameraAfWindow: +- # Manual flicker correction period, in microseconds. +- rpiCameraFlickerPeriod: 0 +- # Enables printing text on each frame. +- rpiCameraTextOverlayEnable: false +- # Text that is printed on each frame. +- # format is the one of the strftime() function. +- rpiCameraTextOverlay: '%Y-%m-%d %H:%M:%S - MediaMTX' +- # Codec. Available values: auto, hardwareH264, softwareH264 +- rpiCameraCodec: auto +- # Period between IDR frames +- rpiCameraIDRPeriod: 60 +- # Bitrate +- rpiCameraBitrate: 5000000 +- # H264 profile +- rpiCameraProfile: main +- # H264 level +- rpiCameraLevel: '4.1' + + ############################################### + # Default path settings -> Hooks diff --git a/multimedia/mediamtx/files/patch-rpicamera b/multimedia/mediamtx/files/patch-rpicamera new file mode 100644 index 000000000000..81e708c591aa --- /dev/null +++ b/multimedia/mediamtx/files/patch-rpicamera @@ -0,0 +1,88 @@ +From 341c1ad77717c9957993b9abebcc627007f10f15 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Krystian=20Chachu=C5=82a?= <krystian@krystianch.com> +Date: Thu, 30 Jan 2025 23:03:57 +0100 +Subject: [PATCH] rpicamera: disable + +--- + internal/staticsources/rpicamera/camera.go | 2 +- + internal/staticsources/rpicamera/camera_disabled.go | 2 -- + internal/staticsources/rpicamera/component.go | 2 +- + internal/staticsources/rpicamera/component_32.go | 2 +- + internal/staticsources/rpicamera/component_64.go | 2 +- + internal/staticsources/rpicamera/params_serialize.go | 2 +- + internal/staticsources/rpicamera/pipe.go | 2 +- + 7 files changed, 6 insertions(+), 8 deletions(-) + +diff --git a/internal/staticsources/rpicamera/camera.go b/internal/staticsources/rpicamera/camera.go +index 9db131f4..b8a41317 100644 +--- internal/staticsources/rpicamera/camera.go ++++ internal/staticsources/rpicamera/camera.go +@@ -1,4 +1,4 @@ +-//go:build (linux && arm) || (linux && arm64) ++//go:build exclude + + package rpicamera + +diff --git a/internal/staticsources/rpicamera/camera_disabled.go b/internal/staticsources/rpicamera/camera_disabled.go +index ac84ee59..e54ccaa3 100644 +--- internal/staticsources/rpicamera/camera_disabled.go ++++ internal/staticsources/rpicamera/camera_disabled.go +@@ -1,5 +1,3 @@ +-//go:build !linux || (!arm && !arm64) +- + package rpicamera + + import ( +diff --git a/internal/staticsources/rpicamera/component.go b/internal/staticsources/rpicamera/component.go +index c4036390..e138f929 100644 +--- internal/staticsources/rpicamera/component.go ++++ internal/staticsources/rpicamera/component.go +@@ -1,4 +1,4 @@ +-//go:build (linux && arm) || (linux && arm64) ++//go:build exclude + + package rpicamera + +diff --git a/internal/staticsources/rpicamera/component_32.go b/internal/staticsources/rpicamera/component_32.go +index b7d19f11..51615164 100644 +--- internal/staticsources/rpicamera/component_32.go ++++ internal/staticsources/rpicamera/component_32.go +@@ -1,4 +1,4 @@ +-//go:build linux && arm ++//go:build exclude + + package rpicamera + +diff --git a/internal/staticsources/rpicamera/component_64.go b/internal/staticsources/rpicamera/component_64.go +index 690bf567..ed2e89dd 100644 +--- internal/staticsources/rpicamera/component_64.go ++++ internal/staticsources/rpicamera/component_64.go +@@ -1,4 +1,4 @@ +-//go:build linux && arm64 ++//go:build exclude + + package rpicamera + +diff --git a/internal/staticsources/rpicamera/params_serialize.go b/internal/staticsources/rpicamera/params_serialize.go +index d9e023b1..845725f3 100644 +--- internal/staticsources/rpicamera/params_serialize.go ++++ internal/staticsources/rpicamera/params_serialize.go +@@ -1,4 +1,4 @@ +-//go:build (linux && arm) || (linux && arm64) ++//go:build exclude + + package rpicamera + +diff --git a/internal/staticsources/rpicamera/pipe.go b/internal/staticsources/rpicamera/pipe.go +index 44eb3bf1..00be2658 100644 +--- internal/staticsources/rpicamera/pipe.go ++++ internal/staticsources/rpicamera/pipe.go +@@ -1,4 +1,4 @@ +-//go:build (linux && arm) || (linux && arm64) ++//go:build exclude + + package rpicamera + +-- +2.47.1 + diff --git a/multimedia/mediamtx/files/pkg-message.in b/multimedia/mediamtx/files/pkg-message.in new file mode 100644 index 000000000000..05c73dc27270 --- /dev/null +++ b/multimedia/mediamtx/files/pkg-message.in @@ -0,0 +1,11 @@ +[ +{ type: install + message: <<EOM + Edit /etc/rc.conf(.local) to start MediaMTX automatically at system + startup. Support for rpiCamera is not included. + + A sample configuration file is installed at the following location: + %%PREFIX%%/etc/mediamtx.yml.sample +EOM +} +] diff --git a/multimedia/mediamtx/pkg-descr b/multimedia/mediamtx/pkg-descr new file mode 100644 index 000000000000..55422ebf9a91 --- /dev/null +++ b/multimedia/mediamtx/pkg-descr @@ -0,0 +1,4 @@ +MediaMTX is a ready-to-use and zero-dependency real-time media server and +media proxy that allows to publish, read, proxy, record and playback video and +audio streams. It supports multiple protocols such as SRT, WebRTC, RTSP, RTMP, +HLS, UDP/MPEG-TS and also able to record and serve media on demand. diff --git a/multimedia/mediamtx/pkg-plist b/multimedia/mediamtx/pkg-plist new file mode 100644 index 000000000000..ab493af109c1 --- /dev/null +++ b/multimedia/mediamtx/pkg-plist @@ -0,0 +1,2 @@ +bin/mediamtx +@sample(mediamtx,mediamtx,0640) etc/mediamtx.yml.sample