Fourre Tout

C'est mon pense-bête

Outils pour utilisateurs

Outils du site


linux:webcam

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
linux:webcam [2011/01/03 16:58]
jce créée
linux:webcam [2021/04/11 13:50] (Version actuelle)
Ligne 1: Ligne 1:
-====== liens ======+====== Jouer avec une webcam ======
  
  
-  * [[ http://www.commandlinefu.com | c'est fun ]] +===== Capture de webcam avec visualisation =====
-  * [[ http://blog.nicolargo.com/2010/04/myscreencast-comment-faire-du-screencast-avec-gstreamer.html | screencast ]] +
-  * [[ http://www.twm-kd.com/linux/webcam-and-linux-gstreamer-tutorial | mais surtout]] +
- +
-====== il a tout bon ======+
  
  
 Now let’s get busy building a pipeline! Now let’s get busy building a pipeline!
  
-$ gst-launch v4l2src device=/dev/video0 ! \ +  $ gst-launch v4l2src device=/dev/video0 ! \ 
-  'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ +    'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ 
-  xvimagesink+    xvimagesink
  
 GStreamer has a simple pipeline workflow. First you define the source, then GStreamer has a simple pipeline workflow. First you define the source, then
Ligne 27: Ligne 23:
 Now that you have a live feed on your screen you can try putting it in a file. Now that you have a live feed on your screen you can try putting it in a file.
  
-$ gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ +  $ gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ 
-  queue ! videorate ! 'video/x-raw-yuv,framerate=30/1' ! theoraenc ! \ +    queue ! videorate ! 'video/x-raw-yuv,framerate=30/1' ! theoraenc ! \ 
-  queue ! oggmux ! filesink location=me_funny_dancing.ogg+    queue ! oggmux ! filesink location=me_funny_dancing.ogg
  
 What is different this time? First there is queue which provides some buffer What is different this time? First there is queue which provides some buffer
Ligne 40: Ligne 36:
 filesink which writes all the data to a file. Try playing it! filesink which writes all the data to a file. Try playing it!
  
-$ mplayer me_funny_dancing.ogg+  $ mplayer me_funny_dancing.ogg
  
 See yourself doing a funny dance. But oh, noes! The quality is kind of bad and See yourself doing a funny dance. But oh, noes! The quality is kind of bad and
Ligne 46: Ligne 42:
 a time. First the recording feedback. a time. First the recording feedback.
  
-$ gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ +  $ gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ 
-  tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \ +    tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \ 
-  'video/x-raw-yuv,framerate=30/1' ! theoraenc ! queue ! oggmux ! \ +    'video/x-raw-yuv,framerate=30/1' ! theoraenc ! queue ! oggmux ! \ 
-  filesink location=me_funny_dancing.ogg+    filesink location=me_funny_dancing.ogg
  
 Yes, this pipeline is getting more and more complicated. With tee you can Yes, this pipeline is getting more and more complicated. With tee you can
Ligne 64: Ligne 60:
 complicated pipeline. complicated pipeline.
  
-$ gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ +  $ gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ 
-  tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \ +    tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \ 
-  video/x-raw-yuv,framerate=30/1 ! theoraenc ! queue ! mux. \ +    video/x-raw-yuv,framerate=30/1 ! theoraenc ! queue ! mux. \ 
-  alsasrc device=hw:1,0 ! audio/x-raw-int,rate=48000,channels=2,depth=16 ! \ +    alsasrc device=hw:1,0 ! audio/x-raw-int,rate=48000,channels=2,depth=16 ! \ 
-  queue ! audioconvert ! queue ! vorbisenc ! queue ! mux. \ +    queue ! audioconvert ! queue ! vorbisenc ! queue ! mux. \ 
-  oggmux name=mux ! filesink location=me_funny_dancing.ogg+   oggmux name=mux ! filesink location=me_funny_dancing.ogg
  
 Are your eyes bleeding? You’re not finished yet, so get ready for more. What Are your eyes bleeding? You’re not finished yet, so get ready for more. What
Ligne 95: Ligne 91:
 avec pulseaudio :  avec pulseaudio : 
  
-pulsesrc device="alsa_input.usb-046d_081b_4FBFC690-02.analog-mono"+  pulsesrc device="alsa_input.usb-046d_081b_4FBFC690-02.analog-mono"
  
 (voir http://www.oz9aec.net/index.php/gstreamer/365-pulseaudio-device-names) (voir http://www.oz9aec.net/index.php/gstreamer/365-pulseaudio-device-names)
Ligne 105: Ligne 101:
 need something else, something more raw! Try this: need something else, something more raw! Try this:
  
-$ gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ +  $ gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480,framerate=30/1' ! \ 
-  tee name=t_vid ! queue ! videoflip method=horizontal-flip ! \ +    tee name=t_vid ! queue ! videoflip method=horizontal-flip ! \ 
-  xvimagesink sync=false t_vid. ! queue ! \ +    xvimagesink sync=false t_vid. ! queue ! \ 
-  videorate ! 'video/x-raw-yuv,framerate=30/1' ! queue ! mux. \ +    videorate ! 'video/x-raw-yuv,framerate=30/1' ! queue ! mux. \ 
-  alsasrc device=hw:1,0 ! audio/x-raw-int,rate=48000,channels=2,depth=16 ! queue ! \ +    alsasrc device=hw:1,0 ! audio/x-raw-int,rate=48000,channels=2,depth=16 ! queue ! \ 
-  audioconvert ! queue ! mux. avimux name=mux ! \ +    audioconvert ! queue ! mux. avimux name=mux ! \ 
-  filesink location=me_dancing_funny.avi+    filesink location=me_dancing_funny.avi
  
 Don’t be surprised if you see your mirrored image on the screen. You should, Don’t be surprised if you see your mirrored image on the screen. You should,
Ligne 131: Ligne 127:
 the fly. You need to record raw video and then convert to H.264. Here’s how: the fly. You need to record raw video and then convert to H.264. Here’s how:
  
-$ gst-launch filesrc location=me_funny_dancing.avi ! \ +  $ gst-launch filesrc location=me_funny_dancing.avi ! \ 
-  decodebin name=decode decode. ! queue ! x264enc ! mp4mux name=mux ! \ +    decodebin name=decode decode. ! queue ! x264enc ! mp4mux name=mux ! \ 
-  filesink location=me_funny_dancing.mp4 decode. ! \ +    filesink location=me_funny_dancing.mp4 decode. ! \ 
-  queue ! audioconvert ! faac ! mux.+    queue ! audioconvert ! faac ! mux.
  
 (je n'ai pas de plugin gstreamer pour le "muxage" en mp4 => j'utilise mencoder : (je n'ai pas de plugin gstreamer pour le "muxage" en mp4 => j'utilise mencoder :
-mencoder -profile mpeg4 me_dancing_funny.avi -o me_dancing_funny.mp4)+  mencoder -profile mpeg4 me_dancing_funny.avi -o me_dancing_funny.mp4)
  
 This time you need to specify a different source. It needs to be the file This time you need to specify a different source. It needs to be the file
Ligne 164: Ligne 160:
 Use gst-inspect to check which inputs and outputs are acceptable by a certain element. Use gst-inspect to check which inputs and outputs are acceptable by a certain element.
  
-$ gst-inspect filesink +  $ gst-inspect filesink 
-$ gst-inspect audioconvert+  $ gst-inspect audioconvert
  
 I usually run arecord -l to get list of devices. I usually run arecord -l to get list of devices.
  
 +===== Trouver les périphériques avec pulseaudio =====
  
-====== le script qui fait tout : ======+  pactl list 
 + 
 +This will generate a lot of text and you will probably want to pipe this through less. The interesting modules are those of type "Source #" for input and "Sink #" for playback. The pulseaudio device name is then the weird text string shown under the "Name" parameter. The [[ http://pulseaudio.org/wiki/FAQ | Pulseaudio FAQ]] has some neat tricks for [[ http://pulseaudio.org/wiki/FAQ#HowdoIrecordstuff | filtering the device ]] names out: 
 + 
 +voir http://www.oz9aec.net/index.php/gstreamer/365-pulseaudio-device-names 
 + 
 + 
 +===== Le script qui fait tout =====
    
  
Ligne 196: Ligne 200:
   # supprimer le fichier non compressé   # supprimer le fichier non compressé
   rm -f $nomFichier.avi   rm -f $nomFichier.avi
 +
 +=====  Ressources  =====
 +
 +
 +  * Utiliser gstreamer en [[ http://www.commandlinefu.com | ligne de commande ]] pour produire divers effets.
 +  * Faire une  [[ http://blog.nicolargo.com/2010/04/myscreencast-comment-faire-du-screencast-avec-gstreamer.html | capture vidéo ]] de son écran.
 +  * Capture de webcam avec visualisation :  [[ http://www.twm-kd.com/linux/webcam-and-linux-gstreamer-tutorial | exemples progressifs]] et fonctionnels (c'est de là que vient le //tutoriel// ci-dessus).
 +
  
linux/webcam.1294070295.txt.gz · Dernière modification: 2021/04/11 13:41 (modification externe)