Qiniu Seven cow problem solution
A lot of seven cattle users in the use of seven cow cloud storage process encountered video player selection problem, here I do a simple recommendation.
Audio and video support audio and video playback
In the process of building video applications based on seven cow cloud storage, users often encounter problems with playback: What player do you choose? What encoding and container formats are used? How to adapt to a variety of clients? Wait a minute.
Requirements for players
Video applications often require the player to have the following basic features:
Multi-client support. Includes: PC-side (web playback) and mobile (ios,android, etc.). Players with multi-platform support help simplify development and avoid differences between platforms.
Commonly used audio and video encoding format support. Commonly used encoding format is: video H264; audio MP3 and AAC. These audio and video formats are widely used and have better compatibility.
Common container formats are supported. Common container formats include: FLV, MP4, HLS (m3u8/mpeg-ts), MP3,AAC. With these formats, you can cover most of your application scenarios.
Play data statistics. Playback statistics are mainly used for user viewing statistics, billing, status analysis of basic services, user behavior analysis and so on.
Advertising. Advertising is an important means of monetization for video applications.
Exterior customization. Appearance customization helps the audio and video application beautify the interface and improve the user experience.
Selection of the player
There are a lot of players to choose from, but there are few players that can support the above functions well, commonly used are:
Ckplayer:http://www.ckplayer.com
grindplayer:http://osmfhls.kutu.ru/docs/grind/
The following table lists the features of these types of players:
|
seweise palyer |
JW Player Free+hlsprovider |
Ckplayer |
Grindplayer |
| Main format |
MP4, FLV, m3u8 |
MP4, FLV, m3u8 |
MP4, FLV |
MP4, FLV, m3u8 |
| Playback technology |
Flash&html5 |
Flash&html5 |
Flash&html5 |
Flash&html5 |
| Appearance settings |
Support |
Support |
Support |
Not supported |
| Play List |
Support |
Support |
Support |
Support |
| Advertising |
Support |
Support |
Support |
Support |
| Statistical information |
Support |
Support |
Support |
Support |
| Subtitles |
Support |
Support |
Not supported |
Support |
| Dvr |
Support |
Support |
Not supported |
Support |
| Live |
RTMP, HLS |
RTMP, HLS |
Rtmp |
Fl= |
| HLS encryption |
Support |
Not supported (Premium and Enterprise editions required) |
Not supported |
128bit |
| Charges |
Free/Open Source |
Free/Open source (not for commercial use) |
Free |
Open source |
As you can see, JW player is the most complete feature. The free version has functional limitations, such as no HLS support, but there are some open source plugins that can complement these features. The main problem with the JW player free version + plugin is that the free version is not intended for commercial use. Ckplayer features a lot, but lacks HLS support for playing on the web, so there are barriers to use. The Grindplayer function is more comprehensive, usually used in the condition of the foot.
Therefore, the premium version of JW player is the best option if you can afford to pay for it. If your audio and video app wants to use a free player, and there's no need for a look-up, then you can use Grindplayer. If the user does not need HLS support, then Ckplayer can be used. If Grindplayer and Ckplayer can not meet the requirements, but also free, then the free version of the JW player+ plugin. It should be stated, however, that this form may present a legal risk, since the free version of JW Player cannot be used for commercial purposes.
Selection of formats
The choice of audio and video coding and container formats requires a combination of different playback platforms and players, as well as minimal resource consumption and development.
We first recommend using a well-generalized format. The frequency encoding format supports up to H264, and most browsers, mobile, and players support this encoding format. The most common audio formats are MP3 and AAC, both of which are supported by most platforms. Therefore, audio and video applications should generate video files with these encodings as much as possible in order to avoid the hassle of further coding conversions. If the application does not control the encoding of the source audio and video, then the audio and video transcoding function of seven cow cloud storage can be used to generate the audio and video required for playback.
The container format is relatively complex. Support for different playback platforms varies. However, if you choose the right player, this choice can be much simpler. In general, the FLV format is primarily used for flash players, and MP4 is better supported on HTML5. On the mobile side (IOS, Android), MP4 and HLS are mainly supported. The FLV format cannot be played because the iOS side repels flash. If we want to use a uniform format on all platforms, then only MP4. So, in general, we recommend using MP4 as the primary format for video playback.
The disadvantage of MP4 is that the support for drag play (seek) is not good. Drag play is a common user play behavior, when users need to skip some content, or audio and video applications to support progress bar and thumbnail function, drag play has a very important role. Under normal circumstances, the player needs to cache the MP4 audio and video files to a drag-and-drop point before it can start playing formally. However, this can cause users to wait for long periods of time and generate a lot of wasted traffic. There are a number of tools that can help the service side provide support for "start= ..." parameters, but there are many limitations and problems with the use. A more efficient way is to cut a long video into fragments (usually 5-10 minutes), strung together by a playlist. When you drag and play, the player downloads only the fragments involved, increasing the response and reducing the amount of wasted traffic.
However, this long video slicing feature requires additional support from the player, and there is little support for the existing player. The shortcut is to use HLS. HLS is usually used for live streaming, but it can also be used on demand. This is done by slicing the long video and then indexing it with the m3u8 file, which is parsed by the player and loaded and played automatically.
HLS problem is that the PC side of the player support is not ideal, Flash Player and desktop browser HTML5 are not natively support HLS. Therefore, we use HLS as an important capability when selecting the player. In the four types of players listed above, most of them support the HLS protocol. Therefore, we recommend that users choose a player that supports web-side HLS, and use the video slicing feature of seven cow cloud storage to convert it to HLS protocol, simplifying application development and improving the user experience. For support on HLS playback, refer to playing HLS on seven cow cloud storage
In addition, for some applications, you want to use different audio and video resolutions and bitrate for different users to adapt to different environments. For example, the mobile side uses a lower bitrate and audio and video quality, while the PC side uses a higher bitrate and quality. Further, you can allow users to choose the audio and video quality automatically or manually based on their different network environments. This requires multi-bitrate support for audio and video playback. HLS itself supports multi-bitrate audio and video streams, which can be easily implemented. For more information about HLS Multi-bitrate support, please refer to how to use the seven Qiniu storage for HLS multi-bitrate playback
Case
Suppose there is a video file: Sintel_trailer.mp4, played in HLS. There are three things to do:
Upload the file to seven cow cloud storage. Specific Upload method reference upload operation.
Use the avthumb/m3u8 feature to convert it into HLS media files. The conversion can be performed using the data preprocessing function at upload time, or it will be persisted fop after the upload is complete. However, either way, you need to save the transcoding result with the SaveAs feature to the specified name (requires. m3u8 filename suffix).
The result of transcoding is constructed to download url:http://ztest.qiniudn.com/sintel.m3u8 and then put into the player, or play the parameters of the page.
The most important for everyone to recommend a free play plugin
Plugin Address: Https://github.com/jackzhang1204/sewise-player
Demao:http://jackzhang1204.github.io/sewise/sewise_player/demos/index.html
The following playback page shows several player playback sample videos:
HLS:
Seweizhi:http://seweizhi.qiniudn.com/demao.html
Grindplayer:http://www.flashls.org/latest/examples/osmf/grindplayer.html
Seweizhi:http://jackzhang1204.github.io/sewise/sewise_player/demos/index.html
MP4:
Seweizhi:https://github.com/jackzhang1204/sewise-player
FLV:
Seweizhi:http://jackzhang1204.github.io/sewise/sewise_player/demos/index.html
About seven cows contact us job Opportunities Edit Page New page Shanghai ICP 11,037,377th No. 5
License
Copyright (c) qiniu.com
Recommended solution for video player during seven cow use