#1 Le 24/02/2013, à 10:30
- xou816
GLC: Enregistrement sonore microphone
Bonjour à tous,
Depuis quelques temps je recherchais un bon logiciel de capture audio et vidéo, et je suis finalement tombé sur ce qui semble être une petite merveille: GLC. Pour le débutant que je suis, ça m'a fait un peu peur au début (pas d'interface graphique...), mais au final, ça va! C'est le meilleur enregistreur trouvé pour le moment.
Je me suis concocté un petit fichier bash pour éviter d'avoir à retaper les mêmes commandes régulièrement. Ça marche plutôt bien, j'ai fait un mélange de commandes issus de tutos/forums/etc et ça fait exactement ce que je veux! (j'ai même un peu amélioré le script avec mes maigres connaissances en bash). Tout ce que je veux, donc, ou presque... Le seul truc qui me fait défaut, c'est l'enregistrement du son issu du microphone: après quelques recherches, je trouve pas mals de trucs (barbares), des noms que je ne connaissais pas (Alsa?! Quécécé??), bref, le bonheur!^^
C'est pourquoi je viens requérir votre aide pour compléter mon script bash. Je n'y connais pas grand chose, donc merci d'être indulgents! J'ai fait mon maximum avant de recourir à votre aide.
Voilà mon script actuel:
#!/bin/sh/
DEFAULT="video_`date +%d-%m-%Y_%H:%M:%S`"
PROJECT=${1:-$DEFAULT}
cd "$HOME/Vidéos/"
if [ -d "GLC Recordings" ]
then
cd "GLC Recordings"
else
mkdir "GLC Recordings"
fi
mkdir $PROJECT
cd $PROJECT
glc-capture -o $PROJECT-stream.glc [MON PROGRAMME]
glc-play $PROJECT-stream.glc -a 1 -o $PROJECT-audio.wav
glc-play $PROJECT-stream.glc -o - -y 1 | mencoder -demuxer y4m - -ovc x264 -x264encopts qp=18:pass=1 -of avi -audiofile $PROJECT-audio.wav -oac mp3lame -o $PROJECT.avi
qp=18:pass=2 -of avi -o $PROJECT.avi
mkdir ".tmp"
mv $PROJECT-audio.wav .tmp/
mv $PROJECT-stream.glc .tmp/
Merci d'avance!
EDIT: J'ai une autre question, au passage. Est-ce normal que la vidéo finale soit légèrement assombrie avec ce script?
Dernière modification par xou816 (Le 24/02/2013, à 11:45)
Hors ligne
#2 Le 08/03/2013, à 16:34
- GP974
Re : GLC: Enregistrement sonore microphone
bonjour
bon j'ai eu le même problème j'avais besoin d'enregistrer un de mes applsi et recordmydestkop ne fonctionne pas
j'ai découvert GLC et ça marche parfaitement ( je n'utilise pas de micro)
merci pour ton script xou816 je l'ai repris et je l'ai un peu amélioré
je fais des fois des petit script mais je ne sais pas vraiment les bonnes pratique donc en passant si j'ai fais de grosse bourde dans mon script merci de me le dire pour que je m’améliore
#!/bin/bash
## Script pour automatiser les taches d'enregistrement via GLC
## Version 1.1 by xou816 && Gp974
## voir http://forum.ubuntu-fr.org/viewtopic.php?id=1207671
## Usage ./GLCSreenCast.sh NomProjet ProgrammeAExecuter
DEFAULT="ScreenCast_`date +%d-%m-%Y_%H:%M:%S`"
PROJECT=${1:-$DEFAULT}
Erreur="\033[31m"
Warning="\033[33m"
Succees="\033[32m"
Normal="\033[0m"
Date="date +%H:%M:%S"
if [ $# -lt 2 ]
then
echo -e "Nombre de parametre incorrect !\nUsage ./GLCSreenCast.sh NomProjet ProgrammeAExecuter"
exit 1
fi
#cd "$HOME/Vidéos/"
if [ -d "$HOME/Vidéos/GLC Recordings" ]
then
cd "$HOME/Vidéos/GLC Recordings" && mkdir $PROJECT && cd $PROJECT 2>> GLC.log
else
mkdir "$HOME/Vidéos/GLC Recordings" && mkdir $HOME/Vidéos/GLC Recordings/$PROJECT && cd $HOME/Vidéos/GLC Recordings/$PROJECT 2>> GLC.log
fi
if [ $? -eq 1 ]
then
echo -e "[`$Date`]Erreur creation dossier[$Erreur Echec $Normal]\n Consulter GLC.log pour plus de détails"
echo -e "[`$Date`]Erreur creation dossier:$PROJECT dans $HOME/Vidéos/ Ajuster les droits ecriture et lecture et verifiez que le dossier n'existe pas puis recommencer" >> GLC.log
exit 1
fi
echo -e "[`$Date`]Debut Enregistrement\nLancement de:$2\nEnregistrement dans:$PROJECT" >> GLC.log
echo -e "[`$Date`]Debut Enregistrement\nLancement de:$2\nEnregistrement dans:$PROJECT"
glc-capture -o $PROJECT-stream.glc -s $2 2>> GLC.log
if [ $? -eq 0 ]
then
echo -e "[`$Date`]Capture Ok\nDebut encodage a partir de:$PROJECT-stream.glc" >> GLC.log
echo -e "[`$Date`]Capture Ok\nDebut encodage a partir de:$PROJECT-stream.glc"
else
echo -e "[`$Date`]Erreur Capture[$Erreur Echec $Normal]\n Consulter GLC.log pour plus de détails"
echo -e "[`$Date`]Erreur Capture" >> GLC.log
exit 1
fi
echo -e "[`$Date`]Extraction son:$PROJECT-audio.wav" >> GLC.log
echo -e "[`$Date`]Extraction son:$PROJECT-audio.wav"
glc-play $PROJECT-stream.glc -a 1 -o $PROJECT-audio.wav
echo -e "[`$Date`]Encodage en cours fichier destination:$PROJECT.mp4" >> GLC.log
echo -e "[`$Date`]Encodage en cours fichier destination:$PROJECT.mp4"
if [ -e $PROJECT-audio.wav ]
then
echo -e "[`$Date`]Fichier de son:$PROJECT-audio.wav:[ok]" >> GLC.log
echo -e "[`$Date`]Fichier de son:$PROJECT-audio.wav:[ok]"
glc-play $PROJECT-stream.glc -o - -y 1 | ffmpeg -i - -i $PROJECT-audio.wav -acodec libmp3lame -ab 128k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 0 "$PROJECT.mp4" 2>> GLC.log
else
echo -e "[`$Date`]Pas de fichier son[warning]" >> GLC.log
echo -e "[`$Date`]Pas de fichier son[$Warning warning $Normal]"
glc-play $PROJECT-stream.glc -o - -y 1 | ffmpeg -i - -an -vcodec libx264 -vpre slow -crf 22 -threads 0 "$PROJECT.mp4" 2>> GLC.log
fi
if [ $? -eq 0 ]
then
echo -e "[`$Date`]Encodage complet emplacement fichier:$HOME/Vidéos/$PROJECT/$PROJECT.mp4 [Reusite] \n Nettoyage..." >> GLC.log
echo -e "[`$Date`]Encodage complet emplacement fichier:$HOME/Vidéos/$PROJECT/$PROJECT.mp4 [$Succees Reusite $Normal] \n Nettoyage..."
rm $PROJECT-stream.glc
echo -e "[`$Date`]Nettoyage ok\nFin script\n\n\n" >> GLC.log
echo -e "[`$Date`]Nettoyage ok\nFin script"
exit 0
else
echo -e "[`$Date`]Erreur Encodage [Echec]\n" >> GLC.log
echo -e "[`$Date`]Erreur Encodage [$Erreur Echec $Normal]\n Consulter GLC.log pour plus de détails"
exit 1
fi
Autre chose il y a un moyen de rediriger mes message dans un fichier et sur la sortie standard en même temps ? ( ça m’éviterai les copier coller)
Merci
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Edit 18/02/14 ajout version 1.22
#!/bin/bash
## Script pour automatiser les taches d'enregistrement via GLC
## Version 1.22 by xou816 && Gp974
## voir http://forum.ubuntu-fr.org/viewtopic.php?id=1207671
## Usage ./GLCSreenCast.sh NomProjet ProgrammeAExecuter
#set -xv
PROJECT=$1
Erreur="\033[31m"
Warning="\033[33m"
Succees="\033[32m"
Normal="\033[0m"
Date="date +%H:%M:%S"
if [ $# -lt 2 ]
then
echo -e "[`$Date`]$Erreur[Erreur]$Normal:Nombre de parametre incorrect !\nUsage ./GLCSreenCast.sh NomProjet ProgrammeAExecuter"
exit 1
fi
if [ -d "$HOME/Vidéos/GLC_Recordings" ]
then
mkdir "$HOME/Vidéos/GLC_Recordings/$PROJECT" && cd "$HOME/Vidéos/GLC_Recordings/$PROJECT" | tee -a /$HOME/Vidéos/GLC_Recordings/GLC.log
else
mkdir "$HOME/Vidéos/GLC_Recordings" && mkdir $HOME/Vidéos/GLC_Recordings/$PROJECT && cd $HOME/Vidéos/GLC_Recordings/$PROJECT | tee -a /$HOME/Vidéos/GLC_Recordings/GLC.log
fi
if [ $? -eq 1 ]
then
if [ -d "$HOME/Vidéos/GLC_Recordings/$PROJECT" ]
then
PROJECT="$1_`date +%d-%m-%Y_%H:%M:%S`"
mkdir "$HOME/Vidéos/GLC_Recordings/$PROJECT" && cd "$HOME/Vidéos/GLC_Recordings/$PROJECT" | tee -a /$HOME/Vidéos/GLC_Recordings/GLC.log
if [ $? -eq 1 ]
then
echo -e "[`$Date`]$Erreur[Erreur]$Normal:Creation dossier:$PROJECT dans $HOME/Vidéos/GLC_Recordings/ Ajuster les droits ecriture et lecture" | tee -a /$HOME/Vidéos/GLC_Recordings/GLC.log
notify-send "Creation Dossier Echec" "Consulter GLC.log"
exit 1
else
echo -e "[`$Date`]$Warning[Attention]$Normal:Dossier Existant ! Nouveau Nom:$PROJECT" | tee -a /$HOME/Vidéos/GLC_Recordings/GLC.log
fi
else
echo -e "[`$Date`]$Erreur[Erreur]$Normal:Creation dossier:$PROJECT dans $HOME/Vidéos/GLC_Recordings/ Ajuster les droits ecriture et lecture" | tee -a /$HOME/Vidéos/GLC_Recordings/GLC.log
notify-send "Creation Dossier Echec" "Consulter GLC.log"
exit 1
fi
fi
echo -e "\n==============Debut script===============\n" | tee -a GLC.log
echo -e "[`$Date`]Debut Enregistrement\nLancement de:$2\nEnregistrement dans:$PROJECT" | tee -a GLC.log
{ glc-capture -o $PROJECT-stream.glc -s $2
Return=$?
}
2>&1 | tee -a GLC.log
if [ $Return -eq 0 ]
then
echo -e "[`$Date`]Capture$Succees[Ok]$Normal\nDebut encodage a partir de:$PROJECT-stream.glc" | tee -a GLC.log
else
echo -e "[`$Date`]$Erreur[Erreur]$Normal:Erreur Capture" | tee -a GLC.log
notify-send "Encodage echec" "Consulter GLC.log"
exit 1
fi
echo -e "[`$Date`]Extraction son:$PROJECT-audio.wav" | tee -a GLC.log
glc-play $PROJECT-stream.glc -a 1 -o $PROJECT-audio.wav
echo -e "[`$Date`]Encodage en cours fichier destination:$PROJECT.mp4" | tee -a GLC.log
if [ -e $PROJECT-audio.wav ]
then
echo -e "[`$Date`]Fichier de son:$PROJECT-audio.wav:$Succees[Ok]$Normal" | tee -a GLC.log
glc-play $PROJECT-stream.glc -o - -y 1 | ffmpeg -i - -i $PROJECT-audio.wav -acodec libmp3lame -ab 128k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 0 "$PROJECT.mp4" | tee -a GLC.log
else
echo -e "[`$Date`]$Warning[Attention]$Normal:Pas de fichier son" | tee -a GLC.log
glc-play $PROJECT-stream.glc -o - -y 1 | ffmpeg -i - -an -vcodec libx264 -vpre slow -crf 22 -threads 0 "$PROJECT.mp4" | tee -a GLC.log
fi
if [ $? -eq 0 ]
then
echo -e "[`$Date`]Encodage complet emplacement fichier:$HOME/Vidéos/GLC_Recordings/$PROJECT/$PROJECT.mp4 $Succees[Ok]$Normal\n Nettoyage..." | tee -a GLC.log
mv $PROJECT-stream.glc /tmp
mv $PROJECT-audio.wav /tmp
echo -e "[`$Date`]Nettoyage$Succees[Ok]$Normal\n==============Fin script===============\n" | tee -a GLC.log
if [ -f $HOME/Vidéos/GLC_Recordings/$PROJECT/$PROJECT.mp4 ]
then
if [ $XDG_CURRENT_DESKTOP = "GNOME" ] || [ $XDG_CURRENT_DESKTOP = "UNITY" ]
then
nautilus "$HOME/Vidéos/GLC_Recordings/$PROJECT/$PROJECT.mp4" &
notify-send "Encodage terminé" "Votre video est disponible"
elif [ $XDG_CURRENT_DESKTOP = "KDE" ]
then
konkeror "$HOME/Vidéos/GLC_Recordings/$PROJECT/$PROJECT.mp4" &
notify-send "Encodage terminé" "Votre video est disponible"
else
echo -e "[`$Date`]$Warning[Attention]$Normal:Presentation du fichier impossible DE:$XDG_CURRENT_DESKTOP" | tee -a GLC.log
notify-send "Presentation du fichier impossible" "Votre video est disponible ici:$HOME/Vidéos/GLC_Recordings/$PROJECT/$PROJECT.mp4"
fi
exit 0
fi
else
echo -e "[`$Date`]$Erreur[Erreur]$Normal:Erreur Encodage\n" | tee -a GLC.log
notify-send "Encodage echec" "Consulter GLC.log"
exit 1
fi
GP974
Dernière modification par GP974 (Le 18/02/2014, à 20:50)
Hors ligne
#3 Le 09/03/2013, à 06:34
- xou816
Re : GLC: Enregistrement sonore microphone
Aaaaah un collègue réunionnais en plus!
Ravi d'avoir pu aider, j'imaginais plutôt le contraire mais bon^^
Il faudra que j'essaye ton script, j'ai l'impression que je vais apprendre pas mal de trucs sur le bash au passage (comme je l'ai précisé au début, je suis plutôt débutant et donc mon script était assez... brouillon).
Merci en tout cas!
Hors ligne
#4 Le 09/05/2013, à 10:42
- xou816
Re : GLC: Enregistrement sonore microphone
Petit up (désolé) pas forcément pour le problème (enfin, si vous avez une réponse, je suis preneur! ) mais plutôt pour partager mon script GLC.
J'en suis assez content et je l'ai amélioré avec un petit programme bien sympa, zenity (et aussi notify-send):
#!/bin/bash/
for i in "$@"; do
case $i in
-p=*|--project=*)
ARG_PROJECT=${i#*=}
;;
-a=*|--application=*)
ARG_APPLICATION=${i#*=}
;;
*)
# unknown option
;;
esac
done
DEFAULT="video_`date +%d-%m-%Y_%H:%M:%S`"
WINDOW="GLC"
cd "$HOME/Vidéos/"
if [ -d "GLC Recordings" ]
then
cd "GLC Recordings"
else
mkdir "GLC Recordings"
fi
if [ "$ARG_PROJECT" = "" ]; then
PROJECT="$DEFAULT"
PROJECT=$(zenity --entry --title="$WINDOW" --entry-text="$DEFAULT" --text="Project name:")
while [ -d "$PROJECT/" ]
do
if [ -d "$PROJECT/" ]
then
zenity --error --title="$WINDOW" --text="The project already exists."
fi
PROJECT=$(zenity --entry --title="$WINDOW" --entry-text="$DEFAULT" --text="Project name:")
done
else
PROJECT="$ARG_PROJECT"
fi
mkdir "$PROJECT"
cd "$PROJECT"
if [ "$ARG_APPLICATION" = "" ]; then
APPLICATION=""
while [ "$APPLICATION" = "" ]
do
APPLICATION=$(zenity --entry --title="$WINDOW" --text="Application to record:")
done
else
APPLICATION="$ARG_APPLICATION"
fi
notify-send "GLC started! Press SHIFT + F8 to start recording."
glc-capture -o "$PROJECT"-stream.glc ${APPLICATION}
if [ -f "$PROJECT"-stream.glc ]
then
(
echo "33"
echo "# Extracting audio..."; glc-play "$PROJECT"-stream.glc -a 1 -o "$PROJECT"-audio.wav; sleep 1
echo "66"
echo "# Converting to AVI..."; glc-play "$PROJECT"-stream.glc -o - -y 1 | mencoder -demuxer y4m - -ovc x264 -x264encopts qp=18:pass=1 -of avi -audiofile "$PROJECT"-audio.wav -oac mp3lame -o "$PROJECT".avi
echo "99"
echo "# Cleaning..."; sleep 1
echo "100"
echo "# Done!"
mkdir ".tmp"
mv "$PROJECT"-audio.wav .tmp/
mv "$PROJECT"-stream.glc .tmp/
mv divx2pass.log .tmp/
) | zenity --progress \
--title="$WINDOW" \
--text="Exporting video..." \
--percentage=0
if [ "$?" = -1 ] ; then
zenity --error \
--text="Aborting."
fi
notify-send "GLC video exportation complete!"
zenity --info --title="$WINDOW" --text="Video exported to $HOME/Vidéos/GLC Recordings/$PROJECT/!"
else
zenity --error --title="$WINDOW" --text="No video found."
cd ..
rm -rf "$PROJECT/"
fi
Voilà! Bonne journée à tous!
EDIT: petite modif' pour l'utilisation en ligne de commande, à savoir: sh glc-gui.sh <projet> <application>
EDIT 2: à présent ça s'utilise comme ça: sh glc-gui.sh -p=<projet> -a=<application> ou sh glc-gui.sh --project=<projet> --application=<application>
Dernière modification par xou816 (Le 10/05/2013, à 11:17)
Hors ligne