Published Book on Amazon
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1 | |
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2 |
출판된 한글판 도서
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상) | |
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하) |
Original Book Contents
22.1.4 Playing Video Contents
Here, we'll look at the tools that can be used to play videos on the Raspberry Pi system.
22.1.4.1 Playing Video Using <OMXplayer> Program
OMXPlayer is a program installed in Raspberry Pi system by default. It can play not only video files recorded with Raspberry Pi camera but also general videos in Raspberry Pi system.
[Command Format]
omxplayer [option] <file-name> |
[Command Overview]
■ This plays the video.
■ User privilege -- Normal user.
[Detail Description]
<OMXPlayer> is a very simple program developed for use with Raspberry Pi's XBMC. It can be used alone, but do not have much functionality.
[Main option]
--win ´x1 y1 x2 y2´ | Set position of video window |
|
|
[Used Example]
We will play the video using the file taken with Raspberry Pi camera. When the command is started, the video is played. When the playing is finished, the following message is displayed.
pi@raspberrypi ~/Image_Camera $ omxplayer test_motion1.h264 |
Video codec omx-h264 width 400 height 300 profile 100 fps 25.000000 Subtitle count: 0, state: off, index: 1, delay: 0 V:PortSettingsChanged: 400x300@25.00 interlace:0 deinterlace:0 anaglyph:0 par:1.00 layer:0 have a nice day 😉 |
Figure 22‑3 Playing video using <OMXplayer> program
22.1.4.2 Playing Video Using <Mplayer> Program
Among the programs that can play videos on Raspberry Pi system, <Mplayer> program is a popular program because it provides various functions.
The program supports video files of various formats, and it can use video files on the Internet as well as video file stored on its own system.
To use this program, you need to install it as follows.
sudo apt-get install mplayer |
If you execute the command, it checks installation of the program and confirms whether or not to install the program. If you choose "Continue", the actual installation begins as shown below.
pi@raspberrypi ~ $ sudo apt-get install mplayer |
Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: liblircclient0 liblzo2-2 libmpeg2-4 libxvmc1 Suggested packages: lirc mplayer-doc netselect fping The following NEW packages will be installed: liblircclient0 liblzo2-2 libmpeg2-4 libxvmc1 mplayer 0 upgraded, 5 newly installed, 0 to remove and 39 not upgraded. Need to get 2,700 kB of archives. After this operation, 4,967 kB of additional disk space will be used. Do you want to continue [Y/n]? y ~ ~ Skip ~ Setting up liblircclient0 (0.9.0~pre1-1) ... Setting up libmpeg2-4 (0.4.1-3) ... Setting up libxvmc1 (2:1.0.7-1+deb7u2) ... Setting up mplayer (2:1.0~rc4.dfsg1+svn34540-1+deb7u1) ... |
● Running < Mplayer> program
To play a video using <Mplayer> program, you can use the command in the format as follows.
[Command Format]
mplayer [option] <file> [file-specific option] |
mplayer [file | mms | http | rtp | ftp | udp | unsv | smb]://[user:pass@]URL[:port] [options] |
[Command Overview]
■ This plays a specified video.
■ User privilege -- Normal user.
[Detail Description]
<Mplayer> is a video playing program that runs on Linux. This program can play many types of video supporting their own binary codec such as MPEG/VOB, AVI, ASF/WMA/WMV, RM, QT/MOV/MP4, Ogg/OGM, MKV, VIVO, FLI, NuppelVideo, yuv4mpeg, FILM. You can watch videos in VCD, SVCD, DVD, Blu-ray, 3ivx, DivX 3/4/5, WMV, H.264 format. For reference, video recorded by Raspberry Pi camera are basically recorded in H.264 format.
[Main option]
-codecpath <dir> | Specify a directory for binary codecs. |
-profile <profile1,profile2,...> | Use the given profile(s), -profile help displays a list of the defined profiles. |
-quiet | Make console output less verbose; in particular, prevents the status line (i.e. A: 0.7 V: 0.6 A-V: 0.068 ...) from being displayed. Particularly useful on slow terminals or broken ones which do not prop‐erly handle carriage return (i.e. \r). |
-fps |
|
-cache |
|
[Used Example]
In the following example, We play a movie that has been taken with Raspberry Pi camera and converted to MKV format. When the command is started, the movie is played and when the playing is finished, the following message is displayed.
pi@raspberrypi ~/Image_Camera $ mplayer test_motion1.mkv |
MPlayer svn r34540 (Raspbian), built with gcc-4.6 (C) 2000-2012 MPlayer Team mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control. Playing test_motion1.mkv. ~ ~ Skip ~ Reverting to normal Xlib [swscaler @ 0x12c2380] No accelerated colorspace conversion found from yuv420p to bgra. [swscaler @ 0x12c2380] using unscaled yuv420p -> bgra special converter V: 0.0 0/ 0 ??% ??% ??,?% 0 0 Exiting... (End of file) |
Figure 22‑4 Playing video using <Mplayer> program