Streaming Video (mjpeg-streamer)
- Szczegóły
- Poprawiono: 03 wrzesień 2015
- Odsłony: 41121
Streaming wideo na platformie Intel Galileo z użyciem MJPEG-Streamer
W artykule opisujemy sposób, w jaki można wykorzystać platformę Intel Galileo do strumieniowego przesyłania obrazu wideo. Do eksperymentów potrzebujemy:
- płyty ewaluacyjnej Intel Galileo (Gen1 lub Gen2),
- karty z przygotowanym czystym obrazem systemu Intel IoT Development Kit (iot-devkit do pobrania tutaj: https://software.intel.com/en-us/iot/downloads),
- kamerki internetowej z interfejsem USB, zgodnej z Linux UVC (Linux USB Video Class driver),
- konwertera (lub przewodu OTG) zakończonego gniazdem USB A z jednej strony oraz wtykiem USB B micro z drugiej (dotyczy jedynie Intel Galileo Gen1, dostępny np. tutaj: http://www.tme.eu/pl/details/ak-300309-002-s/kable-i-adaptery-usb/assmann/)
MJPEG-Streamer
MJPG-streamer to program, który pobiera obrazy w formacie JPEG z kamer internetowych zgodnych z Linux-UVC, z dysku lub z innych źródeł (rozszerzanie poprzez system wtyczek) i umożliwia strumieniowe przesyłanie obrazu wideo (kodek Motion JPEG) przez HTTP do przeglądarki internetowej, oprogramowania VLC oraz innych. Strona główna projektu (oraz repozytorium SVN) znajdują się pod adresem: http://sourceforge.net/projects/mjpg-streamer/.
Brak prekompilowanej dystrybucji oprogramowania i współpracujących wtyczek nie jest żadnym problemem: skompilujemy je z dostępnych źródeł.
Pobieranie źródeł
Źródła aplikacji możemy pobrać na nasz komputer (adres: http://sourceforge.net/projects/mjpg-streamer/files/latest/download), a następnie rozpakować i załadować do katalogu domowego użytkownika root płyty (np. za pomocą WinSCP). W chwili pisania tego tekstu dostępna była wersja 'r63' uaktualniona w dniu 2014-05-15.
Kompilacja
Kompilacja rozpakowanych źródeł zakończy się informacją o błędzie:
.. fatal error: linux/videodev.h: No such file or directory
W tym przypadku wystarczy utworzyć powiązanie pomiędzy odpowiednimi plikami:
ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h
Domyślnie kompilowany jest zarówno MJPEG-Streamer jak i komplet pluginów do obsługi strumieni wejściowych i wyjściowych - w naszym przypadku nie jest to konieczne (dodatkowo pozwoli nieco przyśpieszyć kompilację). W celu kompilacji jedynie dwu niezbędnych wtyczek konieczna jest edycja pliku Makefile projektu (linia plugins):
oryginalny Makefile | Makefile po edycji |
############################################################### # # Purpose: Makefile for "M-JPEG Streamer" # Author.: Tom Stoeveken (TST) # Version: 0.3 # License: GPL # ############################################################### |
############################################################### # # Purpose: Makefile for "M-JPEG Streamer" # Author.: Tom Stoeveken (TST) # Version: 0.3 # License: GPL # ############################################################### |
Po wykonaniu powyższych edycji wydajemy (w katalogu projektu, tam gdzie znajduje się edytowany Makefile) polecenie:
make all
Jego rezultatem powinno być bezproblemowe zbudowanie programu jak i dwu wtyczek: input_uvc oraz output_http:
gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -c -o mjpg_streamer.o mjpg_streamer.c gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -c -o utils.o utils.c utils.c: In function 'daemon_mode': utils.c:67:3: warning: implicit declaration of function 'umask' [-Wimplicit-function-declaration] umask(0); ^ gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -lpthread -ldl mjpg_streamer.o utils.o -o mjpg_streamer chmod 755 mjpg_streamer make -C plugins/input_uvc all make[1]: Entering directory '/home/root/mjpg-streamer/plugins/input_uvc' gcc -c -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o v4l2uvc.lo v4l2uvc.c In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:38:0: warning: "V4L2_CID_BACKLIGHT_COMPENSATION" redefined [enabled by default] #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_PRIVATE_BASE+0) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:102:0: note: this is the location of the previous definition #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:39:0: warning: "V4L2_CID_POWER_LINE_FREQUENCY" redefined [enabled by default] #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_PRIVATE_BASE+1) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:92:0: note: this is the location of the previous definition #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:40:0: warning: "V4L2_CID_SHARPNESS" redefined [enabled by default] #define V4L2_CID_SHARPNESS (V4L2_CID_PRIVATE_BASE+2) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:101:0: note: this is the location of the previous definition #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:41:0: warning: "V4L2_CID_HUE_AUTO" redefined [enabled by default] #define V4L2_CID_HUE_AUTO (V4L2_CID_PRIVATE_BASE+3) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:99:0: note: this is the location of the previous definition #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:43:0: warning: "V4L2_CID_FOCUS_AUTO" redefined [enabled by default] #define V4L2_CID_FOCUS_AUTO (V4L2_CID_PRIVATE_BASE+4) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:661:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:44:0: warning: "V4L2_CID_FOCUS_ABSOLUTE" redefined [enabled by default] #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_PRIVATE_BASE+5) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:659:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:45:0: warning: "V4L2_CID_FOCUS_RELATIVE" redefined [enabled by default] #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_PRIVATE_BASE+6) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:660:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:47:0: warning: "V4L2_CID_PAN_RELATIVE" redefined [enabled by default] #define V4L2_CID_PAN_RELATIVE (V4L2_CID_PRIVATE_BASE+7) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:651:0: note: this is the location of the previous definition #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:48:0: warning: "V4L2_CID_TILT_RELATIVE" redefined [enabled by default] #define V4L2_CID_TILT_RELATIVE (V4L2_CID_PRIVATE_BASE+8) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:652:0: note: this is the location of the previous definition #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:51:0: warning: "V4L2_CID_EXPOSURE_AUTO" redefined [enabled by default] #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_PRIVATE_BASE+10) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:641:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:52:0: warning: "V4L2_CID_EXPOSURE_ABSOLUTE" redefined [enabled by default] #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_PRIVATE_BASE+11) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:648:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:53:0: warning: "V4L2_CID_EXPOSURE_AUTO_PRIORITY" redefined [enabled by default] #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_PRIVATE_BASE+14) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:649:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) ^ In file included from v4l2uvc.h:36:0, from v4l2uvc.c:27: uvcvideo.h:56:0: warning: "V4L2_CID_WHITE_BALANCE_TEMPERATURE" redefined [enabled by default] #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_PRIVATE_BASE+13) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from v4l2uvc.c:27: /usr/include/linux/v4l2-controls.h:100:0: note: this is the location of the previous definition #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) ^ v4l2uvc.c: In function 'v4l2SetControl': v4l2uvc.c:432:23: warning: variable 'val_def' set but not used [-Wunused-but-set-variable] int min, max, step, val_def; ^ v4l2uvc.c:432:17: warning: variable 'step' set but not used [-Wunused-but-set-variable] int min, max, step, val_def; ^ v4l2uvc.c: In function 'v4l2UpControl': v4l2uvc.c:457:32: warning: variable 'val_def' set but not used [-Wunused-but-set-variable] int min, max, current, step, val_def; ^ v4l2uvc.c:457:7: warning: variable 'min' set but not used [-Wunused-but-set-variable] int min, max, current, step, val_def; ^ v4l2uvc.c: In function 'v4l2DownControl': v4l2uvc.c:491:32: warning: variable 'val_def' set but not used [-Wunused-but-set-variable] int min, max, current, step, val_def; ^ v4l2uvc.c:491:12: warning: variable 'max' set but not used [-Wunused-but-set-variable] int min, max, current, step, val_def; ^ gcc -c -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o jpeg_utils.lo jpeg_utils.c In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:38:0: warning: "V4L2_CID_BACKLIGHT_COMPENSATION" redefined [enabled by default] #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_PRIVATE_BASE+0) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:102:0: note: this is the location of the previous definition #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:39:0: warning: "V4L2_CID_POWER_LINE_FREQUENCY" redefined [enabled by default] #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_PRIVATE_BASE+1) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:92:0: note: this is the location of the previous definition #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:40:0: warning: "V4L2_CID_SHARPNESS" redefined [enabled by default] #define V4L2_CID_SHARPNESS (V4L2_CID_PRIVATE_BASE+2) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:101:0: note: this is the location of the previous definition #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:41:0: warning: "V4L2_CID_HUE_AUTO" redefined [enabled by default] #define V4L2_CID_HUE_AUTO (V4L2_CID_PRIVATE_BASE+3) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:99:0: note: this is the location of the previous definition #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:43:0: warning: "V4L2_CID_FOCUS_AUTO" redefined [enabled by default] #define V4L2_CID_FOCUS_AUTO (V4L2_CID_PRIVATE_BASE+4) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:661:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:44:0: warning: "V4L2_CID_FOCUS_ABSOLUTE" redefined [enabled by default] #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_PRIVATE_BASE+5) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:659:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:45:0: warning: "V4L2_CID_FOCUS_RELATIVE" redefined [enabled by default] #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_PRIVATE_BASE+6) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:660:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:47:0: warning: "V4L2_CID_PAN_RELATIVE" redefined [enabled by default] #define V4L2_CID_PAN_RELATIVE (V4L2_CID_PRIVATE_BASE+7) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:651:0: note: this is the location of the previous definition #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:48:0: warning: "V4L2_CID_TILT_RELATIVE" redefined [enabled by default] #define V4L2_CID_TILT_RELATIVE (V4L2_CID_PRIVATE_BASE+8) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:652:0: note: this is the location of the previous definition #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:51:0: warning: "V4L2_CID_EXPOSURE_AUTO" redefined [enabled by default] #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_PRIVATE_BASE+10) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:641:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:52:0: warning: "V4L2_CID_EXPOSURE_ABSOLUTE" redefined [enabled by default] #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_PRIVATE_BASE+11) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:648:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:53:0: warning: "V4L2_CID_EXPOSURE_AUTO_PRIORITY" redefined [enabled by default] #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_PRIVATE_BASE+14) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:649:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) ^ In file included from v4l2uvc.h:36:0, from jpeg_utils.c:30: uvcvideo.h:56:0: warning: "V4L2_CID_WHITE_BALANCE_TEMPERATURE" redefined [enabled by default] #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_PRIVATE_BASE+13) ^ In file included from /usr/include/linux/videodev.h:64:0, from v4l2uvc.h:34, from jpeg_utils.c:30: /usr/include/linux/v4l2-controls.h:100:0: note: this is the location of the previous definition #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) ^ gcc -c -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o dynctrl.lo dynctrl.c In file included from dynctrl.c:35:0: uvcvideo.h:38:0: warning: "V4L2_CID_BACKLIGHT_COMPENSATION" redefined [enabled by default] #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_PRIVATE_BASE+0) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:102:0: note: this is the location of the previous definition #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) ^ In file included from dynctrl.c:35:0: uvcvideo.h:39:0: warning: "V4L2_CID_POWER_LINE_FREQUENCY" redefined [enabled by default] #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_PRIVATE_BASE+1) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:92:0: note: this is the location of the previous definition #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) ^ In file included from dynctrl.c:35:0: uvcvideo.h:40:0: warning: "V4L2_CID_SHARPNESS" redefined [enabled by default] #define V4L2_CID_SHARPNESS (V4L2_CID_PRIVATE_BASE+2) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:101:0: note: this is the location of the previous definition #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) ^ In file included from dynctrl.c:35:0: uvcvideo.h:41:0: warning: "V4L2_CID_HUE_AUTO" redefined [enabled by default] #define V4L2_CID_HUE_AUTO (V4L2_CID_PRIVATE_BASE+3) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:99:0: note: this is the location of the previous definition #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) ^ In file included from dynctrl.c:35:0: uvcvideo.h:43:0: warning: "V4L2_CID_FOCUS_AUTO" redefined [enabled by default] #define V4L2_CID_FOCUS_AUTO (V4L2_CID_PRIVATE_BASE+4) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:661:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) ^ In file included from dynctrl.c:35:0: uvcvideo.h:44:0: warning: "V4L2_CID_FOCUS_ABSOLUTE" redefined [enabled by default] #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_PRIVATE_BASE+5) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:659:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) ^ In file included from dynctrl.c:35:0: uvcvideo.h:45:0: warning: "V4L2_CID_FOCUS_RELATIVE" redefined [enabled by default] #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_PRIVATE_BASE+6) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:660:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) ^ In file included from dynctrl.c:35:0: uvcvideo.h:47:0: warning: "V4L2_CID_PAN_RELATIVE" redefined [enabled by default] #define V4L2_CID_PAN_RELATIVE (V4L2_CID_PRIVATE_BASE+7) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:651:0: note: this is the location of the previous definition #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) ^ In file included from dynctrl.c:35:0: uvcvideo.h:48:0: warning: "V4L2_CID_TILT_RELATIVE" redefined [enabled by default] #define V4L2_CID_TILT_RELATIVE (V4L2_CID_PRIVATE_BASE+8) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:652:0: note: this is the location of the previous definition #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) ^ In file included from dynctrl.c:35:0: uvcvideo.h:51:0: warning: "V4L2_CID_EXPOSURE_AUTO" redefined [enabled by default] #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_PRIVATE_BASE+10) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:641:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) ^ In file included from dynctrl.c:35:0: uvcvideo.h:52:0: warning: "V4L2_CID_EXPOSURE_ABSOLUTE" redefined [enabled by default] #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_PRIVATE_BASE+11) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:648:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) ^ In file included from dynctrl.c:35:0: uvcvideo.h:53:0: warning: "V4L2_CID_EXPOSURE_AUTO_PRIORITY" redefined [enabled by default] #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_PRIVATE_BASE+14) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:649:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) ^ In file included from dynctrl.c:35:0: uvcvideo.h:56:0: warning: "V4L2_CID_WHITE_BALANCE_TEMPERATURE" redefined [enabled by default] #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_PRIVATE_BASE+13) ^ In file included from /usr/include/linux/videodev2.h:64:0, from dynctrl.c:31: /usr/include/linux/v4l2-controls.h:100:0: note: this is the location of the previous definition #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) ^ gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -ljpeg -o input_uvc.so input_uvc.c v4l2uvc.lo jpeg_utils.lo dynctrl.lo In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:38:0: warning: "V4L2_CID_BACKLIGHT_COMPENSATION" redefined [enabled by default] #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_PRIVATE_BASE+0) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:102:0: note: this is the location of the previous definition #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:39:0: warning: "V4L2_CID_POWER_LINE_FREQUENCY" redefined [enabled by default] #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_PRIVATE_BASE+1) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:92:0: note: this is the location of the previous definition #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:40:0: warning: "V4L2_CID_SHARPNESS" redefined [enabled by default] #define V4L2_CID_SHARPNESS (V4L2_CID_PRIVATE_BASE+2) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:101:0: note: this is the location of the previous definition #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:41:0: warning: "V4L2_CID_HUE_AUTO" redefined [enabled by default] #define V4L2_CID_HUE_AUTO (V4L2_CID_PRIVATE_BASE+3) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:99:0: note: this is the location of the previous definition #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:43:0: warning: "V4L2_CID_FOCUS_AUTO" redefined [enabled by default] #define V4L2_CID_FOCUS_AUTO (V4L2_CID_PRIVATE_BASE+4) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:661:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:44:0: warning: "V4L2_CID_FOCUS_ABSOLUTE" redefined [enabled by default] #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_PRIVATE_BASE+5) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:659:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:45:0: warning: "V4L2_CID_FOCUS_RELATIVE" redefined [enabled by default] #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_PRIVATE_BASE+6) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:660:0: note: this is the location of the previous definition #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:47:0: warning: "V4L2_CID_PAN_RELATIVE" redefined [enabled by default] #define V4L2_CID_PAN_RELATIVE (V4L2_CID_PRIVATE_BASE+7) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:651:0: note: this is the location of the previous definition #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:48:0: warning: "V4L2_CID_TILT_RELATIVE" redefined [enabled by default] #define V4L2_CID_TILT_RELATIVE (V4L2_CID_PRIVATE_BASE+8) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:652:0: note: this is the location of the previous definition #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:51:0: warning: "V4L2_CID_EXPOSURE_AUTO" redefined [enabled by default] #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_PRIVATE_BASE+10) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:641:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:52:0: warning: "V4L2_CID_EXPOSURE_ABSOLUTE" redefined [enabled by default] #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_PRIVATE_BASE+11) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:648:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:53:0: warning: "V4L2_CID_EXPOSURE_AUTO_PRIORITY" redefined [enabled by default] #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_PRIVATE_BASE+14) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:649:0: note: this is the location of the previous definition #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) ^ In file included from v4l2uvc.h:36:0, from input_uvc.c:44: uvcvideo.h:56:0: warning: "V4L2_CID_WHITE_BALANCE_TEMPERATURE" redefined [enabled by default] #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_PRIVATE_BASE+13) ^ In file included from /usr/include/linux/videodev.h:64:0, from input_uvc.c:30: /usr/include/linux/v4l2-controls.h:100:0: note: this is the location of the previous definition #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) ^ input_uvc.c: In function 'input_init': input_uvc.c:307:3: warning: implicit declaration of function 'input_cmd' [-Wimplicit-function-declaration] input_cmd(led, 0); ^ make[1]: Leaving directory '/home/root/mjpg-streamer/plugins/input_uvc' cp plugins/input_uvc/input_uvc.so . make -C plugins/output_http all make[1]: Entering directory '/home/root/mjpg-streamer/plugins/output_http' gcc -c -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o httpd.lo httpd.c gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -shared -fPIC -o output_http.so output_http.c httpd.lo make[1]: Leaving directory '/home/root/mjpg-streamer/plugins/output_http' cp plugins/output_http/output_http.so .
Uruchomienie programu
Do właściwego uruchomienia programu konieczne jest podanie szeregu parametrów (rozdzielczość strumienia, ilość klatek na sekundę) oraz sprecyzowanie pluginów wejścia i wyjścia strumienia wideo:
root@quark0032ae:~/mjpeg-streamer# ./mjpg_streamer -i "./input_uvc.so -f 15 -r 640x480" -o "./output_http.so -w ./www" MJPG Streamer Version.: 2.0 i: Using V4L2 device.: /dev/video0 i: Desired Resolution: 640 x 480 i: Frames Per Second.: 30 i: Format............: MJPEG o: www-folder-path...: ./www/ o: HTTP TCP port.....: 8080 o: username:password.: disabled o: commands..........: enabled
Program przerwie pracę (uprzednio zwalniając wszystkie zasoby) w momencie otrzymania SIGTERM (Ctrl+C):
^Csetting signal to stop i: cleaning up ressources allocated by input thread force cancelation of threads and cleanup ressources o: cleaning up ressources allocated by server thread #00 done
Strumień wideo można oglądać w przeglądarce (domyślny demonstracyjny kod interfejsu znajduje się w katalogu ./www). W tym celu należy wpisać w pasku adresu IP płyty Intel Galileo (dostęp w sieci lokalnej) i określić numer portu (domyślnie 8080):
BTW. Proces budowy ze źródeł i konfiguracji MJPEG-Streamer jest identyczna w przypadku Raspberry Pi.