From 02a0ee63eb5db8fca769df9c6b5951c1961dea27 Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Mon, 3 Apr 2023 22:48:06 +0200 Subject: [PATCH] Update video --- video-to-mp4.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/video-to-mp4.sh b/video-to-mp4.sh index e10ddce..ae7fcf2 100644 --- a/video-to-mp4.sh +++ b/video-to-mp4.sh @@ -1,9 +1,9 @@ #!/bin/bash -#sudo apt install inotify-tools ffmpeg -# @reboot /ruta/a/tu/script.sh >/dev/null 2>&1 & +# Requirements: sudo apt install inotify-tools ffmpeg +# Enable, cron: @reboot /path/script.sh >/dev/null 2>&1 & # Carpeta de destino -WATCH_FOLDER="/ruta/a/la/carpeta" +WATCH_FOLDER=$argv[1] # Extensiones a monitorear EXTENSIONS=("mkv" "mp4" "avi" "mov") @@ -18,9 +18,10 @@ while read filename; do if [[ " ${EXTENSIONS[@]} " =~ " ${extension} " ]]; then # Verifica si el nombre del archivo comienza con "optimized" if [[ "$filename" != optimized* ]]; then + notify-send "Archivo detectado: $filename. Iniciando conversión..." # Convierte el archivo a formato MP4 - ffmpeg -i "$WATCH_FOLDER/$filename" -codec:v libx264 -preset slow -crf 18 -codec:a copy "$WATCH_FOLDER/${filename%.*}.mp4" - echo "Archivo convertido: ${filename%.*}.mp4" + ffmpeg -i "$WATCH_FOLDER/$filename" -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest "$WATCH_FOLDER/optimized_${filename%.*}.mp4" + notify-send "Archivo convertido: optimized_${filename%.*}.mp4" else echo "Archivo ignorado: $filename" fi