Recently, due to a company's Android project, we need to upload a video to the server to enable upload, download, and play. This involves playing streaming media videos on the mobile terminal of the video. Therefore, I am working with a Darwin Streaming Media Server, this article also references:
Baidu Library: Baidu? MoD = Space & uid = 74824 & Do = Blog & id = 3491,
Http://www.cnblogs.com/zhangweia/archive/2010/08/27/1810030.html
A. First install DDS, that is, the Darwin Streaming Media Server:
1. Download DSS for Windows from: http://dss.macosforge.org/downloads/DarwinStreamingSrvr5.5.5-Windows.exe (5.5 only)
2. decompress the package and you will see an install. BAT files, run it directly and install it to c: \ Program Files \ Darwin Streaming Server \, and add a service program named Darwin Streaming Server in the system service, this is the RTSP server of DSS.
3. Next you will install the perl interpreter, which can be downloaded from the http://www.perl.org/get.html and then installed
4. After Perl is installed, run the program using Perl **. pl in cmd.
5. perform the following operations in cmd:
O # create a WebAdmin account and password as prompted
OC: \ Program Files \ Darwin Streaming Server> Perl winpasswdassistant. pl
O # Run the WebAdmin Manager
OC: \ Program Files \ Darwin Streaming Server> Perl streamingadminserver. pl
O # Now you can open http: // 127.0.0.1: 1220/to manage the DSS server.
6. modify general settings-> media directory in DSS WebAdmin to change it to your media directory. You can also use the default one to put your own video file in C: \ Program Files \ Darwin Streaming Server \ movies
7. Now you can use quicktime or VLC to open rtsp: // 127.0.0.1: 80/sample_100kbit.mp4 to test the video. (Note that sample_100kbit.mp4 is the video that comes with DSS 5.5.5)
B. Convert your video to streaming media format
I can't play the video. I am in a hurry. I checked a lot on the Internet and didn't find any explanation. Later I thought about whether the video encoding is different, later, I used the video encoding viewer to compare it and found that there was no difference. Finally, I found the third Reference URL that explains that the Streaming Media Server only recognizes videos containing the RTSP information header, the RTSP information must be added to the video header before being recognized by DSS. Therefore, you need to use tools to convert your video
Use mp4box.exe to convert the video format of the rtspinformation Header
After downloading to the decompressed file, there will be mp4box.exe, which is used to run the command line
C: \ Program Files \ Darwin Streaming Server \ movies> mp4box mymovie.mp4-hint
Result:
Hinting file with Path-MTU 1450 bytes
Hinting track ID 201-type "mp4v: mp4v" (MP4V-ES)-BW 33 kbps
Hinting track ID 101-type "mp4a: mp4a" (mpeg4-generic)-BW 64 Kbps
Saving mymovie.mp4: 0.500 secs interleaving
Then, use kmplayer.exe to enable rtsp: // 127.0.0.1: 80/test.mp4! You can use your smartphone to open this address.
In Java code, you can directly use the code to call mp4box.exe for conversion. You need to directly put the mp4box. Ex tool file in the video directory of the Streaming Media Server. The conversion code is as follows:
/**
* Convert to RTSP video
*
* @ Param filename
*/
Public void changetortsp (string filename ){
Runtime Rn = runtime. getruntime ();
PROCESS p = NULL;
Try {
P = rn.exe C ("d :\\ Tomcat \ webapps \ vmadmin \ vedios \ mp4box.exe D: \ Tomcat \ webapps \ vmadmin \ vedios \ "+ filename +"-hint ");
Bufferedreader = new bufferedreader (
New inputstreamreader (P. getinputstream ()));
String STR;
While (STR = bufferedreader. Readline ())! = NULL)
System. Out. println (STR );
Int result = P. waitfor ();
System. Out. println ("thread run result ------------------:"
+ Result );
} Catch (exception e ){
System. Out. println ("error exec Notepad ");
}
Finally {
P. Destroy ();
}
}
Filename is the name of the file in the video directory of the Streaming Media Server. After conversion, you can use the mobile phone terminal to call the System Video Player and enter: rtsp: // 127.0.0.1: 80 /****. mp4.