Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 07/11/2009, à 19:39

fury_jin

Comment combiner x11grab avec la capture du son.

Salut,


Pour la réalisation de tutos sous Ubuntu 9.04 je voulais essayer FFMPEG pour la capture.
Grace à la commande:

ffmpeg -b 10000k -f x11grab -s 1280x720 -i :0.0+400,304 out.mpg

Cela fonctionne très bien, J'ai un fichier vidéo correct.

Aussi j'aimerais bien activer l'enregistrement du micro en même temps que la vidéo.
Cela doit être simple à faire mais je ne trouve pas.

Merci d'avance.

Hors ligne

#2 Le 08/11/2009, à 06:54

marc_qui

Re : Comment combiner x11grab avec la capture du son.

salut,
http://philipjm.free.fr/blog/index.php?2008/01/26/129-istambul-et-recordmydesktop-les-videos-d-ecran-sans-se-fatiguer
http://philipjm.free.fr/blog/index.php?2007/05/08/103-creer-des-videos-capture-d-ecran-avec-ffmpeg

http://doc.ubuntu-fr.org/ffmpeg

Dernière modification par marc_qui (Le 08/11/2009, à 06:55)

Hors ligne

#3 Le 08/11/2009, à 14:16

fury_jin

Re : Comment combiner x11grab avec la capture du son.

J'ai trouvé ce qu'il me fallait:

Un petit script shell trouvé ici
https://lists.ubuntu.com/archives/ubuntu-users/2009-June/187038.html

Voici le code modifié à ma convenance:

### Beginning of the script: ###
#
# igor.chernenko@gmail.com

# A simple bash script to capture screencast with audio. It works on Ubuntu 9.04

# To run the script you should install ffmpeg, SoX, and Steve Harris's LADSPA plugins (swh-plugins)
#
# sudo apt-get install sox 
#
# sudo apt-get install swh-plugins
#
# See -> How to make Ubuntu 9.04 (Jaunty Jackalope) Multimedia Ready
# http://shibuvarkala.blogspot.com/2009/04/howto-make-ubuntu-904-jaunty-jackalope.html
#
# See also my post about sound recording:
# http://n2.nabble.com/How-to-record-sound-on-Ubuntu-8.04%2C-8.10%2C-9.04-td2988982.html
# http://n2.nabble.com/How-to-record-Audacity-video-tutorials-%28high-quality-screencasts%29-on-Ubuntu-9.04-td2996503.html
# http://n2.nabble.com/Re%3A-How-to-record-Audacity-video-tutorials-%28high-quality-screencasts%29-on-Ubuntu-9.04-%28Gale-%28Audacity-Team%29%29-td3002790.html
#
#
# Supply three arguments: 
# (1) name of the file [baseName]
# (2) size of the screen to record [screenIN] 
# (3) size of the video (i.e. resolution) to resize [screenOUT]

# Resolution of [screenOUT] should be in proportion 4:3

# The best result is achieved when [screenIN] = [screenOUT]


# Run the script by command:
#
# my-shooting-script.sh [name-of-the-file] [screenIN] [screenOUT]
#
# EXAMPLEs:
#
# my-shooting-script.sh mumu-00011 1400x1050 1200x900 
#
# my-shooting-script.sh mumu-00012 1200x900 800x600 
#
# my-shooting-script.sh mumu-00015 800x600 800x600 
#
#
# DEFAULT Values:
#
# my-shooting-script.sh my-screencast 1400x1050 1200x900
#
#

#       QUOTE from "man ffmpeg":
#
#       0.0 is display.screen number of your X11 server, same as the DISPLAY
#       environment variable.
#
#               ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg
#
#       0.0 is display.screen number of your X11 server, same as the DISPLAY
#       environment variable. 10 is the x-offset and 20 the y-offset for the
#       grabbing.



# ********************************
#
# Press ENTER to finish recording.
#
# Press ENTER to finish recording.
#
# Press ENTER to finish recording.
#
# ********************************


# Reads the parameters from the command line.
baseName=$1

screenIN=$2

screenOUT=$3

# Tests if the base name was specified. If not, take default value
if [ "$baseName" = "" ]; then
	baseName="my-screencast-01"
fi

# Tests if the screenIN was specified. If not, take default value
if [ "$screenIN" = "" ]; then
	screenIN="1280x720"
fi

# Tests if the screenOUT was specified. If not, take default value
if [ "$screenOUT" = "" ]; then
	screenOUT="1280x720"
fi



# Starts recording video - x11grab (my desktop resolution is 1680x1050Px with ":0.0+400,304" i want to record the area 400Px from the left and 304Px from the top of my screen)
ffmpeg -an -b 10000k -s "$screenIN" -r 25 -f x11grab -i :0.0+400,304 -s "$screenOUT" -r 25 -sameq "$baseName-nosound.avi" &
pidV=$(ps -ef | grep "[f]fmpeg" | awk '{print $2}')
echo "Video recording started with process ID $pidV"

# echo "Video recording started: screenIN=$screenIN screenOUT=$screenOUT file =$baseName"

# Starts recording oss-audio from /dev/dsp
ffmpeg -f oss -ar 44100 -ac 2 -i /dev/dsp -acodec pcm_s16le "$baseName.wav" &
pidA=$(ps -ef | grep "[f]fmpeg" | awk '{print $2}')
echo "Audio recording started with process ID $pidA"

# Waits for the user to press enter.
echo ""
echo "Press ENTER to finish recording."
read nothing


# Kills ffmpeg
# echo "Terminating process $pidV $pidA ..."
echo "Terminating ffmpeg ..."
killall ffmpeg

# kill -15 $pidV $pidA &
# kill -15 $pidV $pidA 

# Wait for ffmpeg to finish.

# Wait for SoX to finish.
wait
echo "" 
echo "Regroupement des fichiers audio et vidéo ..." 
ffmpeg -isync -i "$baseName.wav" -i "$baseName-nosound.avi" -acodec copy -vcodec copy "$baseName-final.avi"

echo ""
echo "DONE! Final video written in file $baseName-final.avi"

A coller dans un fichier .sh
puis à lancer dans le terminal comme ceci
sh nomdufichier.sh

Un fichier wav et avi sera crée dans votre dossier perso (sauf si vous changez de répertoire avant de la lancer)
Puis il va les regrouper dans un beau .avi avec le son syncro à la vidéo, il ne restera plus qu'a compresser avec Avidemux.

Merci Igor et FFMPEG!

Je me suis intéressé à cette alternative car avec recordmydesktop j'avais des problèmes de micro coupures au niveau de la bande son , comme si un vinyle sautait. Et quand elles se produisaient pendant que je prononçais un mot, et bien la syllabe sautait, ce qui est embêtant pour les tutoriels.

Dernière modification par fury_jin (Le 22/02/2010, à 16:13)

Hors ligne