Cleverpig said: "In fact, feel that you can write a set of streaming media specifications, such as the source file designated as WAV format or other RAW format, and then sent to mobile."
But doing so is inefficient and a waste of bandwidth. I studied tea Vui Huang MobileCast realize some of the experience, here to discuss with you:
1. Use MMS to send radiocast: Because MMS service can use the multimedia element such as picture, music and so on, and the technology is more mature, so it is convenient to choose it as the carrier of Radiocast. For mobile users, the use of cast can be used to request and subscribe to two kinds of models;
2. Radio file Format selection: For some mobile phones can not support MP3 format files, even if the support MP3 is limited by the memory size, so the more common, more compression than the AMR format is a better choice;
3. AMR file Segmentation: Because most mobile phones can only support about 100KB of MMS, so the best cast length should be 50 seconds. For example, a 5-minute MP3 file is split into 6 AMR chapters, each containing a audio length of 45-50 seconds. The compression ratio for each AMR format would be 3-6 times the normal MP3 format. Based on the MP3 format of the playback rate of 600kb/min, it is conservatively assumed that AMR format compression ratio is 6 times times the MP3 format, the AMR format is 100kb/min, and the AMR file size for 45 seconds is 75KB.
So tea Vui Huang's practice is very clever. ”
I have tried, using the two parameters of FFmpeg, you can control let ffmpeg to split a large mp3 into many small pieces of independent playback AMR files.
-ss Time_off Set the start time offset
-T duration set the recording time
For example, you write a Perl file and then run:
@inputFilename = "C:\\opt\\media\\changjin.wma";
@outputFilename = "C:\\opt\\media\\changjin";
for($i=1,$j=1;$i<=1000;$i+=10,$j++)
{
system("C:\\software\\ffmpeg.exe -i @inputFilename -ac 1 -acodec amr_nb -t 10 -ss $i @outputFilename.$j.\".amr\"");
}
A large file is split into a number of small AMR, each AMR file is only 17KB.
Qinjiwy said: "A little suggestion for an optimization
If the segmentation is too small and the playback is too intermittent, the user feels and the system overhead is not appropriate.
You can consider opening a few more threads, and each file is not necessarily the same size, you can consider
The file gradually increases, from the current mobile speed calculation,
A compression-high AMR voice file plays longer than the download time. In the time that you started playing after the first download,
Can download larger files than the first download, which reduces network overhead "