47 lines
1.3 KiB
Bash
47 lines
1.3 KiB
Bash
#!/bin/bash
|
||
# Variables Section
|
||
#==============================================================
|
||
# list process to monitor in the variable below.
|
||
#PROGRAM1=$1
|
||
PROGRAM1=ffmpeg
|
||
# APPCHK varible checks to see if $PROGRAM1 is running.
|
||
APPCHK=$(ps -ea | grep $PROGRAM1 | grep -v grep | wc -l)
|
||
#==================================================================
|
||
# The ‘if’ statement below checks to see if the process is running
|
||
# with the ‘ps’ command. If the value is returned as a ‘0’ then
|
||
# a message is prompted
|
||
if [ $APPCHK -eq 0 ];
|
||
then
|
||
echo “$PROGRAM1 may be down”
|
||
|
||
cd "$1"
|
||
#rename 's/[[:blank:]]/_/g' *
|
||
for FILE in *;
|
||
do
|
||
#echo "$FILE"
|
||
|
||
#on récupère le nom sans extension
|
||
NAME=$(echo "$FILE" | sed 's/\.[^\.]*$//')
|
||
|
||
#nom des fichiers
|
||
INPUT_FILE="$1/$FILE"
|
||
#OUTPUT_FILE=$(echo "$2/$FILE")
|
||
OUTPUT_FILE=$(echo "$2/$NAME.mp4")
|
||
|
||
#if [ "$NAME" != "@eaDir" -a ! -f "$OUTPUT_FILE" ];
|
||
if [ "$NAME" != "@eaDir" ];
|
||
then
|
||
|
||
echo "$INPUT_FILE"
|
||
echo "$OUTPUT_FILE"
|
||
|
||
/volume1/homes/bruno/scripts/ffmpeg -i "$INPUT_FILE" -map 0:0 -map 0:1 -c:a aac -strict -2 -async 1 -c:v libx264 -crf 20 -r 25 -s 1920x1080 -aspect 16:9 -qmin 3 -qmax 51 -qdiff 4 -y "$OUTPUT_FILE"
|
||
mv "$INPUT_FILE" "$2/"
|
||
|
||
fi
|
||
|
||
done
|
||
else
|
||
echo “$PROGRAM1 is running”
|
||
fi
|
||
exit |