Ci-dessous, les différences entre deux révisions de la page.
| 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: | ||
| - | ====== | + | ====== |
| - | * [[ http:// | + | ===== Capture de webcam avec visualisation |
| - | * [[ http:// | + | |
| - | * [[ http:// | + | |
| - | + | ||
| - | ====== il a tout bon ====== | + | |
| Now let’s get busy building a pipeline! | Now let’s get busy building a pipeline! | ||
| - | $ gst-launch v4l2src device=/ | + | |
| - | ' | + | ' |
| - | 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 ! ' | + | |
| - | queue ! videorate ! ' | + | queue ! videorate ! ' |
| - | 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 | + | |
| 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 ! ' | + | |
| - | tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \ | + | tee name=t_vid ! queue ! xvimagesink sync=false t_vid. ! queue ! videorate ! \ |
| - | ' | + | ' |
| - | 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 ! ' | + | |
| - | 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/ | + | video/ |
| - | alsasrc device=hw: | + | alsasrc device=hw: |
| - | queue ! audioconvert ! queue ! vorbisenc ! queue ! mux. \ | + | queue ! audioconvert ! queue ! vorbisenc ! queue ! mux. \ |
| - | 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=" | + | |
| (voir http:// | (voir http:// | ||
| Ligne 105: | Ligne 101: | ||
| need something else, something more raw! Try this: | need something else, something more raw! Try this: | ||
| - | $ gst-launch v4l2src ! ' | + | |
| - | 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 ! ' | + | videorate ! ' |
| - | alsasrc device=hw: | + | alsasrc device=hw: |
| - | 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 ! \ | + | |
| - | 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 " | (je n'ai pas de plugin gstreamer pour le " | ||
| - | 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 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 " | ||
| + | |||
| + | voir http:// | ||
| + | |||
| + | |||
| + | ===== 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:// | ||
| + | * Faire une [[ http:// | ||
| + | * Capture de webcam avec visualisation : [[ http:// | ||
| + | |||