Application of Linux-video streaming I

Source: Internet
Author: User
Tags coding standards
Author: Chen junhong www.jollen.org
Video Streaming technology has been around for many years and has been widely used on the Internet. Using Linux to build videostreaming server is also a hot topic. If you want to know what video streaming is, this article will give a clear and basic introduction to the concepts and technologies of videostreaming.
It's time for video streaming.
When you see "video" streaming, you will know that this technology is related to audio and video. Video Streaming is a technology that allows you to dial audio and video files over the network. The basic concept of video streaming is play as played by downloading 」.
If you want to watch the TV files of the remote server over the Internet, the most primitive is "download and then dial 」, that is, download the entire file to the local end through FTP or HTTP and then use the play after download program 」.
In the most common example, we can download MP3 files from the network and then play after download. Alternatively, we can download MP3 files and listen to music, this method is called play as stored ed. There are many other application examples, such as using RealPlayer to "watch videos or listen to music in Real Time". This instant dial-up method is play as played Ed. We call this technology videostreaming technology.
Why is it time for video streaming technology? In the simplest case, you may want to listen to the music content before downloading MP3, and the method of downloading music clips is not friendly enough, in this case, it is not only convenient to use the video streaming technology to make users hear and hear, but also does not have to waste time downloading unwanted music.
With the improvement of network bandwidth and the emergence of IPv6, video streaming will become more and more widely used, and more information appliances will be designed using video streaming, for example, interphone ).
In addition to the popularity of broadband networks, the great progress of storage devices is also the biggest driving force for accelerating the popularization of video streaming, for example, NAS designed in Linux can be used as a large audio/video server or dynamic Movie Database (DMD ).
VCD & MPEG-1
We must start with VCD, because it is a product that can reach the consumer market most after the emergence of computers.
Think of that year, to dial the VCD in addition to have a High Block of goods at that time 1x CD-ROM, but also another installation is also high block of goods MPEG card. VCD is actually a video streaming technology, because the VCD data is read and distributed. Why is there an MPEG card? Of course, this is because of the standard of MPEG-1.
MPEG-1 is designed to dial VCD on the 1x CD-ROM, and the data on VCD must be decoded by MPEG card (decode) to dial. But with the hardware progress, now can through the software to do MPEG-1 decoding work. We will introduce the design concept of MPEG-1 later.
DVD & MPEG-2
MPEG-2 is often mentioned due to the popularity of DVDs. Whether it is MPEG-1 or MPEG-2, is actually a coding technology, and DVD-ROM is the choice of MPEG-2 to its compression standards.
The reason why a DVD cannot be "backed up to a hard disk" like a VCD is that three protection channels are added, and the second protection is the CSS that players are familiar. In Linux, the reason why a "legal" DVD player cannot be found is the relationship between CSS.
Using NAs to design a video server, there is no technical obstacle to store and widely allocate VCD, but there is a legal problem to store and resize DVDs, this is a question worth pondering. At present, CSS technology is in the hands of Japanese people. To obtain this technology, we must sign the NDA. However, CSS is not an issue that everyone knows, but it is a matter of copyright.
Introduction to Image Coding Technology
At present, the academic community has developed many technologies for processing image signal compression and encoding (codecs). Speaking of these technologies, there are four most widely used coding standards:
1.) H.261
2.) H.263
3.) JPEG and MJPEG
4.) MPEG
We will briefly introduce these four encoding technologies.
H.261 Standard
H.261's image encoding standard appeared in ITU in 1990. The initial use was to support video phones and video conferencing ). There are two H.261 formats with different resolutions:
1) qcif: 176x144
2.) CIF: 352x288
H.261 FPS (frames per second) can reach 7.5, 10, 15, and 30 FPS. Because H.261 was initially deployed on isdn B and the transmission speed of isdn B was 64 Kbps, H.261 is also known as px64 (x = 1 to30 ).
The full name of CIF is (Common intermediate format), which is defined to support movies of different resolutions, such as NTSC, pal, and secam TV systems. Qcif is quarter-CIF, which is half of the CIF resolution.
In addition, H.261 can also be said to be the predecessor of MPEG-1 standards.
H.263 Standard
H.263 is an enhanced version of H.261. It was born in 1994 (ITU ). H.263 began to support PSTN, but it should be noted that H.263 was later than the MPEG-1, and H.263 was developed based on MPEG-1.
The H.263 standard supports five different resolutions:
1) Sub-qcif: 128x96
2.) qcif: 176x144
3.) CIF: 352x288
4.) 4cif: 704x576
5.) 16cif: 1408x1152
The transmission speed is 8 kbps ~ 1.5 Mbps. In addition, H.263 is also the basis of MPEG-4 standards.
JPEG
When it comes to the JPEG standard, it is widely used even after the ban on GIF. The full name of JPEG must be unique. He is short for joint photographic Experts Group, a famous group of technical teams.
JPEG is a 24-bit "true-color" image standard. JPEG converts an RGB image to ycrcb to reduce the file size, generally, it can be reduced by about 1/3 ~ About 1/2.
However, MJPEG is our main character. The full name of MJPEG is "motion" JPEG, which is an animated JPEG image. Many videostreaming scenarios, such as simple video conferencing software, use MJPEG to replace MPEG, because the MJPEG format is simple, but the disadvantage is that it does not support sound.
Standard MPEG-1
The MPEG standards are developed by ISO (International Standards Organization) and the full name is movingpictures Experts Group (mPEG works for ISO), which develops standards including MPEG-1, MPEG-2, MPEG-4, etc.
The MPEG-1 standard appeared earlier than H.263, which was established in 1992 and mainly used for video conferencing, video phones, computer games and support for the first generation of CD-Rom. The MPEG-1 is designed to support most of the images and sound effects of the CD-ROM, with a transmission speed of 1.5 Mbps (30 FPS ).
In addition, the MPEG-1 also supports playback, such as fast turn, rewind or jump, which is also a good place for MPEG-1. Later we will briefly introduce the reason for the MPEG-1 to understand how the MPEG-1 achieves these features.
Standard MPEG-2
The MPEG-2 standard appeared in 1994, and the MPEG-2 is compatible with the MPEG-1. The appearance of MPEG-2 is not to replace the old standard of MPEG-1, but to strengthen the lack of MPEG-1. Therefore, MPEG-2 can be promoted to other work environments, such as HDTV and video broadcast.
At the same time, MPEG-2 resolution is also supported to HDTV 1280x720. In terms of sound effects, the MPEG-2 also supports 6 channels (the MPEG-1 supports only 2 channels ). The transmission speed of the MPEG-2 is also increased to 2 Mbps ~ 10 Mbps, so 4x CD-ROM is needed, but so 4x CD-ROM can only store 18 sub-categories of images, so we use DVD-ROM to store images in MPEG-2 format, and DVD-ROM also supports Dolby sound effects.
Standard MPEG-4
MPEG-4 standards were proposed in 1993, the main application of a wide range of applications, including: video conferencing, audio and video mail, wireless devices, etc., support transmission speed of 8 kbps ~ 35 Mbps.
The MPEG-4 can transmit the object of an image, rather than the "frame" of an image, such as a series of action commands. Therefore, MPEG-1 and MPEG-2 are both "frame-based" standards, while MPEG-4 is "Object-based" standards, the future in the network and multimedia should also be more common.
MPEG-4 now has an openmpeg project on Linux, the project is initiated to develop a complete MPEG-4 support environment on Linux.
Network Technology of video streaming
We need to build a complete video streaming environment. In general, the hardware to be prepared includes servers, CCD, and image capturing cards. In terms of the underlying technical aspects, in addition to the image encoding technology mentioned above, video streaming applications must be implemented only through communication protocols.
Video Streaming Mode
Video can be applied in three ways during streaming: Broadcasting, unicasting, and multicasting.
Broadcasting is a simple method. It directly drops image packets on the LAN to the network (server side), and then the client application retrieves packets from the network for playing. However, there are still many issues that need to be considered on the network hardware layer. For example, some minor issues may occur on shared non-switched enthernet.
Both unicasting and multicasting are IP transmission methods. Unicasting transmits an image to the remote end in a one-to-one direction, which is called Video-on-Demand (VOD). multicasting is a one-to-many transmission mode, it is called near-Video-on-Demand (NVOD ). IPv6 will support IP Multicasting in the future, so videostreaming will be more widely used.
IPv6
The full name of IPv6 is IP version 6, which will replace the current IPv4 address. IPv6 has many new support for multimedia transmission, such as multicasting, authentication, and encryption. However, the application is still limited because the upgrade is not complete yet.
UDP protocol
The full name of UDP is the universal datateprotocol, and UDP communication protocol is the cornerstone of video streaming. The difference between UDP and TCP is that UDP does not have an error check, but this does not affect the video streaming application.
RTP protocol
The full name of RTP is real-time protocol. RTP is the header that adds 10 bytes before UDP packets, which records information such as time, serial number, and compression type. RTP is the communication protocol currently used by most video streaming software.
RTP can be used to perform streaming for different multimedia formats. Because we break down images into several RTP packets and send them out, we may encounter problems that many network technologies often encounter. For example, because the packet delivery time is different, the current image will not be smooth during playback. Therefore, a buffer zone (playout buffer) must be used during broadcasting) to temporarily store and process packets received on the network.
Because the time interval at which image packets received on the network arrive is different (synchronous data packets), these packets must be buffered using the buffer zone, make the same time interval (isochronous data packets ).
Principle of MPEG-1
MPEG-1 coding principles everyone should have a look. The MPEG-1 divides an image into a group, that is, GOP (group ofpictures), where each GoP has an entry point called an I-frame with a size of 15 kb, in addition, there are p-frame and B-frame.
I-frame is called independent-frame, which is the start point of each GOP, followed by two B-frames, and B-frame is called bi-directional frame. The size of each B-frame is 3 kb, insert a p-frame between two B-frames, that is, predictive-frame. The size of each B-frame is 8 KB.
There are three different GOP frames. Each frame stores different images and properties, which will be more detailed in the future. For example, when we want to quickly convert a video, we can ignore all B-frame and p-frame, and only play I-frame, in this way, you can save a lot of valuable network bandwidth and time, but the premise is that I-frame must store the main image data, in fact, as well.
Conclusion
The main purpose of this article is to give everyone a certain understanding of some standards of the image and the communication protocols used by video streaming, more image-related content will be introduced one after another.
In the next issue, we will introduce more interesting topics, including video4linux in the Linux core, image projects in the Linux environment, and useful video streaming applications.

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.