Compare commits

..

No commits in common. "d185f097f2a4dc9415666f310c64c7d229e16c12" and "e56f375478d1a0c29b5c135416cf02ecbb091229" have entirely different histories.

13 changed files with 183 additions and 257 deletions

258
flake.lock generated
View File

@ -20,11 +20,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762356719, "lastModified": 1759499898,
"narHash": "sha256-qwd/xdoOya1m8FENle+4hWnydCtlXUWLAW/Auk6WL7s=", "narHash": "sha256-UNzYHLWfkSzLHDep5Ckb5tXc0fdxwPIrT+MY4kpQttM=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "aquamarine", "repo": "aquamarine",
"rev": "6d0b3567584691bf9d8fedb5d0093309e2f979c7", "rev": "655e067f96fd44b3f5685e17f566b0e4d535d798",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -41,11 +41,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762547735, "lastModified": 1759439824,
"narHash": "sha256-uJb+4GjFynnDQdDstcmdccx7kIYIf9STk3XymMKEJfs=", "narHash": "sha256-bOmAhQG3Ek2ZpNcnkFo3yiGeSmklk1uLm09BwDdnpWM=",
"owner": "polygon", "owner": "polygon",
"repo": "audio.nix", "repo": "audio.nix",
"rev": "46b42efb0c382daca6f1184a1060ffa0636a22a6", "rev": "8595d27a844a11bd14819de330ce6c9f724923bb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -82,11 +82,11 @@
}, },
"locked": { "locked": {
"dir": "pkgs/firefox-addons", "dir": "pkgs/firefox-addons",
"lastModified": 1762920261, "lastModified": 1760846615,
"narHash": "sha256-VuUg2EP2Y0QrDTsDP6/3kN3Hurn6HfyMW3rGzdruhW8=", "narHash": "sha256-ept30QIKVAx/f7fHBGIfCPhPdZNd4yaBTq2Frz1LkFM=",
"owner": "rycee", "owner": "rycee",
"repo": "nur-expressions", "repo": "nur-expressions",
"rev": "8cd76837f50debe28b51820adb00b522df8ade91", "rev": "afeaf06f6cbc7fd65e8cdbe53ddf3f3c643b36d1",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@ -216,11 +216,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762462052, "lastModified": 1759490292,
"narHash": "sha256-6roLYzcDf4V38RUMSqycsOwAnqfodL6BmhRkUtwIgdA=", "narHash": "sha256-T6iWzDOXp8Wv0KQOCTHpBcmAOdHJ6zc/l9xaztW6Ivc=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprgraphics", "repo": "hyprgraphics",
"rev": "ffc999d980c7b3bca85d3ebd0a9fbadf984a8162", "rev": "9431db625cd9bb66ac55525479dce694101d6d7a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -234,8 +234,8 @@
"aquamarine": "aquamarine", "aquamarine": "aquamarine",
"hyprcursor": "hyprcursor", "hyprcursor": "hyprcursor",
"hyprgraphics": "hyprgraphics", "hyprgraphics": "hyprgraphics",
"hyprland-guiutils": "hyprland-guiutils",
"hyprland-protocols": "hyprland-protocols", "hyprland-protocols": "hyprland-protocols",
"hyprland-qtutils": "hyprland-qtutils",
"hyprlang": "hyprlang", "hyprlang": "hyprlang",
"hyprutils": "hyprutils", "hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner", "hyprwayland-scanner": "hyprwayland-scanner",
@ -247,11 +247,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1762987426, "lastModified": 1760874867,
"narHash": "sha256-MTW2FfSP1gqjzL3nVKuz/RfvlextYjlgQPHEZbZI5cM=", "narHash": "sha256-w2JettCPyqWKMYoJRCTc5/nsSvGrSV9jG4kbn8Q0pZk=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "Hyprland", "repo": "Hyprland",
"rev": "b77cbad50251f0506b61d834b025247dcf74dddf", "rev": "59ff7b2f891d06f4097128faf7027a3863542167",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -260,52 +260,6 @@
"type": "github" "type": "github"
} }
}, },
"hyprland-guiutils": {
"inputs": {
"aquamarine": [
"hyprland",
"aquamarine"
],
"hyprgraphics": [
"hyprland",
"hyprgraphics"
],
"hyprlang": [
"hyprland",
"hyprlang"
],
"hyprtoolkit": "hyprtoolkit",
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1762755186,
"narHash": "sha256-ZjjETUHtoEhVN7JI1Cbt3p/KcXpK8ZQaPHx7UkG1OgA=",
"owner": "hyprwm",
"repo": "hyprland-guiutils",
"rev": "66356e20a8ed348aa49c1b9ceace786e224225b3",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-guiutils",
"type": "github"
}
},
"hyprland-plugins": { "hyprland-plugins": {
"inputs": { "inputs": {
"hyprland": [ "hyprland": [
@ -323,11 +277,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762989208, "lastModified": 1760659005,
"narHash": "sha256-NBTbKW0MVIMFCjAqeoJWkg5iUucAZ9jS4Lbyax6rIBE=", "narHash": "sha256-wyS6tXYJuzbwckOeaCoRtT4qIG2UZ0YvSZx7EBNjTV0=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprland-plugins", "repo": "hyprland-plugins",
"rev": "befb2670803cf7c1b9f0323449c8d9ccdaa485e2", "rev": "a5a6f93d72d5fb37e78b98c756cfd8b340e71a19",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -348,11 +302,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1759610243, "lastModified": 1749046714,
"narHash": "sha256-+KEVnKBe8wz+a6dTLq8YDcF3UrhQElwsYJaVaHXJtoI=", "narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprland-protocols", "repo": "hyprland-protocols",
"rev": "bd153e76f751f150a09328dbdeb5e4fab9d23622", "rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -361,6 +315,74 @@
"type": "github" "type": "github"
} }
}, },
"hyprland-qt-support": {
"inputs": {
"hyprlang": [
"hyprland",
"hyprland-qtutils",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"hyprland-qtutils",
"nixpkgs"
],
"systems": [
"hyprland",
"hyprland-qtutils",
"systems"
]
},
"locked": {
"lastModified": 1749154592,
"narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=",
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"type": "github"
}
},
"hyprland-qtutils": {
"inputs": {
"hyprland-qt-support": "hyprland-qt-support",
"hyprlang": [
"hyprland",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprland-qtutils",
"hyprlang",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1759080228,
"narHash": "sha256-RgDoAja0T1hnF0pTc56xPfLfFOO8Utol2iITwYbUhTk=",
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"rev": "629b15c19fa4082e4ce6be09fdb89e8c3312aed7",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"type": "github"
}
},
"hyprlang": { "hyprlang": {
"inputs": { "inputs": {
"hyprutils": [ "hyprutils": [
@ -390,58 +412,6 @@
"type": "github" "type": "github"
} }
}, },
"hyprtoolkit": {
"inputs": {
"aquamarine": [
"hyprland",
"hyprland-guiutils",
"aquamarine"
],
"hyprgraphics": [
"hyprland",
"hyprland-guiutils",
"hyprgraphics"
],
"hyprlang": [
"hyprland",
"hyprland-guiutils",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprland-guiutils",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprland-guiutils",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"hyprland-guiutils",
"nixpkgs"
],
"systems": [
"hyprland",
"hyprland-guiutils",
"systems"
]
},
"locked": {
"lastModified": 1762463729,
"narHash": "sha256-2fYkU/mdz8WKY3dkDPlE/j6hTxIwqultsx4gMMsMns0=",
"owner": "hyprwm",
"repo": "hyprtoolkit",
"rev": "88483bdee5329ec985f0c8f834c519cd18cfe532",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprtoolkit",
"type": "github"
}
},
"hyprutils": { "hyprutils": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -454,11 +424,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762387740, "lastModified": 1759619523,
"narHash": "sha256-gQ9zJ+pUI4o+Gh4Z6jhJll7jjCSwi8ZqJIhCE2oqwhQ=", "narHash": "sha256-r1ed7AR2ZEb2U8gy321/Xcp1ho2tzn+gG1te/Wxsj1A=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprutils", "repo": "hyprutils",
"rev": "926689ddb9c0a8787e58c02c765a62e32d63d1f7", "rev": "3df7bde01efb3a3e8e678d1155f2aa3f19e177ef",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -536,11 +506,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1762847253, "lastModified": 1760106635,
"narHash": "sha256-BWWnUUT01lPwCWUvS0p6Px5UOBFeXJ8jR+ZdLX8IbrU=", "narHash": "sha256-2GoxVaKWTHBxRoeUYSjv0AfSOx4qw5CWSFz2b+VolKU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "899dc449bc6428b9ee6b3b8f771ca2b0ef945ab9", "rev": "9ed85f8afebf2b7478f25db0a98d0e782c0ed903",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -584,11 +554,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1762844143, "lastModified": 1760524057,
"narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=", "narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4", "rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -600,11 +570,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1762756533, "lastModified": 1760580664,
"narHash": "sha256-HiRDeUOD1VLklHeOmaKDzf+8Hb7vSWPVFcWwaTrpm+U=", "narHash": "sha256-/YdfibIrnqXAL8p5kqCU345mzpHoOtuVIkMiI2pF4Dc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c2448301fb856e351aab33e64c33a3fc8bcf637d", "rev": "98ff3f9af2684f6136c24beef08f5e2033fc5389",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -624,11 +594,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762784320, "lastModified": 1759321049,
"narHash": "sha256-odsk96Erywk5hs0dhArF38zb7Oe0q6LZ70gXbxAPKno=", "narHash": "sha256-8XkU4gIrLT2DJZWQyvsP5woXGZF5eE/7AnKfwQkiwYU=",
"owner": "pjones", "owner": "pjones",
"repo": "plasma-manager", "repo": "plasma-manager",
"rev": "7911a0f8a44c7e8b29d031be3149ee8943144321", "rev": "205dcfd4a30d4a5d1b4f28defee69daa7c7252cd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -647,11 +617,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762441963, "lastModified": 1758108966,
"narHash": "sha256-j+rNQ119ffYUkYt2YYS6rnd6Jh/crMZmbqpkGLXaEt0=", "narHash": "sha256-ytw7ROXaWZ7OfwHrQ9xvjpUWeGVm86pwnEd1QhzawIo=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "8e7576e79b88c16d7ee3bbd112c8d90070832885", "rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -704,11 +674,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762812535, "lastModified": 1760845571,
"narHash": "sha256-A91a+K0Q9wfdPLwL06e/kbHeAWSzPYy2EGdTDsyfb+s=", "narHash": "sha256-PwGzU3EOU65Ef1VvuNnVLie+l+P0g/fzf/PGUG82KbM=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "d75e4f89e58fdda39e4809f8c52013caa22483b7", "rev": "9c9a9798be331ed3f4b2902933d7677d0659ee61",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -760,11 +730,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1761431178, "lastModified": 1755354946,
"narHash": "sha256-xzjC1CV3+wpUQKNF+GnadnkeGUCJX+vgaWIZsnz9tzI=", "narHash": "sha256-zdov5f/GcoLQc9qYIS1dUTqtJMeDqmBmo59PAxze6e4=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland", "repo": "xdg-desktop-portal-hyprland",
"rev": "4b8801228ff958d028f588f0c2b911dbf32297f9", "rev": "a10726d6a8d0ef1a0c645378f983b6278c42eaa0",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -213,7 +213,7 @@
}; };
devShells.${system} = { devShells.${system} = {
bulk-transcode = (import ./pkgs/bulk-transcode/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};}; transcode-davinci-resolve = (import ./pkgs/transcode-davinci-resolve/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};};
spotify-shortcuts = (import ./pkgs/spotify-shortcuts/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};}; spotify-shortcuts = (import ./pkgs/spotify-shortcuts/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};};
}; };

View File

@ -107,19 +107,11 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment? system.stateVersion = "24.11"; # Did you read the comment?
# gc settings and binary caches # gc settings
nix = { nix = {
settings = { settings = {
substituters = [
"https://aseipp-nix-cache.freetls.fastly.net"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
experimental-features = ["nix-command" "flakes"]; experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true; auto-optimise-store = true;
trusted-users = [
"@wheel"
];
}; };
gc = { gc = {
automatic = true; automatic = true;

View File

@ -29,14 +29,9 @@
key = "adminPassword"; key = "adminPassword";
}; };
# gc settings and binary caches # Configure nix and garbage collection
nix = { nix = {
settings = { settings = {
substituters = [
"https://aseipp-nix-cache.freetls.fastly.net"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
experimental-features = ["nix-command" "flakes"]; experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true; auto-optimise-store = true;
}; };

View File

@ -202,14 +202,9 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment? system.stateVersion = "24.11"; # Did you read the comment?
# gc settings and binary caches # gc settings
nix = { nix = {
settings = { settings = {
substituters = [
"https://aseipp-nix-cache.freetls.fastly.net"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
experimental-features = ["nix-command" "flakes"]; experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true; auto-optimise-store = true;
}; };

View File

@ -63,10 +63,10 @@ in {
hdrmerge hdrmerge
hugin hugin
] ]
++ lib.optionals cfg.video-editing-light [ffmpeg losslesscut-bin avidemux] ++ lib.optionals cfg.video-editing-light [ffmpeg losslesscut-bin]
++ lib.optionals cfg.video-editing-heavy [ ++ lib.optionals cfg.video-editing-heavy [
davinci-resolve davinci-resolve
hive.bulk-transcode hive.transcode-davinci-resolve
kdePackages.kdenlive kdePackages.kdenlive
] ]
++ lib.optional cfg.daws bitwig-studio-latest; ++ lib.optional cfg.daws bitwig-studio-latest;

View File

@ -1 +0,0 @@
use flake ../../#bulk-transcode --show-trace

View File

@ -1,83 +0,0 @@
#!/usr/bin/env bash
declare -rA presets=(
[davinci-resolve]="-c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a pcm_s16le"
[instagram]="-vf scale='if(gte(iw/ih,1),1920,-1)':'if(gte(iw/ih,1),-1,1920)' -pix_fmt yuv420p -c:v h264_nvenc -b:v 3500k -b:a 128k -c:a aac -movflags +faststart"
[web-generic]="-vf scale='if(gte(iw/ih,1),1920,-1)':'if(gte(iw/ih,1),-1,1920)' -pix_fmt yuv420p -c:v h264_nvenc -crf 23 -preset medium -c:a aac -b:a 128k -movflags +faststart"
[storage]="-c:v hevc_nvenc -preset p7 -b:v 0 -spatial-aq 1 -rc vbr_hq -c:a copy"
)
declare -rA containers=(
[davinci-resolve]="mov"
[instagram]="mp4"
[web-generic]="mp4"
[storage]="mp4"
)
where="${1:-.}"
dest="${2:-$where}"
selection=$(find "$where" -type f | fzf --multi --preview 'ffprobe -v error -show_format -show_streams {}' --preview-window=up:wrap)
preset=$(
printf '%s\n' "${!presets[@]}" | \
fzf --multi --prompt "Select a preset"
)
flags="${presets[$preset]}"
container="${containers[$preset]}"
output_dir=$(find "$dest" -type d ! -name '.*' ! -path '*/.*/*' | fzf --preview 'tree -C {}' --preview-window=up:wrap --prompt "Select output directory: ")
if gum confirm "Flatten the directory structure?";
then
flatten=true
else
flatten=false
fi
function transcode_job {
local ifile="$1"
local output_dir="$2"
local flatten="$3"
local where="$4"
local flags="$5"
local container="$6"
local fname=$(basename "$ifile")
local segment=$(realpath --relative-to="$where" "$ifile")
if [ "$flatten" = true ]; then
output_file="$output_dir/$fname.$container"
else
output_file="$output_dir/$segment.$container"
fi
tmp_file=$(mktemp)
echo "Running Command: ffmpeg -y -i $ifile $flags $output_file" >> "$tmp_file"
mkdir -p "$(dirname "$output_file")"
if ffmpeg -y -i "$ifile" $(echo -n "$flags") "$output_file" 2>> "$tmp_file";
then
rm -f "$tmp_file"
else
# gum log "Failed to transcode $ifile. Check ./error.log for details."
cat "$tmp_file" >> error.log
rm -f "$tmp_file"
fi
}
export -f transcode_job
mapfile -t files <<< "$selection"
len=${#files[@]}
i=1
for file in "${files[@]}"; do
if [[ -f "$file" ]]; then
gum spin --spinner dot --title "[$i/$len] Transcoding $file" -- bash -c "source <(declare -f transcode_job); transcode_job \"$file\" \"$output_dir\" \"$flatten\" \"$where\" \"$flags\" \"$container\""
else
echo "Skipping invalid file: $file" >&2
fi
((i++))
done

View File

@ -1,7 +1,7 @@
final: _: { final: _: {
hive = { hive = {
crossover = final.callPackage ./crossover.nix {}; crossover = final.callPackage ./crossover.nix {};
bulk-transcode = final.callPackage ./bulk-transcode {}; transcode-davinci-resolve = final.callPackage ./transcode-davinci-resolve {};
spotify-shortcuts = final.callPackage ./spotify-shortcuts {}; spotify-shortcuts = final.callPackage ./spotify-shortcuts {};
layan-qt6 = final.kdePackages.callPackage ./layan-qt6.nix {}; layan-qt6 = final.kdePackages.callPackage ./layan-qt6.nix {};
}; };

View File

@ -0,0 +1 @@
use flake ../../#transcode-davinci-resolve --show-trace

View File

@ -12,7 +12,7 @@
... ...
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
name = "bulk-transcode"; name = "transcode-davinci-resolve";
src = ./.; src = ./.;
buildInputs = [ buildInputs = [
@ -27,9 +27,9 @@ stdenv.mkDerivation (finalAttrs: {
]; ];
installPhase = '' installPhase = ''
install -Dm755 bulk-transcode.sh $out/bin/bulk-transcode install -Dm755 transcode-davinci-resolve.sh $out/bin/transcode-davinci-resolve
wrapProgram $out/bin/bulk-transcode \ wrapProgram $out/bin/transcode-davinci-resolve \
--set PATH "${lib.makeBinPath finalAttrs.buildInputs}" --set PATH "${lib.makeBinPath finalAttrs.buildInputs}"
''; '';
}) })

View File

@ -2,6 +2,6 @@
bin = pkgs.callPackage ./default.nix {}; bin = pkgs.callPackage ./default.nix {};
in in
pkgs.mkShell { pkgs.mkShell {
name = "bulk-transcode"; name = "transcode-davinci-resolve";
inputsFrom = [bin]; inputsFrom = [bin];
} }

View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
where="${1:-.}"
selection=$(find "$where" -type f | fzf --multi --preview 'ffprobe -v error -show_format -show_streams {}' --preview-window=up:wrap)
output_dir=$(find $HOME -type d ! -name '.*' ! -path '*/.*/*' | fzf --preview 'tree -C {}' --preview-window=up:wrap --prompt "Select output directory: ")
if gum confirm "Flatten the directory structure?";
then
flatten=true
else
flatten=false
fi
function transcode_job {
local ifile="$1"
local output_dir="$2"
local flatten="$3"
local where="$4"
local fname=$(basename "$ifile")
local segment=$(realpath --relative-to="$where" "$ifile")
if [ "$flatten" = true ]; then
output_file="$output_dir/$fname.mov"
else
output_file="$output_dir/$segment.mov"
fi
tmp_file=$(mktemp)
mkdir -p "$(dirname "$output_file")"
if ffmpeg -y -i "$ifile" -c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a pcm_s16le "$output_file" 2>> "$tmp_file";
then
rm -f "$tmp_file"
else
# gum log "Failed to transcode $ifile. Check ./error.log for details."
cat "$tmp_file" >> error.log
rm -f "$tmp_file"
fi
}
export -f transcode_job
mapfile -t files <<< "$selection"
len=${#files[@]}
i=1
for file in "${files[@]}"; do
if [[ -f "$file" ]]; then
gum spin --spinner dot --title "[$i/$len] Transcoding $file" -- bash -c "source <(declare -f transcode_job); transcode_job \"$file\" \"$output_dir\" \"$flatten\" \"$where\""
else
echo "Skipping invalid file: $file" >&2
fi
((i++))
done