Audio to video conversion works now, all bugs seems to be fixed.

This commit is contained in:
Storm Dragon
2026-01-29 21:56:29 -05:00
parent 57ba7c650a
commit 4605093568
4 changed files with 105 additions and 2 deletions
@@ -19,5 +19,6 @@ sound = "play -qV0 \"|sox -np synth .07 sq 400\" \"|sox -np synth .5 sq 800\" fa
# Escape always exits without action (built-in)
# Unbound keys are ignored - the mode waits for a valid key
a = "/usr/local/bin/select_audio_convert.sh"
r = "/usr/local/bin/record.sh"
w = "brave"
+2
View File
@@ -5,6 +5,7 @@ Dates are given for the image. All items listed are available for the listed ima
## January 1, 2026
- Updated latest released Toby Doom and added Bring Back the 90s
- Update fenrir to latest version and make settings file compatible
- Upgrade box64
- Upgrade rootfs (aarch64)
@@ -13,6 +14,7 @@ Dates are given for the image. All items listed are available for the listed ima
- Suppress CMake auto-regeneration to avoid Ninja "build.ninja still dirty" loops.
- added ability to easily convert your audio recordings to video (easily upload your videos to your site of choice)
- Switched to Cthulhu screen reader
- Latest release of xlibre
- System updates
+6 -2
View File
@@ -56,6 +56,10 @@ build_video() {
local audio_file="$1"
local image_dir="$2"
local container="$3"
local output_filename="$4"
local output_dir="$HOME/Videos"
mkdir -p "$output_dir"
ffmpeg -y \
-stream_loop -1 -framerate 1/35 -start_number 1 -i "$image_dir/stormux%d.png" \
@@ -64,7 +68,7 @@ build_video() {
-c:v libx264 -crf 18 -preset veryfast -r 30 -pix_fmt yuv420p \
-c:a copy \
-shortest \
"$4"
"$output_dir/${output_filename##*/}"
}
[ "$#" -eq 1 ] || usage
@@ -82,4 +86,4 @@ output="${name}.${container}"
build_video "$audio" "$image_dir" "$container" "$output"
echo "Wrote $output"
echo "Wrote $HOME/Videos/$output"
+96
View File
@@ -0,0 +1,96 @@
#!/bin/bash
# Script to select an audio file and convert it using convert-to-video.sh
# Accessibility notes: Uses yad with titles, text labels, and standard GTK keyboard navigation.
AUDIO_DIR="$HOME/Audio"
CONVERTER="/usr/local/bin/convert-to-video.sh"
# Check if Audio directory exists
if [[ ! -d "$AUDIO_DIR" ]]; then
echo "The directory $AUDIO_DIR does not exist." |
yad --text-info \
--title="Error" \
--show-cursor \
--button="OK:0" \
--center
exit 1
fi
# Find audio files (mp3, ogg, opus, wav, flac) case-insensitive
# -maxdepth 1: Only look in the top level of the directory
# -printf "%f\n": Print only the filename followed by a newline
FILES=$(find "$AUDIO_DIR" -maxdepth 1 -type f \( -iname "*.mp3" -o -iname "*.ogg" -o -iname "*.opus" -o -iname "*.wav" -o -iname "*.flac" \) -printf "%f\n" | sort)
# Check if any files were found
if [[ -z "$FILES" ]]; then
echo "No audio files available in $AUDIO_DIR." |
yad --text-info \
--title="No Audio Files" \
--show-cursor \
--button="OK:0" \
--center \
--width=300
exit 0
fi
# Display selection dialog
# --list: Create a list box
# --column="File": Single column with header
# --separator="": Return exact value without extra separators
# --search-column=1: Allows typing to jump to files (accessibility win)
SELECTED_FILE=$(echo "$FILES" | yad --list \
--title="Select Audio File" \
--text="Select an audio file to convert:" \
--column="File" \
--separator="" \
--width=600 \
--height=500 \
--center \
--search-column=1)
# Check exit status
# 0 = OK/Enter
# Any other value (1, 252) = Cancel or Close
RET=$?
# If user canceled or selection is empty, exit silently
if [[ $RET -ne 0 ]] || [[ -z "$SELECTED_FILE" ]]; then
exit 0
fi
# Construct full path
INPUT_FILE="$AUDIO_DIR/$SELECTED_FILE"
# Run the conversion
# We use a subshell to run the command and pipe output to yad
(
echo "# Converting: $SELECTED_FILE"
# Run the converter script
"$CONVERTER" "$INPUT_FILE"
# Send 100% to yad to close the progress bar (due to --auto-close)
echo "100"
) | yad --progress \
--title="Converting" \
--text="Starting conversion for $SELECTED_FILE... This can take a long time." \
--pulsate \
--auto-close \
--auto-kill \
--center \
--width=500 \
--button="Cancel:1"
# Check if the process completed successfully (yad returns 0 on auto-close/success)
PROGRESS_RET=$?
if [[ $PROGRESS_RET -eq 0 ]]; then
echo "Transcode complete." |
yad --text-info \
--title="Success" \
--show-cursor \
--button="OK:0" \
--center \
--width=300
fi
exit 0