From eb817f4f5f80bd37f07fb4ba6992c6d117d92077 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sat, 27 Feb 2021 21:48:40 +0100 Subject: [PATCH] ffmpeg scripts update --- configs/pepe/home-assistant/zigbee2mqtt.nix | 2 +- modules/programs/ffmpeg.nix | 32 +++++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/configs/pepe/home-assistant/zigbee2mqtt.nix b/configs/pepe/home-assistant/zigbee2mqtt.nix index cd16a78..ed14614 100644 --- a/configs/pepe/home-assistant/zigbee2mqtt.nix +++ b/configs/pepe/home-assistant/zigbee2mqtt.nix @@ -58,7 +58,7 @@ in { advanced.pan_id = 1337; # add last seen information - advanced.last_seen = "ISO_8601_local"; + advanced.last_seen = "ISO_8601_local"; # configure web ui frontend.port = 9666; diff --git a/modules/programs/ffmpeg.nix b/modules/programs/ffmpeg.nix index bf17313..a613d22 100644 --- a/modules/programs/ffmpeg.nix +++ b/modules/programs/ffmpeg.nix @@ -5,13 +5,14 @@ let cfg = config.programs.custom.ffmpeg; ffmpegTemplate = name: - { profile, preset, tune ? null }: + { profile, preset, tune ? null, width ? 1280, height ? 720 + , resolution ? "720p" }: pkgs.writeShellScriptBin "ffmpeg-${name}" '' if [ $# -eq 0 ] then cat <---720p + ffmpeg----${resolution} profiles = "baseline" - Primarily for low-cost applications that require additional data loss robustness @@ -62,7 +63,9 @@ let exec ${pkgs.ffmpeg}/bin/ffmpeg \ -i "$input" \ - -filter:v scale=h='min(720\,ih)':w='min(1280\,iw)' \ + -filter:v scale=h='min(${toString height}\,ih)':w='min(${ + toString width + }\,iw)' \ -vcodec libx264 \ -preset ${preset} \ -profile:v ${profile} \ @@ -77,11 +80,27 @@ let ffmpegDescriptive = profile: preset: ffmpegTemplate "${profile}-${preset}-720p" { inherit profile preset; }; + ffmpegDescriptive1080p = profile: preset: + ffmpegTemplate "${profile}-${preset}-1080p" { + inherit profile preset; + height = 1080; + width = 1920; + resolution = "1080p"; + }; + ffmpegDescriptiveTune = profile: preset: tune: ffmpegTemplate "${profile}-${preset}-${tune}-720p" { inherit profile preset tune; }; + ffmpegDescriptiveTune1080p = profile: preset: tune: + ffmpegTemplate "${profile}-${preset}-${tune}-720p" { + inherit profile preset tune; + height = 1080; + width = 1920; + resolution = "1080p"; + }; + # https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles profiles = [ "baseline" @@ -104,9 +123,12 @@ let ]; tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ]; - ffmpegs = lib.crossLists ffmpegDescriptive [ profiles presets ]; + ffmpegs = (lib.crossLists ffmpegDescriptive [ profiles presets ]) + ++ (lib.crossLists ffmpegDescriptive1080p [ profiles presets ]); - ffmpegsTune = lib.crossLists ffmpegDescriptiveTune [ profiles presets tunes ]; + ffmpegsTune = + (lib.crossLists ffmpegDescriptiveTune [ profiles presets tunes ]) + ++ (lib.crossLists ffmpegDescriptiveTune1080p [ profiles presets tunes ]); in {