环境:
一,前期准备:
1,下载live555
可以下载最新的,我下载的版本是:live.2012.12.24.tar.gz
2,安装live555
root@microcreat:/workdir/private# ls
live555-latest.tar.gz
root@microcreat:/workdir/private# tar -zxvf live555-latest.tar.gz
root@microcreat:/workdir/private# ls
live
root@microcreat:/workdir/private/live# ls
BasicUsageEnvironment
config.aix
config.alpha
config.armeb-uclibc
config.armlinux
config.avr32-linux
config.bfin-linux-uclibc
config.bfin-uclinux
config.bsplinux
config.cris-axis-linux-gnu
config.cygwin
config.cygwin-for-vlc
root@microcreat:/workdir/private/live# ./genMakefiles linux
root@microcreat:/workdir/private/live#
这样就编译完成了。
3,安装SMplayer
sudo add-apt-repository ppa:rvm/smplayer
sudo apt-get update
sudo apt-get install smplayer smtube smplayer-themes
注:如果下面的错误:
root@microcreat:/workdir/private# sudo apt-get install smplayer smtube smplayer-themes
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/cn.archive.ubuntu.com_ubuntu_dists_natty_restricted_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.
解决方法是:
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update
这样SMplayer就安装OK了。
可以用"Applications -> Sound & Video -> MPlayer Movie Player"来运行mplayer。
二,用本机搭建RTSP服务器
2.1其实很简单,就是利用刚刚编译成功的live555的源码。
root@microcreat:/workdir/private/live/mediaServer# pwd
/workdir/private/live/mediaServer
root@microcreat:/workdir/private/live/mediaServer# ls
COPYING
DynamicRTSPServer.cpp
在此项目中放入一个in.264的文件,然后启动服务器:
root@microcreat:/workdir/private/live/mediaServer# ./live555MediaServer
LIVE555 Media Server
Play streams from this server using the URL
where <filename> is a file present in the current directory.
Each file's type is inferred from its name suffix:
See http://www.live555.com/mediaServer/ for additional documentation.
(We use port 8000 for optional RTSP-over-HTTP tunneling, or for HTTP live streaming (for indexed Transport Stream files only).)
2.2 另外开一个终端:来启动SMplayer
root@microcreat:~# mplayer rtsp://192.168.196.128:8554/in.264
mplayer: Symbol `ff_codec_bmp_tags' has different size in shared object, consider re-linking
MPlayer 1.0rc4-4.5.2 (C) 2000-2010 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 rtsp://192.168.196.128:8554/in.264.
Resolving 192.168.196.128 for AF_INET6...
Couldn't resolve name for AF_INET6: 192.168.196.128
Connecting to server 192.168.196.128[192.168.196.128]: 8554...
rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://192.168.196.128:8554/in.264
Stream not seekable!
Initiated "video/H264" RTP subsession on port 48870
demux_rtp: Guessed the video frame rate as 30 frames-per-second.
VIDEO:
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] This driver only supports the 3Dfx Banshee, Voodoo3 and Voodoo 5.
[VO_3DFX] Unable to open /dev/3dfx.
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Audio: no sound
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 160x128 => 160x128 Planar YV12
V:
Exiting... (Quit)
这样rtsp服务器就搭建完成!