2026-05-19-00-11-40 新增Ubuntu配音工作流
This commit is contained in:
21
Tools_scripts_XunFei-Ubuntu/check_audio_duration.sh
Executable file
21
Tools_scripts_XunFei-Ubuntu/check_audio_duration.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
TARGET="${1:-02_audio}"
|
||||
|
||||
if ! command -v ffprobe >/dev/null 2>&1; then
|
||||
echo "ffprobe is required. Install it with: sudo apt install -y ffmpeg" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -e "$TARGET" ]]; then
|
||||
echo "Path not found: $TARGET" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
find "$TARGET" -type f \( -iname '*.mp3' -o -iname '*.wav' -o -iname '*.m4a' \) -print0 |
|
||||
sort -z |
|
||||
while IFS= read -r -d '' file; do
|
||||
duration="$(ffprobe -v error -show_entries format=duration -of default=nw=1:nk=1 "$file")"
|
||||
printf '%8.3fs %s\n' "$duration" "$file"
|
||||
done
|
||||
Reference in New Issue
Block a user