티스토리 뷰
728x90
Orange PI PC2 mjpg-streamer
출처 : 【BPI-M2+】之mjpg-streamer测试和体验- Bananap讨论区- 烽火社区 ...
MJPG-Streamer › Wiki › ubuntuusers.de
라즈베리파이에서 웹캠 mjpg-streamer 따라하기|작성자 서리
mjpg-streamer 웹캠 영상 스트리밍 | Mungrrr
관련 라이브러리 설치
$ sudo apt-get install libjpeg8-dev libv4l-dev subversion $ sudo apt-get install imagemagick
mjpg-streamer 컴파일 및 설치
출처 : http://www.lavrsen.dk/svn/motion/tags/3.2.9/picture.c
$ svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer mjpg-streamer $ cd mjpg-streamer $ make USE_LIBV4L2=true clean all $ sudo make install install --mode=755 mjpg_streamer /usr/local/bin install --mode=644 input_ov5640.so input_gc2035.so input_uvc.so output_file.so output_udp.so output_http.so input_testpicture.so input_file.so /usr/local/lib/ install --mode=755 -d /usr/local/www install --mode=644 -D www/* /usr/local/www
input_gc2035.so
mjpg-streamer의 input_uvc.so는 YUV만 지원하고, Orange PI PC2의 카메라인 GC2035는 YUV420코덱만 지원하기 때문에, mjpg-streamer에서 사용 할 수 없습니다.
제가 작업한 GC2035의 YUV420코덱을 지원하는 so 파일을 공개 합니다.
Orange PI PC2의 카메라인 GC2035를 사용해서 mjpg-streamer로 스트리밍 하시려면 첨부한 파일을 사용하세요.
LD_LIBRARY_PATH 경로 추가
$ echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib/mjpg-streamer" | sudo tee -a /etc/profile
mjpg-streamer 실행
$ ./mjpg_streamer -i "./input_gc2035.so -y -n" -o "./output_http.so -w ./www" MJPG Streamer Version: svn rev: 3:172M i: Using V4L2 device.: /dev/video0 i: Desired Resolution: 640 x 480 i: Frames Per Second.: 5 i: Format............: YUV420 i: JPEG Quality......: 80 o: www-folder-path...: ./www/ o: HTTP TCP port.....: 8080 o: username:password.: disabled o: commands..........: enabled
서비스등록
$ sudo vi /etc/init.d/mjpg_streamer
mjpg_streamer 파일 내용
#! /bin/bash # /etc/init.d/mjpg_streamer.sh # v0.2 phillips321.co.uk ### BEGIN INIT INFO # Provides: mjpg_streamer.sh # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: mjpg_streamer for webcam # Description: Streams /dev/video0 to http://IP/?action=stream ### END INIT INFO # export width=640 export height=480 export fps=24 export SHUTDOWN_WAIT=2 export QUALITY=75 if [ -n "$2" ]; then width=$2 fi if [ -n "$3" ]; then height=$3 fi if [ -n "$4" ]; then fps=$4 fi export LD_MJPG_STREAMER=/usr/local/lib f_message(){ echo "[+] $1" } mjpg_streamer_pid() { echo `ps aux | grep input_gc2035 | grep -v grep | awk '{ print $2 }'` } start() { pid=$(mjpg_streamer_pid) if [ -n "$pid" ] then echo "mjpg_streamer is already running (pid: $pid)" else # Start mjpg_streamer f_message "Starting mjpg_streamer" mjpg_streamer -b -i "$LD_MJPG_STREAMER/input_gc2035.so -r "$width"x"$height" -f $fps -q $QUALITY -y" -o "$LD_MJPG_STREAMER/output_http.so -p 8080 -w /usr/local/www" sleep 2 f_message "mjpg_streamer started" fi return 0 } stop() { pid=$(mjpg_streamer_pid) if [ -n "$pid" ] then f_message "Stopping mjpg_streamer... (pid: $pid)" kill -9 $pid let kwait=$SHUTDOWN_WAIT let count=0; until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ] do echo -n -e "\nwaiting for processes to exit\n"; sleep 1 let count=$count+1; done if [ $count -gt $kwait ]; then echo -n -e "\nkilling processes which didn't stop after $SHUTDOWN_WAIT seconds\n" kill -9 $pid fi else echo "mjpg_streamer is not running" fi return 0 } # Carry out specific functions when asked to by the system case "$1" in start) start ;; stop) stop ;; restart) stop sleep 2 start ;; resolution) resolution=`ps axu | grep input_gc2035 | grep -v grep | awk '{ print $16 }'` currfps=`ps axu | grep input_gc2035 | grep -v grep | awk '{ print $18 }'` if [ -n "$resolution" ]; then echo "${resolution}"x"$currfps" else echo "0x0x0" fi ;; status) pid=`ps -A | grep mjpg_streamer | grep -v "grep" | grep -v mjpg_streamer. | awk '{print $1}' | head -n 1` if [ -n "$pid" ]; then f_message "mjpg_streamer is running with pid ${pid}" f_message "mjpg_streamer was started with the following command line" cat /proc/${pid}/cmdline ; echo "" else f_message "Could not find mjpg_streamer running" fi ;; *) f_message "Usage: $0 {start|stop|status|restart}" exit 1 ;; esac exit 0
등록
$ sudo chmod u+x /etc/init.d/mjpg_streamer $ sudo update-rc.d mjpg_streamer defaults
서비스 실행 및 실행 확인
$ sudo service mjpg_streamer start $ sudo service mjpg_streamer status ● mjpg_streamer.service - LSB: mjpg_streamer for webcam Loaded: loaded (/etc/init.d/mjpg_streamer; bad; vendor preset: enabled) Active: active (running) since Wed 2017-03-15 05:05:09 UTC; 4s ago Docs: man:systemd-sysv-generator(8) Process: 8045 ExecStop=/etc/init.d/mjpg_streamer stop (code=exited, status=0/SUCCESS) Process: 8113 ExecStart=/etc/init.d/mjpg_streamer start (code=exited, status=0/SUCCESS) CGroup: /system.slice/mjpg_streamer.service └─8122 mjpg_streamer -b -i /usr/local/lib/input_gc2035.so -r 640x480 -f 24 -q 75 -y -o /usr/local/lib/output_htt Mar 15 05:05:07 Orangepi mjpg_streamer[8122]: MJPG-streamer [8122]: Format............: YUV420 Mar 15 05:05:07 Orangepi mjpg_streamer[8122]: MJPG-streamer [8122]: JPEG Quality......: 75 Mar 15 05:05:08 Orangepi mjpg_streamer[8122]: MJPG-streamer [8122]: www-folder-path...: /usr/local/www/ Mar 15 05:05:08 Orangepi mjpg_streamer[8122]: MJPG-streamer [8122]: HTTP TCP port.....: 8080 Mar 15 05:05:08 Orangepi mjpg_streamer[8122]: MJPG-streamer [8122]: username:password.: disabled Mar 15 05:05:08 Orangepi mjpg_streamer[8122]: MJPG-streamer [8122]: commands..........: enabled Mar 15 05:05:08 Orangepi mjpg_streamer[8122]: MJPG-streamer [8122]: starting input plugin /usr/local/lib/input_gc2035.so Mar 15 05:05:08 Orangepi mjpg_streamer[8122]: MJPG-streamer [8122]: starting output plugin: /usr/local/lib/output_http.so ( Mar 15 05:05:09 Orangepi mjpg_streamer[8113]: [+] mjpg_streamer started Mar 15 05:05:09 Orangepi systemd[1]: Started LSB: mjpg_streamer for webcam.
실행
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- NDK
- Spring
- Delphi
- flex
- MySQL
- koba2010
- Delphi Tip
- 동경
- android
- 레이싱모델 익스트림 포토 페스티벌
- Linux
- Java
- ubuntu
- sas2009
- JavaScript
- SAS
- ffmpeg
- Spring MVC
- 송주경
- Mac
- 서울오토살롱
- 튜닝쇼 2008
- oracle
- 전예희
- ble
- BPI-M4
- 일본여행
- 지스타2007
- Xcode
- KOBA
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함