http://blog.csdn.net/huangtaishuai/article/details/9836581
This article explains how to build a live streaming media server with VLC as the core in the CentOS 6 server (no graphical interface).
The first step is to install a third-party yum source. because the official Yum source does not contain VLC installation packages, in order to not consider the dependencies between the installation package, using the Yum installation of the third party Yum source, can greatly simplify the installation process of VLC, will focus on how to use VLC function to build a streaming media server.
(If you do not want to use Yum installation, please login to VLC's official website, download the binary installation package or source code reference official documentation for installation, this is no longer described here.) )
1, download Rpmforge well-known third-party source RPM installation package (64-bit system please download rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm)
- wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
2. Import GPG Key
- RPM--import Http://apt.sw.be/RPM-GPG-KEY.dag.txt
3. Install RPM installation Package
- Rpm-i rpmforge-release-0.5.2-2.el6.rf.i686.rpm
4. Update the installation source
- Yum Check-update
5. Installing VLC
- Yum Install VLC
For more detailed information, please visit: http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
The second step is to build a live Streaming server using VLC. (On-demand there is nothing to talk about, to build an HTTP server can, and VLC is not much of a relationship, but can be the media files first with VLC transcoding into streaming media format, and then placed in the HTTP server)
"UDP mode"
Grammar:
VLC input_stream--sout ' #std {access=udp{ttl=1},mux=ts,dst=dest_ip:dest_port} '
Example:(assuming that there is media file pikesi.mkv in the server directory, the IP of the playback client is 192.168.1.77)
- Vlc-i "Dummy"-l--no-inhibit pikesi.mkv--sout ' #std {access=udp{ttl=1},mux=ts,dst=192.168.1.77:1234} '
Description
Open the VLC player on the IP-192.168.1.77 client, select "Turn on network streaming" and enter url,udp://@:1234/to play.
-I "dummy" means that no local playback or control interface is used, because there is no graphical interface to play locally.
-L indicates a loop, and the loop plays back when the media file has finished playing.
The--no-inhibit indicates that power control is disabled. This is the desktop environment feature, which is turned on by default, and if not forced to close, will cause communication with D-bus to fail and VLC cannot start.
UDP pushes a stream in a way that can only be streamed to a specified address in a unicast or multicast manner, without a client request. (HTTP will listen for user requests and push streams according to the requested user point-to-point)
"HTTP Mode"
Grammar:
VLC input_stream--sout ' #http {mux=ts,dst=:listen_port} '
Or
VLC input_stream--sout ' #std {access=http{user=username,pwd=password},mux=ts,dst=:listen_port} '
Example:
- Vlc-i "Dummy"-l--no-inhibit pikesi.mkv--sout ' #std {access=http{user=k3,pwd=k3},mux=ts,dst=:6000/live.ts} '
Description:(assuming the server IP address is 192.168.1.6)
The client player opens Url,http://k3:[email protected]:6000/live.ts to play.
If {USER=K3,PWD=K3} is removed from the server startup code, HTTP authentication is not required when the client plays.
"Transcoding"
The media file may not be a streaming format by itself, and this requires transcoding and streaming. Example:
- Vlc-i "Dummy"-l--no-inhibit pikesi.mkv--sout ' #transcode {vcodec=h264,vb=800,fps=50,scale=1,acodec=mpga,ab=128, channels=2,samplerate=44100}:std{access=http,mux=ts,dst=:6000} '
In the actual test found a problem, under Linux to RMVB transcoding will not sound (Windwos under normal). It is possible that the Linux version of VLC could not decode the Realplay Cook Audio format (there is time to install a desktop Linux environment for verification, and some feature options are said to be turned on when compiling FFMpeg).
"HTTP streaming for UDP stream input"
The input stream is not necessarily a file, it can also be a network stream, such as the preceding UDP stream.
For example, first push the UDP stream toward local port 1234:
- VLC pikesi.mkv-i "dummy"-l--no-inhibit--sout ' #std {access=udp{ttl=1},mux=ts,dst=localhost:1234} '
Then, change the Input_stream to the network address for HTTP streaming:
- Vlc-i "Dummy"--no-inhibit udp://@:1234--sout ' #std {access=http,mux=ts,dst=localhost:6000} '
Finally, the client references "HTTP mode" to play streaming media.
====================================
Precautions:
1, notice the firewall to release the corresponding port.
2. Do not reuse ports. Each HTTP mode of streaming must use a separate port.
3, VLC can not be run with the root user, if the setting boot from the boot, you may use this method in the configuration file: (assuming there is a user name Sowell)
Su sowell-c "VLC ... &"
Build a streaming media server under Linux