ffmpeg scripts update
This commit is contained in:
parent
85cd11822c
commit
eb817f4f5f
2 changed files with 28 additions and 6 deletions
|
@ -58,7 +58,7 @@ in {
|
||||||
advanced.pan_id = 1337;
|
advanced.pan_id = 1337;
|
||||||
|
|
||||||
# add last seen information
|
# add last seen information
|
||||||
advanced.last_seen = "ISO_8601_local";
|
advanced.last_seen = "ISO_8601_local";
|
||||||
|
|
||||||
# configure web ui
|
# configure web ui
|
||||||
frontend.port = 9666;
|
frontend.port = 9666;
|
||||||
|
|
|
@ -5,13 +5,14 @@ let
|
||||||
cfg = config.programs.custom.ffmpeg;
|
cfg = config.programs.custom.ffmpeg;
|
||||||
|
|
||||||
ffmpegTemplate = name:
|
ffmpegTemplate = name:
|
||||||
{ profile, preset, tune ? null }:
|
{ profile, preset, tune ? null, width ? 1280, height ? 720
|
||||||
|
, resolution ? "720p" }:
|
||||||
pkgs.writeShellScriptBin "ffmpeg-${name}" ''
|
pkgs.writeShellScriptBin "ffmpeg-${name}" ''
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ $# -eq 0 ]
|
||||||
then
|
then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
ffmpeg-<profile>-<preset>-<tunes>-720p <input> <output>
|
ffmpeg-<profile>-<preset>-<tunes>-${resolution} <input> <output>
|
||||||
|
|
||||||
profiles =
|
profiles =
|
||||||
"baseline" - Primarily for low-cost applications that require additional data loss robustness
|
"baseline" - Primarily for low-cost applications that require additional data loss robustness
|
||||||
|
@ -62,7 +63,9 @@ let
|
||||||
|
|
||||||
exec ${pkgs.ffmpeg}/bin/ffmpeg \
|
exec ${pkgs.ffmpeg}/bin/ffmpeg \
|
||||||
-i "$input" \
|
-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 \
|
-vcodec libx264 \
|
||||||
-preset ${preset} \
|
-preset ${preset} \
|
||||||
-profile:v ${profile} \
|
-profile:v ${profile} \
|
||||||
|
@ -77,11 +80,27 @@ let
|
||||||
ffmpegDescriptive = profile: preset:
|
ffmpegDescriptive = profile: preset:
|
||||||
ffmpegTemplate "${profile}-${preset}-720p" { inherit 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:
|
ffmpegDescriptiveTune = profile: preset: tune:
|
||||||
ffmpegTemplate "${profile}-${preset}-${tune}-720p" {
|
ffmpegTemplate "${profile}-${preset}-${tune}-720p" {
|
||||||
inherit profile preset tune;
|
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
|
# https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles
|
||||||
profiles = [
|
profiles = [
|
||||||
"baseline"
|
"baseline"
|
||||||
|
@ -104,9 +123,12 @@ let
|
||||||
];
|
];
|
||||||
tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ];
|
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 {
|
in {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue