Vous n'êtes pas identifié(e).
L'icône rouge permet de télécharger chaque page du wiki visitée au format
PDF et la grise au format ODT →
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
utilisateurs:slyfox:scripts:accueil [31/07/2018 13:50] Slyfox [Sylmedia] |
utilisateurs:slyfox:scripts:accueil [07/09/2019 10:55] smolski [Slymedia] |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Slymedia ====== | ||
- | ====== Sylmedia ====== | + | * Objet : Script Slymedia |
- | + | ||
- | * Objet : | + | |
* Niveau requis : {{tag>débutant}} | * Niveau requis : {{tag>débutant}} | ||
* Commentaires : - | * Commentaires : - | ||
* Débutant, à savoir : [[:doc:systeme:commandes:le_debianiste_qui_papillonne|Utiliser GNU/Linux en ligne de commande, tout commence là !.]] :-) | * Débutant, à savoir : [[:doc:systeme:commandes:le_debianiste_qui_papillonne|Utiliser GNU/Linux en ligne de commande, tout commence là !.]] :-) | ||
- | * Suivi : {{tag>en chantier}} | + | * Création par [[user>Slyfox]] 14.08.2018 |
- | * Création par [[user>Slyfox]] 31/07/2018 | + | * Suivi : {{tag>À compléter}} |
- | * Commentaires sur le forum : | + | |
- | + | ||
- | <note warning>__**Script en cours d’écriture!**__</note> | + | |
- | + | ||
- | Installation des paquets: | + | |
- | <code root>apt-get update | + | |
- | apt-get install ffmpeg yad flac vorbis-tools eyed3 kid3-cli</code> | + | |
- | + | ||
- | Copier le script ci-dessous dans un fichier et le nommer **slymedia.sh** \\ | + | |
- | Déplacer le fichier **slymedia.sh** dans le dossier **/home** ou a convenance.\\ | + | |
- | Avant le premier lancement il faut que le fichier soit exécutable (adapter si nécessaire le chemin du fichier).\\ | + | |
- | <code user>chmod u+x /$HOME/slymedia.sh</code> | + | |
- | + | ||
- | Pour lancer le script:\\ | + | |
- | + | ||
- | * Ouvrir un terminal graphique (gnome terminal, terminal mate...) et taper le chemin du fichier **slymedia.sh** (adapter si nécessaire le chemin du fichier).\\ | + | |
- | + | ||
- | <code user>/$HOME/slymedia.sh</code> | + | |
- | ou\\ | + | ===== Introduction ===== |
+ | Slymedia est un script (amateur) qui permet de convertir les fichiers vidéo et audio. | ||
- | * Faire un double clic sur le fichier. | + | ===== Installation ===== |
+ | Paquets pour le fonctionne du script: | ||
+ | <code root>apt update | ||
+ | apt install aptitude | ||
+ | aptitude install ffmpeg yad flac vorbis-tools eyed3 kid3-cli | ||
+ | apt upgrade</code> | ||
+ | ===== Script ===== | ||
+ | <note important>En cours d'écriture, peut fonctionner que partiellement.</note> | ||
- | <note>Version du 31.07.2018</note> | + | <note tip>Version du: 17.08.2018</note> |
<code user>#! /bin/bash | <code user>#! /bin/bash | ||
# Paquets à installer: ffmpeg yad flac vorbis-tools eyed3 kid3-cli | # Paquets à installer: ffmpeg yad flac vorbis-tools eyed3 kid3-cli | ||
+ | # Version: 20180817 | ||
#=========================================================================================================== | #=========================================================================================================== | ||
Ligne 57: | Ligne 47: | ||
--field=" ":LBL " " \ | --field=" ":LBL " " \ | ||
--field="":LBL "" \ | --field="":LBL "" \ | ||
+ | --field="<b>Source</b>":LBL " " \ | ||
--field=" ":LBL " " \ | --field=" ":LBL " " \ | ||
--button="Quitter!gtk-quit!:1" \ | --button="Quitter!gtk-quit!:1" \ | ||
Ligne 63: | Ligne 54: | ||
--button="Source!gtk-file!:4" \ | --button="Source!gtk-file!:4" \ | ||
--button="Lancer conversion!gtk-convert!:0" \ | --button="Lancer conversion!gtk-convert!:0" \ | ||
- | "${cdeYadStream[@]}") | + | "${TabYadStream[@]}") |
# Status de sortie Yad | # Status de sortie Yad | ||
Ligne 99: | Ligne 90: | ||
--field=" ":LBL " " \ | --field=" ":LBL " " \ | ||
--field="<b>Options</b>":LBL " " \ | --field="<b>Options</b>":LBL " " \ | ||
- | --field="Supprimer toutes les métadonnées":CHK "${metadata}" \ | + | --field="Supprimer tous les tags et images cover":CHK "${metadata}" \ |
--field="Ne pas encoder si même codec que l'original":CHK "${nocopy}" \ | --field="Ne pas encoder si même codec que l'original":CHK "${nocopy}" \ | ||
--field="Dossier source":DIR "${dirIn}" \ | --field="Dossier source":DIR "${dirIn}" \ | ||
Ligne 117: | Ligne 108: | ||
nocopy=$(awk -F [\|] '{print $20}' <<< "${yadPreference}") | nocopy=$(awk -F [\|] '{print $20}' <<< "${yadPreference}") | ||
dirIn=$(awk -F [\|] '{print $21}' <<< "${yadPreference}") | dirIn=$(awk -F [\|] '{print $21}' <<< "${yadPreference}") | ||
- | |||
- | |||
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
Ligne 138: | Ligne 127: | ||
--column="" \ | --column="" \ | ||
--column="Type de source" \ | --column="Type de source" \ | ||
+ | "FALSE" "Fichier avec analyse" \ | ||
"TRUE" "Fichier" \ | "TRUE" "Fichier" \ | ||
"FALSE" "DVD" \ | "FALSE" "DVD" \ | ||
Ligne 169: | Ligne 159: | ||
# Status de sortie Yad | # Status de sortie Yad | ||
status="$?" | status="$?" | ||
+ | } | ||
+ | #=========================================================================================================== | ||
+ | function YADPROGRESS() | ||
+ | { | ||
+ | yad --progress \ | ||
+ | --title "SlyEditImage ${version}" \ | ||
+ | --geometry="550x300" \ | ||
+ | --borders="25" \ | ||
+ | --auto-close \ | ||
+ | --auto-kill \ | ||
+ | --button="gtk-media-stop:1" | ||
+ | |||
+ | yadStatus="$?" | ||
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
Ligne 359: | Ligne 362: | ||
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
- | function STREAM() | + | function STREAM_SIMPLE() |
{ | { | ||
+ | |||
[[ -f "${dossierTmp}/stream.txt" ]] && rm "${dossierTmp}/stream.txt" | [[ -f "${dossierTmp}/stream.txt" ]] && rm "${dossierTmp}/stream.txt" | ||
- | cdeYadStream=() | + | TabYadStream=() |
- | + | ||
IFS=$'\n' | IFS=$'\n' | ||
- | + | ||
+ | |||
+ | # Initialisation | ||
+ | nbr="0" | ||
+ | pourcent="0" | ||
+ | timeGo="$(date +%s)" | ||
+ | |||
+ | # Nombre de fichier | ||
+ | nbrFichier=$(awk '/./ {print}' <<< "${fileIn}" | wc -l) | ||
+ | |||
+ | # Calcul le pourcent par fichier | ||
+ | pourcentFichier=$(echo "scale=15; 100/${nbrFichier}" | bc) | ||
+ | |||
for i in ${fileIn}; do | for i in ${fileIn}; do | ||
+ | |||
+ | # Titre et durée | ||
+ | #streamFormat=$(ffprobe -i "${i}" -hide_banner -v quiet -show_entries format=bit_rate -of csv=s="|") | ||
+ | #rateTotal=$(ffmpeg -y -i "${i}" 2>&1 | awk '/Duration:/ {printf "%s\n" ,$(NF-1)}') | ||
- | #ffprobe -i "${i}" -hide_banner -v quiet -show_streams | + | # Mise en mémoire dans tableau TabYadStream |
+ | TabYadStream=(${TabYadStream[@]} --field="<b>TITRE:</b> $(basename "${i}")":LBL " ") | ||
+ | |||
+ | |||
+ | |||
+ | # Nom du fichier | ||
+ | fileNameExt=$(basename "${i}") | ||
+ | fileName="${fileNameExt%.*}" | ||
+ | |||
+ | # Envoi données vers YADPROGRESS | ||
+ | pourcent=$(echo "scale=15; (${pourcent}+${pourcentFichier})" | bc) | ||
+ | |||
+ | ((nbr+=1)) | ||
+ | |||
+ | # Calcul temps restant | ||
+ | timeT="$(date +%s)" | ||
+ | timeRemainingS=$(echo "scale=15; ((${timeT}-${timeGo})*${nbrFichier}/${nbr})-(${timeT}-${timeGo})" | bc | awk -F"." '{print $1}') | ||
+ | timeRemainingHMS=$(date +%T -d "0000-01-01 ${timeRemainingS} seconds") | ||
+ | |||
+ | # Envoi données à YADPROGRESS | ||
+ | echo "${pourcent}" | ||
+ | echo -e "\n#Chargement ${nbr} fichiers sur ${nbrFichier} - Temps restant environ: ${timeRemainingHMS}" | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | done | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | for i in "${TabYadStream[@]}"; do | ||
+ | echo "$i" >>"${dossierTmp}/yadStream.txt" | ||
+ | done | ||
+ | } | ||
+ | #=========================================================================================================== | ||
+ | function STREAM() | ||
+ | { | ||
+ | [[ -f "${dossierTmp}/stream.txt" ]] && rm "${dossierTmp}/stream.txt" | ||
+ | touch "${dossierTmp}/yadStream.txt" | ||
+ | TabYadStream=() | ||
+ | |||
+ | # Initialisation | ||
+ | nbr="0" | ||
+ | pourcent="0" | ||
+ | timeGo="$(date +%s)" | ||
+ | |||
+ | # Nombre de fichier | ||
+ | nbrFichier=$(awk '/./ {print}' <<< "${fileIn}" | wc -l) | ||
+ | |||
+ | # Calcul le pourcent par fichier | ||
+ | pourcentFichier=$(echo "scale=15; 100/${nbrFichier}" | bc) | ||
+ | |||
+ | IFS=$'\n' | ||
+ | |||
+ | for iFileIn in ${fileIn}; do | ||
STREAMTITLE | STREAMTITLE | ||
STREAMVIDEO | STREAMVIDEO | ||
STREAMAUDIO | STREAMAUDIO | ||
STREAMSUBTITLE | STREAMSUBTITLE | ||
- | cdeYadStream=(${cdeYadStream[@]} --field=" ":LBL " ") | + | |
+ | TabYadStream+=( --field=" ":LBL " ") | ||
+ | |||
+ | # Nom du fichier | ||
+ | fileNameExt=$(basename "${iFileIn}") | ||
+ | fileName="${fileNameExt%.*}" | ||
+ | |||
+ | # Envoi données vers YADPROGRESS | ||
+ | pourcent=$(echo "scale=15; (${pourcent}+${pourcentFichier})" | bc) | ||
+ | |||
+ | ((nbr+=1)) | ||
+ | |||
+ | # Calcul temps restant | ||
+ | timeT="$(date +%s)" | ||
+ | timeRemainingS=$(echo "scale=15; ((${timeT}-${timeGo})*${nbrFichier}/${nbr})-(${timeT}-${timeGo})" | bc | awk -F"." '{print $1}') | ||
+ | timeRemainingHMS=$(date +%T -d "0000-01-01 ${timeRemainingS} seconds") | ||
+ | |||
+ | # Envoi données à YADPROGRESS | ||
+ | echo "${pourcent}" | ||
+ | echo -e "\n#Analyse ${nbr} fichiers sur ${nbrFichier} - Temps restant environ: ${timeRemainingHMS}" | ||
+ | done | ||
+ | |||
+ | for i in "${TabYadStream[@]}"; do | ||
+ | echo "$i" >>"${dossierTmp}/yadStream.txt" | ||
done | done | ||
} | } | ||
Ligne 380: | Ligne 482: | ||
{ | { | ||
# Titre et durée | # Titre et durée | ||
- | streamFormat=$(ffprobe -i "${i}" -hide_banner -v quiet -show_entries format=duration,bit_rate -of csv=s="|") | + | streamFormat=$(ffprobe -i "${iFileIn}" -hide_banner -v quiet -show_entries format=duration,bit_rate -of csv=s="|") |
- | + | ||
durationS=$(awk -F [\|] '{print $2}' <<< "${streamFormat}") | durationS=$(awk -F [\|] '{print $2}' <<< "${streamFormat}") | ||
- | durationHMS=$(date -d@"${durationS}" -u +%H:%M:%S) | + | durationHMS=$(date +%T -d "0000-01-01 ${durationS} seconds") |
rateTotal=$(awk -F [\|] '{printf "%d kb/s" ,($3/1000)}' <<< "${streamFormat}") | rateTotal=$(awk -F [\|] '{printf "%d kb/s" ,($3/1000)}' <<< "${streamFormat}") | ||
- | # Mise en mémoire dans tableau cdeYadStream | + | # Mise en mémoire dans tableau TabYadStream |
- | cdeYadStream=(${cdeYadStream[@]} --field="<b>TITRE: $(basename "${i}") - ${durationHMS} - ${rateTotal}</b>":LBL " ") | + | TabYadStream+=( --field="<b>TITRE: $(basename "${iFileIn}") - ${durationHMS} - ${rateTotal}</b>":LBL " ") |
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
function STREAMVIDEO() | function STREAMVIDEO() | ||
{ | { | ||
- | streamVideo=$(ffprobe -i "${i}" -hide_banner -v quiet -select_streams v -show_entries stream=index,codec_name,width,height,r_frame_rate -of csv=s="|") | ||
- | |||
while read line; do | while read line; do | ||
Ligne 415: | Ligne 514: | ||
fi | fi | ||
- | # Mise en forme piste vidéo (envoi vers fichier tmp et envoi dans tableau cdeYadStream) | + | # Type d'image (Front, back, other) |
- | if [[ "${index}" != "" ]]; then | + | if [[ "${codec}" == "mjpeg" ]] || [[ "${codec}" == "png" ]]; then |
- | printf "|${i}|0:${index}|VIDEO|${codec}|${width}|${height}|${fps}|\n" >> "${dossierTmp}/stream.txt" | + | |
- | cdeYadStream=(${cdeYadStream[@]} --field="0:${index} | VIDEO | ${codec} ${width}x${height} ${fps}":CHK "TRUE") | + | |
- | fi | + | # Recherche map depuis numéro id |
+ | id=$(awk -F [\:] '{print $2}' <<< "0:${index}") | ||
+ | typeImage=$(ffprobe -i "${i}" -hide_banner -v quiet -select_streams ${id} -show_entries stream_tags=comment -of csv=s="|" | awk -F [\|] '{print $2}') | ||
- | done <<< "${streamVideo}" | ||
- | } | ||
- | #=========================================================================================================== | ||
- | function STREAMAUDIO() | ||
- | { | ||
- | streamAudio=$(ffprobe -i "${i}" -hide_banner -v quiet -select_streams a -show_entries stream=index,codec_name,sample_rate,channel_layout,bit_rate -show_entries stream_tags=language -of csv=s="|") | ||
- | while read line; do | + | # Mise en forme piste vidéo (envoi vers fichier tmp et envoi dans tableau TabYadStream) |
- | + | if [[ "${index}" != "" ]]; then | |
- | index=$(awk -F [\|] '{print $2}' <<< "${line}") | + | printf "|${iFileIn}|0:${index}|VIDEO|${typeImage}|${codec}|${width}|${height}\n" >> "${dossierTmp}/stream.txt" |
- | codec=$(awk -F [\|] '{print $3}' <<< "${line}") | + | TabYadStream+=( --field="0:${index} | VIDEO |${typeImage} ${codec} ${width}x${height}":CHK "TRUE") |
- | rate=$(awk -F [\|] '{print $4}' <<< "${line}") | + | |
- | channelOut=$(awk -F [\|] '{print $5}' <<< "${line}") | + | |
- | lang=$(awk -F [\|] '{print $NF}' <<< "${line}") | + | |
- | #debitAudio=$(awk -F [\|] '{print $6}' <<< "${line}") | + | |
- | + | ||
- | LANGUE | + | |
- | + | ||
- | # Calcul du débit audio | + | |
- | #if [[ "${debitAudio}" = +([0-9]) ]] ; then | + | |
- | # debitAudio=$(echo "${debitAudio} / 1000" | bc) | + | |
- | #else | + | |
- | # debitAudio="N/A" | + | |
- | #fi | + | |
- | + | ||
- | # Affectation TRUE ou FALSE | + | |
- | if [[ "${language}" == "${langAudio}" ]] || [[ "${language}" == "Inconnu" ]] || [[ "${langAudio}" == "Toutes les langues" ]]; then | + | |
- | bol="TRUE" | + | |
- | + | ||
- | else | + | |
- | bol="FALSE" | + | |
fi | fi | ||
- | # Mise en forme piste audio (envoi vers fichier tmp et envoi dans tableau cdeYadStream) | + | else |
- | if [[ "${index}" != "" ]]; then | + | |
- | printf "|${i}|0:${index}|AUDIO|${codec}|${language}|${languageISO}|${rate}|${channelOut}|\n" >> "${dossierTmp}/stream.txt" | + | |
- | cdeYadStream=(${cdeYadStream[@]} --field="0:${index}| AUDIO | ${language} ${codec} ${rate} Hz ${channelOut}":CHK "${bol}") | + | |
+ | # Mise en forme piste vidéo (envoi vers fichier tmp et envoi dans tableau TabYadStream) | ||
+ | if [[ "${index}" != "" ]]; then | ||
+ | printf "|${iFileIn}|0:${index}|VIDEO|${codec}|${width}|${height}|${fps}\n" >> "${dossierTmp}/stream.txt" | ||
+ | TabYadStream+=( --field="0:${index} | VIDEO |${codec} ${width}x${height} ${fps} fps":CHK "TRUE") | ||
fi | fi | ||
+ | fi | ||
- | done <<< "${streamAudio}" | + | done <<< $(ffprobe -i "${iFileIn}" -hide_banner -v quiet -select_streams v -show_entries stream=index,codec_name,width,height,r_frame_rate -of csv=s="|") |
+ | } | ||
+ | #=========================================================================================================== | ||
+ | function STREAMAUDIO() | ||
+ | { | ||
+ | while read line; do | ||
+ | |||
+ | index=$(awk -F [\|] '{print $2}' <<< "${line}") | ||
+ | codec=$(awk -F [\|] '{print $3}' <<< "${line}") | ||
+ | rate=$(awk -F [\|] '{print $4}' <<< "${line}") | ||
+ | channelOut=$(awk -F [\|] '{print $5}' <<< "${line}") | ||
+ | lang=$(awk -F [\|] '{print $NF}' <<< "${line}") | ||
+ | |||
+ | LANGUE | ||
+ | |||
+ | # Affectation TRUE ou FALSE | ||
+ | if [[ "${language}" == "${langAudio}" ]] || [[ "${language}" == "Inconnu" ]] || [[ "${langAudio}" == "Toutes les langues" ]]; then | ||
+ | bol="TRUE" | ||
+ | |||
+ | else | ||
+ | bol="FALSE" | ||
+ | fi | ||
+ | |||
+ | # Mise en forme piste audio (envoi vers fichier tmp et envoi dans tableau TabYadStream) | ||
+ | if [[ "${index}" != "" ]]; then | ||
+ | printf "|${iFileIn}|0:${index}|AUDIO|${codec}|${language}|${languageISO}|${rate}|${channelOut}|\n" >> "${dossierTmp}/stream.txt" | ||
+ | TabYadStream+=( --field="0:${index}| AUDIO | ${language} ${codec} ${rate} Hz ${channelOut}":CHK "${bol}") | ||
+ | fi | ||
+ | |||
+ | done <<< $(ffprobe -i "${iFileIn}" -hide_banner -v quiet -select_streams a -show_entries stream=index,codec_name,sample_rate,channel_layout,bit_rate -show_entries stream_tags=language -of csv=s="|") | ||
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
function STREAMSUBTITLE() | function STREAMSUBTITLE() | ||
{ | { | ||
- | streamSub=$(ffprobe -i "${i}" -hide_banner -v quiet -select_streams s -show_entries stream=index,codec_name -show_entries stream_tags=language -of csv=s="|") | ||
- | |||
while read line; do | while read line; do | ||
Ligne 485: | Ligne 587: | ||
fi | fi | ||
- | # Mise en forme piste audio (envoi vers fichier tmp et envoi dans tableau cdeYadStream) | + | # Mise en forme piste audio (envoi vers fichier tmp et envoi dans tableau TabYadStream) |
if [[ "${index}" != "" ]]; then | if [[ "${index}" != "" ]]; then | ||
- | printf "|${i}|0:${index}|SUBTITLE|${codec}|${language}|${languageISO}|\n" >> "${dossierTmp}/stream.txt" | + | printf "|${iFileIn}|0:${index}|SUBTITLE|${codec}|${language}|${languageISO}|\n" >> "${dossierTmp}/stream.txt" |
- | cdeYadStream=(${cdeYadStream[@]} --field="0:${index} | SUBTITLE | ${language} ${codec}":CHK "${bol}") | + | TabYadStream+=( --field="0:${index} | SUBTITLE | ${language} ${codec}":CHK "${bol}") |
- | + | ||
fi | fi | ||
- | done <<< "${streamSub}" | + | done <<< $(ffprobe -i "${iFileIn}" -hide_banner -v quiet -select_streams s -show_entries stream=index,codec_name -show_entries stream_tags=language -of csv=s="|") |
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
Ligne 560: | Ligne 661: | ||
cdeQualityVideo=(${qVideo5[@]}) | cdeQualityVideo=(${qVideo5[@]}) | ||
- | fi | ||
- | } | ||
- | #=========================================================================================================== | ||
- | function QUALITY_AUDIO() | ||
- | { | ||
- | # Recherche debit total maximum du fichier source | ||
- | rateTotal=$(ffprobe -i "${i}" -hide_banner -v quiet -show_entries format=bit_rate -of csv=s="|" | awk -F [\|] '{printf "%d" ,($2/1000)}') | ||
- | |||
- | # Commande selon la qualité | ||
- | if [[ "${cAudio}" = "copy" ]] || [[ "${cAudio}" == "flac" ]]; then | ||
- | cdeQualityAudio=() | ||
- | |||
- | elif [[ "${typeRate}" == "CBR" ]]; then | ||
- | |||
- | if [[ "${quality}" == "Excellente" ]] && [[ "${rateTotal}" -ge "320" ]]; then | ||
- | cdeQualityAudio=(${qAudio1[@]}) | ||
- | |||
- | elif [[ "${quality}" == "Elevée" ]] && [[ "${rateTotal}" -ge "256" ]]; then | ||
- | cdeQualityAudio=(${qAudio2[@]}) | ||
- | |||
- | elif [[ "${quality}" == "Moyenne" ]] && [[ "${rateTotal}" -ge "192" ]]; then | ||
- | cdeQualityAudio=(${qAudio3[@]}) | ||
- | |||
- | elif [[ "${quality}" == "Minimum" ]] && [[ "${rateTotal}" -ge "128" ]]; then | ||
- | cdeQualityAudio=(${qAudio4[@]}) | ||
- | |||
- | elif [[ "${quality}" == "Faible" ]] && [[ "${rateTotal}" -ge "64" ]]; then | ||
- | cdeQualityAudio=(${qAudio5[@]}) | ||
- | |||
- | else | ||
- | |||
- | if [[ "${codecAudioIn}" == "${codecAudioOut}" ]]; then | ||
- | cAudio="copy" | ||
- | cdeQualityAudio=() | ||
- | |||
- | else | ||
- | cdeQualityAudio=(-b:a "${rateTotal}k") | ||
- | |||
- | fi | ||
- | |||
- | fi | ||
- | |||
- | elif [[ "${typeRate}" == "VBR" ]]; then | ||
- | |||
- | if [[ "${quality}" == "Excellente" ]]; then | ||
- | cdeQualityAudio=(${qAudio1[@]}) | ||
- | |||
- | elif [[ "${quality}" == "Elevée" ]]; then | ||
- | cdeQualityAudio=(${qAudio2[@]}) | ||
- | |||
- | elif [[ "${quality}" == "Moyenne" ]]; then | ||
- | cdeQualityAudio=(${qAudio3[@]}) | ||
- | |||
- | elif [[ "${quality}" == "Minimum" ]]; then | ||
- | cdeQualityAudio=(${qAudio4[@]}) | ||
- | |||
- | elif [[ "${quality}" == "Faible" ]]; then | ||
- | cdeQualityAudio=(${qAudio5[@]}) | ||
- | |||
- | fi | ||
fi | fi | ||
} | } | ||
Ligne 629: | Ligne 670: | ||
else | else | ||
cVideo="libx265" | cVideo="libx265" | ||
+ | |||
+ | qVideo1=(-crf 18 -preset slow) | ||
+ | qVideo2=(-crf 24 -preset slow) | ||
+ | qVideo3=(-crf 30 -preset medium) | ||
+ | qVideo4=(-crf 36 -preset veryfast) | ||
+ | qVideo5=(-crf 42 -preset ultrafast) | ||
fi | fi | ||
- | qVideo1=(-crf 18 -preset slow) | + | |
- | qVideo2=(-crf 24 -preset slow) | + | |
- | qVideo3=(-crf 30 -preset medium) | + | |
- | qVideo4=(-crf 36 -preset veryfast) | + | |
- | qVideo5=(-crf 42 -preset ultrafast) | + | |
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
Ligne 644: | Ligne 687: | ||
else | else | ||
cVideo="libx264" | cVideo="libx264" | ||
- | fi | ||
- | qVideo1=(-crf 18 -preset slow) | + | qVideo1=(-crf 18 -preset slow) |
- | qVideo2=(-crf 24 -preset slow) | + | qVideo2=(-crf 24 -preset slow) |
- | qVideo3=(-crf 30 -preset medium) | + | qVideo3=(-crf 30 -preset medium) |
- | qVideo4=(-crf 36 -preset veryfast) | + | qVideo4=(-crf 36 -preset veryfast) |
- | qVideo5=(-crf 42 -preset ultrafast) | + | qVideo5=(-crf 42 -preset ultrafast) |
+ | |||
+ | fi | ||
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
Ligne 672: | Ligne 716: | ||
cAudio="libvorbis" | cAudio="libvorbis" | ||
- | fi | + | if [[ "${typeRate}" == "VBR" ]]; then |
+ | qAudio1=(-qscale:a 10) | ||
+ | qAudio2=(-qscale:a 8) | ||
+ | qAudio3=(-qscale:a 5) | ||
+ | qAudio4=(-qscale:a 4) | ||
+ | qAudio5=(-qscale:a 0) | ||
- | if [[ "${typeRate}" == "VBR" ]]; then | + | elif [[ "${typeRate}" == "CBR" ]]; then |
- | qAudio1=(-qscale:a 10) | + | qAudio1=(-b:a 320k) |
- | qAudio2=(-qscale:a 8) | + | qAudio2=(-b:a 256k) |
- | qAudio3=(-qscale:a 5) | + | qAudio3=(-b:a 160k) |
- | qAudio4=(-qscale:a 4) | + | qAudio4=(-b:a 128k) |
- | qAudio5=(-qscale:a 0) | + | qAudio5=(-b:a 64k) |
+ | fi | ||
- | elif [[ "${typeRate}" == "CBR" ]]; then | + | fi |
- | qAudio1=(-b:a 320k) | + | |
- | qAudio2=(-b:a 256k) | + | |
- | qAudio3=(-b:a 192k) | + | |
- | qAudio4=(-b:a 128k) | + | |
- | qAudio5=(-b:a 64k) | + | |
- | fi | + | |
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
Ligne 699: | Ligne 743: | ||
cAudio="aac" | cAudio="aac" | ||
- | fi | + | if [[ "${typeRate}" == "VBR" ]]; then |
+ | qAudio1=(-q:a 2) | ||
+ | qAudio2=(-q:a 1.5) | ||
+ | qAudio3=(-q:a 1) | ||
+ | qAudio4=(-q:a 0.7) | ||
+ | qAudio5=(-q:a 0.2) | ||
- | if [[ "${typeRate}" == "VBR" ]]; then | + | elif [[ "${typeRate}" == "CBR" ]]; then |
- | qAudio1=(-q:a 0) | + | qAudio1=(-b:a 320k) |
- | qAudio2=(-q:a 2) | + | qAudio2=(-b:a 256k) |
- | qAudio3=(-q:a 5) | + | qAudio3=(-b:a 160k) |
- | qAudio4=(-q:a 7) | + | qAudio4=(-b:a 128k) |
- | qAudio5=(-q:a 9) | + | qAudio5=(-b:a 64k) |
+ | fi | ||
- | elif [[ "${typeRate}" == "CBR" ]]; then | ||
- | qAudio1=(-b:a 320k) | ||
- | qAudio2=(-b:a 256k) | ||
- | qAudio3=(-b:a 192k) | ||
- | qAudio4=(-b:a 128k) | ||
- | qAudio5=(-b:a 64k) | ||
fi | fi | ||
} | } | ||
Ligne 726: | Ligne 770: | ||
cAudio="libmp3lame" | cAudio="libmp3lame" | ||
+ | if [[ "${typeRate}" == "VBR" ]]; then | ||
+ | qAudio1=(-q:a 0) | ||
+ | qAudio2=(-q:a 1) | ||
+ | qAudio3=(-q:a 4) | ||
+ | qAudio4=(-q:a 7) | ||
+ | qAudio5=(-q:a 9) | ||
+ | |||
+ | elif [[ "${typeRate}" == "CBR" ]]; then | ||
+ | qAudio1=(-b:a 320k) | ||
+ | qAudio2=(-b:a 256k) | ||
+ | qAudio3=(-b:a 160k) | ||
+ | qAudio4=(-b:a 128k) | ||
+ | qAudio5=(-b:a 64k) | ||
+ | fi | ||
fi | fi | ||
+ | } | ||
+ | function FFMPEG_SIMPLE | ||
+ | { | ||
+ | |||
+ | |||
+ | |||
+ | IFS=$'\n' | ||
- | if [[ "${typeRate}" == "VBR" ]]; then | + | for iFileIn in ${fileIn}; do |
- | qAudio1=(-q:a 0) | + | |
- | qAudio2=(-q:a 2) | + | # Initialisation commandes |
- | qAudio3=(-q:a 5) | + | cdeVideo=() |
- | qAudio4=(-q:a 7) | + | cdeAudio=() |
- | qAudio5=(-q:a 9) | + | cdeSub=() |
- | elif [[ "${typeRate}" == "CBR" ]]; then | + | # Nom fichier source |
- | qAudio1=(-b:a 320k) | + | fileNameExtension=$(basename "${iFileIn}") |
- | qAudio2=(-b:a 256k) | + | fileName="${fileNameExtension%.*}" |
- | qAudio3=(-b:a 192k) | + | extension="${fileNameExtension##*.}" |
- | qAudio4=(-b:a 128k) | + | |
- | qAudio5=(-b:a 64k) | + | |
- | fi | + | |
+ | STREAMAUDIO | ||
+ | |||
+ | |||
+ | cat "${dossierTmp}/stream.txt" | ||
+ | |||
+ | |||
+ | exit | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | done | ||
} | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
#=========================================================================================================== | #=========================================================================================================== | ||
function FFMPEG() | function FFMPEG() | ||
{ | { | ||
IFS=$'\n' | IFS=$'\n' | ||
- | |||
for iFileIn in ${fileIn}; do | for iFileIn in ${fileIn}; do | ||
- | + | ||
# Initialisation commandes | # Initialisation commandes | ||
cdeVideo=() | cdeVideo=() | ||
cdeAudio=() | cdeAudio=() | ||
cdeSub=() | cdeSub=() | ||
- | + | ||
- | # Nom fichier | + | # Nom fichier source |
- | fileNameExt=$(basename "${iFileIn}") | + | fileNameExtension=$(basename "${iFileIn}") |
- | fileName="${fileNameExt%.*}" | + | fileName="${fileNameExtension%.*}" |
- | + | extension="${fileNameExtension##*.}" | |
# Recherche map | # Recherche map | ||
- | mapVideo=$(awk -F [\|] '{if ($4 ~ /VIDEO/ && /'${fileName}'/) {printf "%s\n" ,$3}}' <<< "${stream}") | + | mapVideo=$(awk -v iFileIn="${iFileIn}" -v iMapAudio="${iMapAudio}" -F [\|] '{if ($4 == "VIDEO" && $2 == iFileIn) {printf "%s" ,$3}}' <<< "${stream}") |
- | mapAudio=$(awk -F [\|] '{if ($4 ~ /AUDIO/ && /'${fileName}'/) {printf "%s\n" ,$3}}' <<< "${stream}") | + | mapAudio=$(awk -v iFileIn="${iFileIn}" -v iMapAudio="${iMapAudio}" -F [\|] '{if ($4 == "AUDIO" && $2 == iFileIn) {printf "%s" ,$3}}' <<< "${stream}") |
- | mapSub=$(awk -F [\|] '{if ($4 ~ /SUBTITLE/ && /'${fileName}'/) {printf "%s\n" ,$3}}' <<< "${stream}") | + | mapSub=$(awk -v iFileIn="${iFileIn}" -v iMapAudio="${iMapAudio}" -F [\|] '{if ($4 == "SUBTITLE" && $2 == iFileIn) {printf "%s" ,$3}}' <<< "${stream}") |
- | + | ||
echo "==============================================" | echo "==============================================" | ||
echo " iFileIn: ${iFileIn}" | echo " iFileIn: ${iFileIn}" | ||
Ligne 770: | Ligne 863: | ||
echo " mapAudio: ${mapAudio}" | echo " mapAudio: ${mapAudio}" | ||
echo " mapSub: ${mapSub}" | echo " mapSub: ${mapSub}" | ||
- | + | ||
# Metadonnée | # Metadonnée | ||
if [[ "${metadata}" == "TRUE" ]]; then | if [[ "${metadata}" == "TRUE" ]]; then | ||
Ligne 777: | Ligne 870: | ||
cdeMetadata=() | cdeMetadata=() | ||
fi | fi | ||
- | + | ||
FFMPEG_VIDEO | FFMPEG_VIDEO | ||
FFMPEG_AUDIO | FFMPEG_AUDIO | ||
- | + | FFMPEG_OUT | |
# Conversion fichier | # Conversion fichier | ||
- | ffmpeg -y -i "${iFileIn}" -loglevel debug "${cdeMetadata[@]}" "${cdeVideo[@]}" "${cdeAudio[@]}" "${dirOut}/${fileName}.${conteneur}" | + | ffmpeg -y -i "${iFileIn}" -loglevel debug "${cdeMetadata[@]}" "${cdeVideo[@]}" "${cdeAudio[@]}" -t 10 "${dirOut}/${fileName}.${conteneur}" |
- | + | ||
ffmpeg -i "${dirOut}/${fileName}.${conteneur}" ## TEST ## | ffmpeg -i "${dirOut}/${fileName}.${conteneur}" ## TEST ## | ||
- | echo "ffmpeg -y -i "${iFileIn}" "${cdeMetadata[@]}" "${cdeVideo[@]}" "${cdeAudio[@]}" "${dirOut}/${fileName}.${conteneur}"" ## TEST ## | + | |
- | + | echo "==============================================" | |
- | # Cover fichier | + | echo "ffmpeg -y -i ${iFileIn} ${cdeMetadata[@]} ${cdeVideo[@]} ${cdeAudio[@]} -t 10 ${dirOut}/${fileName}.${conteneur} |
- | numImage="1" | + | rateTotal: ${rateTotal}" ## TEST ## |
- | + | echo "==============================================" | |
+ | |||
+ | # Image cover fichier audio | ||
for iMapVideo in ${mapVideo}; do | for iMapVideo in ${mapVideo}; do | ||
- | + | ||
- | # Recherche codec vidéo map vidéo | + | numImage="1" |
+ | |||
+ | # Recherche codec vidéo (image) | ||
codecVideoIn=$(awk -F [\|] '{if ($4 ~ /VIDEO/ && /'${iMapVideo}'/ && /'${fileName}'/) {printf "%s" ,$5}}' <<< "${stream}") | codecVideoIn=$(awk -F [\|] '{if ($4 ~ /VIDEO/ && /'${iMapVideo}'/ && /'${fileName}'/) {printf "%s" ,$5}}' <<< "${stream}") | ||
- | + | ||
if [[ "${codecVideoIn}" == "mjpeg" ]] || [[ "${codecVideoIn}" == "png" ]]; then | if [[ "${codecVideoIn}" == "mjpeg" ]] || [[ "${codecVideoIn}" == "png" ]]; then | ||
+ | |||
COVER | COVER | ||
- | |||
fi | fi | ||
- | + | ||
done | done | ||
- | + | ||
done | done | ||
+ | |||
} | } | ||
- | |||
#=========================================================================================================== | #=========================================================================================================== | ||
function FFMPEG_VIDEO() | function FFMPEG_VIDEO() | ||
Ligne 812: | Ligne 909: | ||
for iMapVideo in ${mapVideo}; do | for iMapVideo in ${mapVideo}; do | ||
- | codecVideoIn=$(awk -F [\|] '{if ($4 ~ /VIDEO/ && /'${iMapVideo}'/ && /'${fileName}'/) {printf "%s" ,$5}}' <<< "${stream}") | + | codecVideoIn=$(awk -v iFileIn="${iFileIn}" -v iMapVideo="${iMapVideo}" -F [\|] '{if ($4 == "VIDEO" && $2 == iFileIn && $3 == iMapVideo){printf "%s" ,$5}}' <<< "${stream}") |
PROFIL | PROFIL | ||
Ligne 829: | Ligne 926: | ||
done | done | ||
} | } | ||
+ | |||
#=========================================================================================================== | #=========================================================================================================== | ||
function FFMPEG_AUDIO() | function FFMPEG_AUDIO() | ||
{ | { | ||
numAudio="0" | numAudio="0" | ||
+ | |||
+ | |||
for iMapAudio in ${mapAudio}; do | for iMapAudio in ${mapAudio}; do | ||
- | codecAudioIn=$(awk -F [\|] '{if ($4 ~ /AUDIO/ && /'${iMapAudio}'/ && /'${fileName}'/) {printf "%s" ,$5}}' <<< "${stream}") | + | codecAudioIn=$(awk -v iFileIn="${iFileIn}" -v iMapAudio="${iMapAudio}" -F [\|] '{ |
- | languageISO=$(awk -F [\|] '{if ($4 ~ /AUDIO/ && $3 ~ /'${iMapAudio}'/ && /'${fileName}'/) {printf "%s" ,$7}}' <<< "${stream}") | + | |
- | + | if ($4 == "AUDIO" && $2 == iFileIn && $3 == iMapAudio) | |
+ | {printf "%s - %s" ,$5,iFileIn} | ||
+ | |||
+ | }' <<< "${stream}") | ||
+ | |||
+ | languageISO=$(awk -v iFileIn="${iFileIn}" -v iMapAudio="${iMapAudio}" -F [\|] '{ | ||
+ | |||
+ | if ($4 == "AUDIO" && $2 == iFileIn && $3 == iMapAudio) | ||
+ | {printf "%s" ,$7} | ||
+ | |||
+ | }' <<< "${stream}") | ||
+ | |||
PROFIL | PROFIL | ||
QUALITY_AUDIO | QUALITY_AUDIO | ||
- | + | ||
cdeAudio=(${cdeAudio[@]} -map ${iMapAudio} -metadata:s:a:${numAudio} language="${languageISO}" -c:a ${cAudio} ${cdeQualityAudio[@]} ${channel[@]} -cutoff 20000) | cdeAudio=(${cdeAudio[@]} -map ${iMapAudio} -metadata:s:a:${numAudio} language="${languageISO}" -c:a ${cAudio} ${cdeQualityAudio[@]} ${channel[@]} -cutoff 20000) | ||
((numAudio+=1)) | ((numAudio+=1)) | ||
+ | done | ||
+ | } | ||
+ | #=========================================================================================================== | ||
+ | function QUALITY_AUDIO() | ||
+ | { | ||
+ | # Recherche debit total maximum du fichier source | ||
+ | rateTotal=$(ffprobe -i "${iFileIn}" -hide_banner -v quiet -show_entries format=bit_rate -of csv=s="|" | awk -F [\|] '{printf "%d\n" ,($2/1000)}') | ||
+ | |||
+ | # Commande selon la qualité | ||
+ | if [[ "${cAudio}" = "copy" ]] || [[ "${cAudio}" == "flac" ]]; then | ||
+ | cdeQualityAudio=() | ||
+ | |||
+ | elif [[ "${quality}" == "Excellente" ]]; then | ||
+ | |||
+ | if [[ "${rateTotal}" -gt "320" ]]; then | ||
+ | cdeQualityAudio=(${qAudio1[@]}) | ||
+ | |||
+ | elif [[ "${codecAudioIn}" == "${codecAudioOut}" ]]; then | ||
+ | cAudio="copy" | ||
+ | cdeQualityAudio=() | ||
+ | else | ||
+ | cdeQualityAudio=(-b:a "${rateTotal}k") | ||
+ | fi | ||
+ | |||
+ | elif [[ "${quality}" == "Elevée" ]]; then | ||
+ | |||
+ | if [[ "${rateTotal}" -gt "256" ]]; then | ||
+ | cdeQualityAudio=(${qAudio2[@]}) | ||
+ | |||
+ | elif [[ "${codecAudioIn}" == "${codecAudioOut}" ]]; then | ||
+ | cAudio="copy" | ||
+ | cdeQualityAudio=() | ||
+ | else | ||
+ | cdeQualityAudio=(-b:a "${rateTotal}k") | ||
+ | fi | ||
+ | |||
+ | elif [[ "${quality}" == "Moyenne" ]]; then | ||
+ | if [[ "${rateTotal}" -gt "192" ]]; then | ||
+ | cdeQualityAudio=(${qAudio3[@]}) | ||
+ | |||
+ | elif [[ "${codecAudioIn}" == "${codecAudioOut}" ]]; then | ||
+ | cAudio="copy" | ||
+ | cdeQualityAudio=() | ||
+ | else | ||
+ | cdeQualityAudio=(-b:a "${rateTotal}k") | ||
+ | fi | ||
+ | |||
+ | elif [[ "${quality}" == "Minimum" ]]; then | ||
+ | if [[ "${rateTotal}" -gt "128" ]]; then | ||
+ | cdeQualityAudio=(${qAudio4[@]}) | ||
+ | |||
+ | elif [[ "${codecAudioIn}" == "${codecAudioOut}" ]]; then | ||
+ | cAudio="copy" | ||
+ | cdeQualityAudio=() | ||
+ | else | ||
+ | cdeQualityAudio=(-b:a "${rateTotal}k") | ||
+ | fi | ||
+ | |||
+ | elif [[ "${quality}" == "Faible" ]]; then | ||
+ | if [[ "${rateTotal}" -gt "64" ]]; then | ||
+ | cdeQualityAudio=(${qAudio5[@]}) | ||
+ | |||
+ | elif [[ "${codecAudioIn}" == "${codecAudioOut}" ]]; then | ||
+ | cAudio="copy" | ||
+ | cdeQualityAudio=() | ||
+ | |||
+ | else | ||
+ | cdeQualityAudio=(-b:a "${rateTotal}k") | ||
+ | fi | ||
+ | fi | ||
+ | |||
+ | echo "typeRate: ${typeRate}" ## TEST | ||
+ | echo "rateTotal: ${rateTotal}" ## TEST | ||
+ | echo "quality: ${quality}" ## TEST | ||
+ | echo "cdeQualityAudio: ${cdeQualityAudio[@]}" ## TEST | ||
+ | } | ||
+ | #=========================================================================================================== | ||
+ | function FFMPEG_OUT() | ||
+ | { | ||
+ | # Si fichier exsite déjà ajoute "copie" et numéro de la copie | ||
+ | nbrCopie="1" | ||
+ | |||
+ | while [[ -f "${dirOut}/${fileName}.${conteneur}" ]]; do | ||
+ | fileName=$(awk '{gsub(/ - copie.*/, ""); printf "%s - copie '$nbrCopie'" ,$0}' <<< "${fileName}") | ||
+ | ((nbrCopie+=1)) | ||
done | done | ||
} | } | ||
Ligne 863: | Ligne 1059: | ||
if [[ "${nameImage}" == "" ]]; then | if [[ "${nameImage}" == "" ]]; then | ||
- | nameImage="cover_${typeImage}" | + | #nameImage="cover_${typeImage}" |
+ | |||
+ | |||
+ | if [[ "${typeImage}" == "Cover (front)" ]]; then | ||
+ | nameImage="Cover front" | ||
+ | |||
+ | elif [[ "${typeImage}" == "Cover (back)" ]]; then | ||
+ | nameImage="Cover back" | ||
+ | |||
+ | else [[ "${typeImage}" == "Other" ]] | ||
+ | nameImage="Other" | ||
+ | |||
+ | fi | ||
elif [[ "${nameImage}" == "${nameImageSave}" ]]; then | elif [[ "${nameImage}" == "${nameImageSave}" ]]; then | ||
Ligne 911: | Ligne 1119: | ||
- | elif [[ "${typeImage}" == "Other" ]]; then | + | else [[ "${typeImage}" == "Other" ]] |
typeImage="0" | typeImage="0" | ||
- | |||
- | else | ||
- | typeImage="3" | ||
- | |||
fi | fi | ||
# Ajout de l'image au fichier audio | # Ajout de l'image au fichier audio | ||
metaflac --import-picture-from="${typeImage}||${nameImage}||${dossierTmp}/${nameImage}.${codecVideoIn}" "${dirOut}/${fileName}.${conteneur}" | metaflac --import-picture-from="${typeImage}||${nameImage}||${dossierTmp}/${nameImage}.${codecVideoIn}" "${dirOut}/${fileName}.${conteneur}" | ||
- | |||
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
Ligne 983: | Ligne 1186: | ||
function COVER_MP3() | function COVER_MP3() | ||
{ | { | ||
- | |||
- | |||
if [[ "${typeImage}" == "Cover (front)" ]]; then | if [[ "${typeImage}" == "Cover (front)" ]]; then | ||
typeImage="FRONT_COVER" | typeImage="FRONT_COVER" | ||
Ligne 996: | Ligne 1197: | ||
elif [[ "${typeImage}" == "Other" ]]; then | elif [[ "${typeImage}" == "Other" ]]; then | ||
typeImage="OTHER" | typeImage="OTHER" | ||
- | |||
else | else | ||
Ligne 1009: | Ligne 1209: | ||
function COVER_OTHER() | function COVER_OTHER() | ||
{ | { | ||
- | # renommage image cover en "cover" | + | if [[ "${typeImage}" == "Cover \(back\)" ]]; then |
- | mv "${dossierTmp}/${nameImage}.${codecVideoIn}" "${dossierTmp}/cover.${codecVideoIn}" | + | |
- | # Ajout de l'image au fichier audio | + | # renommage image cover en "cover" |
- | kid3-cli -c "set picture:"${dossierTmp}/cover.${codecVideoIn}" ''" "${dirOut}/${fileName}.${conteneur}" | + | mv "${dossierTmp}/${nameImage}.${codecVideoIn}" "${dossierTmp}/cover.${codecVideoIn}" |
+ | |||
+ | # Ajout de l'image au fichier audio | ||
+ | kid3-cli -c "set picture:"${dossierTmp}/cover.${codecVideoIn}" ''" "${dirOut}/${fileName}.${conteneur}" | ||
+ | |||
+ | fi | ||
} | } | ||
Ligne 1057: | Ligne 1261: | ||
elif [[ "${status}" -eq "0" ]]; then | elif [[ "${status}" -eq "0" ]]; then | ||
SAVE | SAVE | ||
- | #STREAM | ||
MAIN | MAIN | ||
- | |||
fi | fi | ||
Ligne 1065: | Ligne 1267: | ||
elif [[ "${status}" -eq "4" ]]; then | elif [[ "${status}" -eq "4" ]]; then | ||
SAVE | SAVE | ||
- | YADFILE | + | YADSOURCE |
- | + | ||
- | # YADFILE Bouton "Quitter" ou "Croix fenêtre" | + | # YADSOURCE Bouton "Quitter" ou "Croix fenêtre" |
if [[ "${status}" -eq "1" ]] || [[ "${status}" -eq "252" ]]; then | if [[ "${status}" -eq "1" ]] || [[ "${status}" -eq "252" ]]; then | ||
rm -rf "${dossierTmp}" | rm -rf "${dossierTmp}" | ||
exit | exit | ||
- | + | ||
- | # YADFILE Bouton "Annuler" | + | # YADSOURCE Bouton "Annuler" |
elif [[ "${status}" -eq "2" ]]; then | elif [[ "${status}" -eq "2" ]]; then | ||
MAIN | MAIN | ||
- | # YADFILE Bouton "Valider" | ||
- | elif [[ "${status}" -eq "0" ]]; then | ||
- | STREAM | ||
- | MAIN | ||
- | fi | ||
- | # YADMAIN Bouton "Lancer conversion" | + | # YADSOURCE choix "Fichier avec analyse" |
- | elif [[ "${status}" -eq "0" ]]; then | + | elif [[ "${source}" == "Fichier avec analyse" ]]; then |
- | SAVE | + | YADFILE |
+ | |||
+ | # Si dossier selectionner, liste les fichiers contenu du dossier | ||
+ | [[ -d "${fileIn}" ]] && fileIn=$(ls "${fileIn}"/*) | ||
- | # Récupération de la valeur TRUE et FALSE depuis YADMAIN et fusion avec les données du fichier stream.txt | + | # YADFILE Bouton "Quitter" ou "Croix fenêtre" |
- | IFS=$"|" | + | if [[ "${status}" -eq "1" ]] || [[ "${status}" -eq "252" ]]; then |
- | numLine="4" | + | rm -rf "${dossierTmp}" |
- | stream=$( | + | exit |
- | while read line; do | + | |
- | bol=$(awk 'NR == '${numLine}' {printf "%s" ,$1}' <<< "$(printf "%s\n" ${yadMain} | awk NF)") | + | |
- | printf "${bol}${line}\n" | + | |
- | ((numLine+=1)) | + | |
- | done <<< $(cat "${dossierTmp}/stream.txt") | awk -F [\|] '{if ($1 ~ /TRUE/) {print $0}}') | + | |
- | SAVE | + | # YADFILE Bouton "Annuler" |
- | FFMPEG | + | elif [[ "${status}" -eq "2" ]]; then |
- | MAIN | + | MAIN |
+ | # YADFILE Bouton "Valider" | ||
+ | elif [[ "${status}" -eq "0" ]]; then | ||
+ | |||
+ | STREAM | YADPROGRESS | ||
+ | |||
+ | IFS=$'\n' | ||
+ | TabYadStream=($(cat "${dossierTmp}/yadStream.txt")) | ||
+ | rm "${dossierTmp}/yadStream.txt" | ||
+ | |||
+ | MAIN | ||
+ | fi | ||
+ | |||
+ | # YADSOURCE choix "Fichier" | ||
+ | elif [[ "${source}" == "Fichier" ]]; then | ||
+ | YADFILE | ||
+ | |||
+ | # Si dossier selectionner, liste les fichiers contenu du dossier | ||
+ | [[ -d "${fileIn}" ]] && fileIn=$(ls "${fileIn}"/*) | ||
+ | |||
+ | # YADFILE Bouton "Quitter" ou "Croix fenêtre" | ||
+ | if [[ "${status}" -eq "1" ]] || [[ "${status}" -eq "252" ]]; then | ||
+ | rm -rf "${dossierTmp}" | ||
+ | exit | ||
+ | |||
+ | # YADFILE Bouton "Annuler" | ||
+ | elif [[ "${status}" -eq "2" ]]; then | ||
+ | MAIN | ||
+ | |||
+ | # YADFILE Bouton "Valider" | ||
+ | elif [[ "${status}" -eq "0" ]]; then | ||
+ | STREAM_SIMPLE | YADPROGRESS | ||
+ | |||
+ | IFS=$'\n' | ||
+ | TabYadStream=($(cat "${dossierTmp}/yadStream.txt")) | ||
+ | rm "${dossierTmp}/yadStream.txt" | ||
+ | |||
+ | MAIN | ||
+ | fi | ||
+ | |||
+ | # YADSOURCE choix "DVD" | ||
+ | elif [[ "${source}" == "DVD" ]]; then | ||
+ | echo "Source DVD à finir" | ||
+ | |||
+ | # YADSOURCE choix "CD" | ||
+ | elif [[ "${source}" == "CD" ]]; then | ||
+ | echo "Source CD à finir" | ||
+ | |||
+ | # YADSOURCE choix "DDL" | ||
+ | elif [[ "${source}" == "DDL" ]]; then | ||
+ | echo "Source DDL à finir" | ||
+ | |||
+ | fi | ||
+ | |||
+ | # YADMAIN Bouton "Lancer conversion" | ||
+ | elif [[ "${status}" -eq "0" ]]; then | ||
+ | SAVE | ||
+ | |||
+ | if [[ "${source}" == "Fichier avec analyse" ]]; then | ||
+ | # Récupération de la valeur TRUE et FALSE depuis YADMAIN et fusion avec les données du fichier stream.txt | ||
+ | IFS=$"|" | ||
+ | numLine="4" # Ligne 4 première ligne avec valeur TRUE ou FALSE | ||
+ | stream=$( | ||
+ | while read line; do | ||
+ | bol=$(awk 'NR == '${numLine}' {printf "%s" ,$1}' <<< "$(printf "%s\n" ${yadMain} | awk NF)") | ||
+ | printf "${bol}${line}\n" | ||
+ | ((numLine+=1)) | ||
+ | done <<< $(cat "${dossierTmp}/stream.txt") | awk -F [\|] '{if ($1 ~ /TRUE/) {print $0}}') | ||
+ | |||
+ | SAVE | ||
+ | FFMPEG | ||
+ | MAIN | ||
+ | |||
+ | elif [[ "${source}" == "Fichier" ]]; then | ||
+ | |||
+ | SAVE | ||
+ | FFMPEG_SIMPLE | ||
+ | MAIN | ||
+ | fi | ||
fi | fi | ||
} | } | ||
#=========================================================================================================== | #=========================================================================================================== | ||
CONFIGURATION | CONFIGURATION | ||
+ | |||
+ | #fileIn="/home/$USER/Bureau/0in.m4a" ## TEST | ||
+ | #STREAM ## TEST | ||
+ | |||
MAIN | MAIN | ||
+ | |||
+ | |||
</code> | </code> | ||