[Set] uses red5 and FFMPEG to build an online flash streaming media Sharing Platform

Source: Internet
Author: User
Tags imagemagick
ArticleDirectory
    • Use red5 and FFMPEG to build an online flash streaming media Sharing Platform
    • Red5 simple installation guide howto
Use red5 and FFMPEG to build an online flash streaming media Sharing Platform

Recently, videos are quite popular. I also learned a little about the solution for creating an online flash streaming media playing platform using open-source software a few days ago. There are still some gains.

Red5 is a Java-based open-source flash Streaming Media Server software that can be used as a replacement for Macromedia's commercial version of FMS. Red5 uses RSTP as the streaming media transmission protocol and has some built-in examples. These examples provide some basic functions such as online recording, flash streaming media playback, online chat, and video conferencing. Because the system itself is open-source, it is easier to solve problems when encountering problems.CodeIn terms of cost, you can save a lot of money and provide sufficient space for future function expansion.

If you only implement online recording and online playback, red5 will be enough, but sometimes we need users to upload their own video files, to convert these video files into playable FLV files, you need the video encoding software. FFmpeg provides a complete solution for recording, playing, and video stream processing. It also carries an HTTP-based streaming media broadcast.ProgramThere are several other practical programs, but our focus is on its video conversion program. It seems that googlevideo also uses its program as a video Conversion Tool.

I switched a few videos with FFMPEG, and the effect was still good. I encountered some problems in the sound. without adding parameters, some videos may have sound problems, some videos generate sound no matter how they are added. The error message is that the audio sampling format is not supported, and only several fixed formats are supported. I have read the code, this is indeed the case, but it should be resolved theoretically. Libavcodec provided by FFmpeg is a set of excellent encoding libraries. To ensure quality and performance, many of the libraries are developed from scratch.

These two functions add up to achieve some simple online video functions.


Red5-download from Hello world!

Original d5power studio. For more information, see the source ~ Thank you!

Red5's Chinese documents are as scarce as Ox Hair .. It takes more than one day to complete the download and complete debugging. In this case, I will list the problems that have occurred in the Middle and hope to help my friends who want to study red5.

Required software:
Red5 0.6 RC2: http://osflash.org/red5
Eclipse 3.2: http://www.eclipse.org
Ant: http://ant.apache.org/
JDK: http://java.sun.com/javase/downloads/index.jsp
If you want to get the latest red5 directly through SVN, you also need to install eclipse SVN plug-in: http://subclipse.tigris.org/

Haha, are there enough stuff to install? Briefly describe the use of each software. If you download red5 directly from SVN, the files running in win are not available here, So Ant server is required for compilation and running. A friend who downloads the installation package does not need to use ant to compile the package. (However, if you do the development, it is recommended that you drag it down for a relatively small value of 10 MB ). Eclipse is a required tool for red5 server development, and JDK is a necessary environment for red5 running.

Here, I will take the svn download version as an example to introduce the configuration.

First, use the svn plug-in eclipse (there is a small plus icon in the upper right corner-> Other-> svn xxx) to get the latest code from the red5 official website (I spent at least two hours, the United States is far from China ...) The SVN address is on the official red5 website. When I download the svn address, it is timed out, and I will not talk about it if I select the target path ..

After downloading, You need to specify the red5 Build File for Eclipse, right-click the file on the top of the list on the left, and select external tools (Green play icon on the toolbar, the one with the red lock ..), Select the ant icon (ANT) on the left, right click-> creat, enter the file name server_all, click the Browse button on the first line, and select build in the pop-up window. XML, OK. Select the target tag, select all in the following options, select the row, and apply. operate again, create server_server, and select build. XML, then uncheck all in target, select server, select the row, and click Apply.

Run server_all at this time. I have encountered an error here (see the previous log for details). The solution is to change the Java version in build. properti to be consistent with the actual JDK version of the local machine. Others reported other errors to modify build. XML, But I didn't encounter this problem (see http://hi.baidu.com/flash%5Fzb/blog/item/412384230961d444ac34ded5.html ).

When you see build success, congratulations, the compilation is successful.

OK. Now you can create the first application. To save trouble, go to red5's webapps and copy test directly to the demo, then delete the files except the WEB-INF, and then into the WEB-INF, clear the SRC and class folders, delete the other folders except the two folders (if any ), now it is finally cleared. In eclipse, set the work zone to webapps in red5, and create a new project named demo, at this time, you will find that the content in the demo folder has been displayed on the left :) right-click SRC, buildpath-> use as source folder, and specify it as a code folder, right-click the project demo and select Properties, select Java bulid path, select the source tag, and select the class directory in the Browse below to specify it as the target directory. Delete the automatically generated bin directory on the left. OK!

To compile the red5 program, we need to import the red5 package into the current project. Right-click the project name, select Properties, select libraries in Java build path, and click Add external jers to include red5.jar in red5 into the project. Then, you can follow the guidance file provided by red5 to create the first red5 program!


Today, the company needs to install a red5 server to develop programs. I found that red5 0.6 has been officially released. I used to write an article about using SVN for extraction and then creating a red5 project. Generally, developers do not need to modify red5 programs, but only need to build their own applications. Now we will record the establishment process and hope to help you. This article is suitable for users who first came into contact with red5 (under the win platform) and did not know how to start building their own applications.

Process:

1. download the latest version of red5http: // osflash.org/red5

2. Install red5. Install jre before installing red5. You must specify the JRE directory when installing red5.

3. go to the red5 installation directory and find the DOC/templates Directory, which stores a standard red5 Application Template MyApp and copies it to the webapps directory in the red5 installation directory, and rename it your favorite folder name. For example, if you want to develop a chat program, you can change MyApp to mychat. This name is the name of the service to be connected later.

4. Create a new folder in the WEB-INF SRC to store the programSource codeCreate a new classes folder to store the compiled files.

5. open eclipse, specify the workspace as webapps under the red5 installation directory, and create a new project named mychat. at this time, you should find that all the files in mychat have been loaded in. First, we should specify the src directory as the source code directory, right-click and select SRC, select build path-> use as sourcefolder in the pop-up menu to specify it as a code folder. Next, specify the target directory of the Project, right-click the project name, select Properties, select Java bulid path, select the source tag, and select the class directory in the following browse, specify it as the target directory. Select libraries and click Add external jars to include red5.jar in the red5 installation directory.

6. At this time, there should be a WEB-INF/src on the left side of eclipse, and we will start writing our first project code here. Right-click it and choose new> package from the shortcut menu to create a new package. For example, the package name can be Org. d5.first, and then in the generated Org. right-click the d5.first package and choose new> file, and enter the file name application. java. Enter the following code in the created file:

Package org. d5.first;

Import org. red5.server. Adapter. applicationadapter;

Public class application extends applicationadapter {

Public String login (){
Return "Welcome to chat servers ";
}

}

7. Configure. Edit the WEB-INF under the red5-web.xml and find the bean id = "Web. handler, change the xxx position in class = "XXX" to Org. d5.first. application. Delete the bean id = "server. Handler... The whole sentence, because we cannot use this stuff for the moment. Edit web. XML, find webapprootkey, and change the value in the param-value label to/mychat. Edit the red5-web.properties and change the first sentence to webapp. contextpath =/mychat

8. compile the project

9. Restart the red5 Server

10. Create a new file in flash and enter the following code:

NC = new netconnection ();
NC. Connect ("rtmp: // localhost/mychat ");

NC. onresult = function (OBJ ){
Trace (OBJ );
}
NC. Call ("login", NC );

 

Run the program and the result is welcome to chat servers. The first red5 application was born, haha :)

 


Red5 simple installation guide howto

Red5 is an open-source flash server. It costs a lot of money compared to the cost of a lic of $4500 in the FMS. Today, we will test and install red5.

1. Configure the Java environment
Download the latest JDK from the sun website 1.5.0 _ 07. If you do not need to install the SDK, unzip it to the/usr/Java/jdk1.5.0 _ 07 directory.

Add the following statements in/etc/profile:
Export Path = $ path:/usr/Java/JDK 1.5.0 _ 07/bin:/usr/Java/jdk1.5.0 _ 07/JRE/bin
Export java_home =/usr/Java/jdk1.5.0 _ 07
Exportclasspath = "./:/usr/Java/jdk1.5.0 _ 07/lib:/usr/Java/jdk1.5.0 _ 07/JRE/lib"
Exportld_library_path =/usr/Java/jdk1.5.0 _ 07/JRE/lib/i386:/usr/Java/jdk1.5.0 _ 07/JRE/lib/i386/Server

Note that the default as4 may come with Java and the built-in ones are deleted first !!

2. Install Apche-ant
Download the latest version from the Apache website. The installation method is similar to JDK. decompress the package to the/usr/local/ant directory.

Add the following statements in/etc/profile:
Export ant_home =/usr/local/ant
Export Path = $ path:/usr/local/ANT/bin

Source/etc/profile for configuration to take effect

3. Install red5

You can use SVN to download the latest version.

SVN Co http://svn1.cvsdude.com/osflash/red5/java/server/tags/0_5/red5

CD red5

Compile: Enter the ant command to automatically compile

Run
./Red5.sh &

4. simple configuration, using demo
Configure the port: CONF/red5.properties. Modify the file.

Accessing http: // ip: 5080

You can run the self-built demo. Remember that if you have configured an IP address, the address localhost in the self-built demo must be replaced with your real address.

Example of online recording:
Http://www.acmewebworks.com/red5/videos/SimpleStreamRecording.html

Example of online playback:
Http://www.acmewebworks.com/red5/videos/SimpleLiveBroadcast.html

Example:
Http://www.acmewebworks.com/OSProjects/mtasc/videos/BallControl.html


Open-Source Video Conferencing System openmeetings-Installation

Openmeetings is an open-source video conferencing software. It is based on openlaszlo's new streaming media format and open-source flash server --- red5!

This document describes how to install openmeetings in the latest version of openmeetings05beta5. For official installation instructions for this version, see http://code.google.com/p/openmeetings/wiki/installationof05rc5beta5. The installation instructions are in English. Official installation provides installation methods based on a variety of databases and different operating systems. The following uses MySQL database and Windows 2003 Server as an example to describe the entire installation process.

1. download the latest version of openmeetingsfrom http://code.google.com/p/openmeetings/downloads/list( openmeetings05beta5 is the latest version ).

2. Install the MySQL database. I installed mysql- 5.0.41 -For Win32, create an empty database named xmlcrm after installation.

3. install Open-office-service. I installed OpenOffice. org2.2.

A. After the installation is complete, open "start"> "program"> "OpenOffice.org ". 2.2" -> OpenOffice.org base (if it is run for the first time, you need to register and configure it, enter the registration information, and do not configure the database)

B. After running the software, click "start"> "run"> cmd to enter the "command prompt ";

C. Enter the program directory under the OpenOffice installation directory, for example, c: \ Program Files \ OpenOffice. org2.2 \ Program

D. run the following command to run OpenOffice on port 8100 in manual mode: soffice.exe-Headless-nologo-norestore-accept = socket, host = localhost, Port = 8100; URP; StarOffice. servicemanager

E. Enter the following command to check whether the service is running properly: netstat-anptcp

F. Click "enter" and a list will appear. If the list contains the following line, the configuration is successful: TCP 127.0.0.1: 8100 0.0.0 . 0: 0 listening

4. Install "ImageMagick". I installed ImageMagick- 6.3.6 -1-q16-windows-dll

5. Install ghostscript. I installed ghostscript 8.51

6. Install swftools. I installed swftools- 0.8.1

7. Install JRE. I installed JRE. 1.5.0

8. Install red5 server. I installed red5- 0.6.3 Http://dl.fancycode.com/red5/0.6.3/win/setup-red5-0.6.3.exe

9. decompress the openmeetings package and put the xmlcrm folder to the $ RED5-HOME/webapps/directory. So now $ red5-home/webapps/xmlcrm/is the main directory of the video conferencing system ($ RED5-HOME represents the red5 installation directory, next we represent the main directory of the Video Conferencing System with $ OPENMEETINGS-HOME)

10. Go to the $ OPENMEETINGS-HOME/Install Folder, find the file mysql_hibernate.cfg.xml, rename it hibernate. cfg. XML, open it, modify the following statement:

<Property name = "connection. username"> root </property>

<Propertyname = "connection. Password"> </property>

<Propertyname = "connection. url"> JDBC: mysql: // localhost: 3306/xmlcrm </property>

11. Restart red5 and open the browser. The screen shown in Figure 1 appears. Click "continue with step ". 1" , The image in Figure 2 is displayed;

12. after entering all the information in Figure 2, click "senden" and wait for a few minutes (because the installation process is to be executed at this time, you need to create many tables in the database, you can find the red5.log file in the $ red5-home/log directory to check the installation record to see if the installation process is normal). If the last figure shown in Figure 3 appears, the installation is successful, click "Enter the application" to enter the system.

 

Figure 1

 

Figure 2

 

Figure 3


 

About red5 --Open-source flashStreaming Media Server red5Introduction

Before introducing red5, it is necessary to introduce Flash Media Server first.

Flash Media Server (hereinafter referred to as FMS), also known as Flash Communication Server (FCS), is a member of the flash family and is known as the current development of Web audio and video applications (for example, video chat rooms, video conferencing systems, podcast systems, audio and video messages, etc.) the most convenient and quick solution. It is also widely used in Web application development. Of course, the excellent functions of FMS are not provided to the majority of users free of charge. The price of $4000 per point is prohibitive for many developers. As a result, the open-source red5 has become a new favorite of people.

Red5 is an open-source flash streaming media server developed using Java, which features similar to FMS. It supports: Converting audio (mp3) and video (FLV) into playing streams; recording client playback streams (only FLV); Sharing objects; releasing live streams; remote calls.

Red5 uses RSTP as the streaming media transmission protocol. In some of its examples, it demonstrates some basic functions such as online recording, flash streaming media playback, online chat, and video conferencing.

The official red5 website is http://osflash.org/red5, which is currently under development. 0.6.3 Its final official version is 1.0. The red5 R & D process has been listed on the official website: http://osflash.org/red5/roadmap.

The following describes several red5 websites:

Openred5 Chinese Open SourceCommunity:

Http://www.openred5.cpm/bbs/index.php

A blog of red5 learners:

Http://blog.tianya.cn/blogger/view_blog.asp? Blogname = weitiger

Fifth motivation:

Http://www.d5power.com/thread.php? FID = 20

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.