IT/라즈베리파이2

Omxplayer를 웹브라우저(Web GUI)를 통해 원격 조정

단디1969 2015. 7. 4. 22:26

2015/7/4 현재

영화가 아니라 조그마한 영상을 확인하거나 할 때 일일이 kodi(xbmc)를 실행하기는 귀찮고 할 때,

라즈베리파이에서 H/W가속이 가능한 유일한?! 미디어 플레이어인 omxplayer가 좋긴 좋으나

콘솔에서 사용하는 Omxplayer는 GUI에 익숙한 나같은 사람들에게는 사용하기가 엄청 번거롭다.

이를 웹브라우저(Web GUI)를 통해 원격(네트워크에 연결된 PC, 스마트폰 등등으로) 조정할 수 있는 방법이 있다.


원문 : Simple Web GUI for Omxplayer on a Raspberry Pi made in PHP


1. PHP로 만든 Web GUI를 /home/pi/로 저장, 설치한다.


- 파일유무 확인

 pi@raspberrypi ~ $ ls

Desktop       kodi-15.tar.gz

Downloads    kodi_crashlog-20150625_173324.log

PepperFlash-12.0.0.77-armv7h.tar.gz

omxwebgui-master.zip  ........................


- 압축을 푼다.

pi@raspberrypi ~ $ unzip omxwebgui-master.zip

Archive:  omxwebgui-master.zip

a596f5e1c2e9f98b5f0a3deaf5a577c2c16807a5

creating: omxwebgui-master/

extracting: omxwebgui-master/.gitignore

.

.

.

.

extracting: omxwebgui-master/tmp/.gitignore


- 폴더를 권한을 조정한다. 아무나 읽고 쓸 수 있도록 777

pi@raspberrypi ~ $ sudo chmod 777 omxwebgui-master

pi@raspberrypi ~ $ sudo chmod 777 omxwebgui-master/tmp


2. php5-cli을 설치

pi@raspberrypi ~ $ sudo apt-get install php5-cli


3. 서버 실행 : Port 4321에 대기하는 php webserver를 구동하려면 다음과 같이 한다.(port 번호는 변경가능)

pi@raspberrypi ~ $ sudo php -S 0.0.0.0:4321 -t /home/pi/omxwebgui-master/> /dev/null 2>&1 &


4. 클라이언트 실행

- PC나 스마트폰의 웹브라우저에서 주소창에 http://192.168.1.4:4321 을 입력한다. (자신의 라즈베리파이에 맞는 IP를 넣는다.)

- 아래와 같이 나온다.


- 상단의 회색 사각형 창에 미디어파일이 있는 폴더 경로를 적어주고 SAVE 누른 다음 "F5"로 새로고침 해준다.

- 폴더의 경로에 미디어 파일이 있으면 에러가 나지 않고 같은 화면을 보여 준다.

- 중간의 회색사각창(Status : No video selected)을 클릭하면 폴더에 들어있는 비디오 파일이 주루룩 나온다.


- 원하는 파일을 선택하면 라즈베리파이에 접속된 모니터에 전체화면으로 재생된다.

- 핑크버튼을 이용하여 재생 조정하면 된다. 


5. 부팅시 자동실행 : crontab으로 자동실행(도스의 autoexec.bat화 비슷한 것 같음)

pi@raspberrypi ~ $ sudo crontab -e


# Edit this file to introduce tasks to be run by cron.

#

# Each task to run has to be defined through a single line

# indicating with different fields when the task will be run

# and what command to run for the task

#

# To define the time you can provide concrete values for

# minute (m), hour (h), day of month (dom), month (mon),

# and day of week (dow) or use '*' in these fields (for 'any').#

# Notice that tasks will be started based on the cron's system

# daemon's notion of time and timezones.

#

# Output of the crontab jobs (including errors) is sent through

# email to the user the crontab file belongs to (unless redirected).

#

# For example, you can run a backup of all your user accounts

# at 5 a.m every week with:

# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/

#

# For more information see the manual pages of crontab(5) and cron(8)

#

# m h  dom mon dow   command

@reboot sudo php -S 0.0.0.0:4321 -t /home/pi/omxwebgui-master/> /dev/null 2>&1 &




'IT > 라즈베리파이2' 카테고리의 다른 글

시간 동기화 ntp  (0) 2015.07.05
오래된 파일 자동 지우기(crontab)  (0) 2015.07.05
CCTV 관련 링크들  (0) 2015.06.30
라즈비안 기본 명령어 설명  (0) 2015.06.26
kodi(osmc)에서 화면 꽉차게 영화보기  (0) 2015.06.26