8 channel HD live stream encoder design
Summary:With the advancement of technology, HD live streaming has become an important function for the video website . This paper first introduces the structure and performance of the present live stream encoder then designs and implements a new high-performance 8 channel HD live stream encoder. The encoder is mounted in an 1U chassis which realized 8 channel HDMI capture, real-time HD encoding, RTMP/UDP/RTP publishing. Comparing with the present encoder, new encoder's encoding efficiency is 50% up, power consumption is 65% drop, volume is 80% drop. It is an innovative HD live stream encoder.
1. Present situation of HD live stream encoder
Network HD live streaming now is an important
method to access real-time information, having a great potential to replace
satellite or cable TV broadcasting.
1.1 HD source capture interface
Most HD encoders use HDMI interface as the input source.
HD live sources are mostly coming from
existing broadcasting TV signal. As the original signals usually using
compressed and encrypted transmission, a specific set-top box is needed to
decode and display the signals. So capture HDMI from set-top box is best
choice.
Sources could also come from Blu-ray DVD players, HD games consoles and PCs,
all these devices have HDMI output interface.
For the HD camcorders with only SDI output, a converter can be used to
convert SDI to HDMI.
1.2 Existing solution of HD live
streaming encoder
Network HD live streaming is new thing. Each live streaming service provider
has its own implementation. In General,it can be divided into the following
types:
1) Single channel scheme: one HDMI input,one RTMP output . There are two
forms for this scheme:
A) Special equipment
Figure 1-1 is a kind of equipment with HDMI input, RTMP output. It can
realize HDMI capture, H264 compression, RTMP publishing function in a small
case. But it does not focus on encoding efficiency, maybe it used webcam
compression chip or something like it.
B) Assembly equipment
Common implementations are shown in Figure 1-2, this equipment consists of a
single HDMI capture card and a small PC, combined with Flash Media Live
Encoder software. Using Flash Media Live Encoder is simple and convenient,
but it was often get complaints because it's low compression quality.
2) Multiple channel scheme: Multiple channel scheme is constructed by
multiple channel HDMI capture card and high performance PC. Currently in the
market, the maximum channel a HDMI capture card supported is 4.
Multiple channel scheme all use software to encode stream. To encoding 4 HD
programs in real time, CPU must be 4 or more cores. According to the
technician's level, the software has two options:
A) Flash Media Live Encoder. Easy to use, but poor
quality in low bit-rate.
B) X264 Encoder. By far X264 is the best H264 encoding software. Its
compression quality has greatly improved in low bit-rate. But X264 requires
higher for technicians to configure complex parameters and rewrite RTMP
publishing software.
2. Design of high performance 8 channel HD live stream
encoder
The basic idea is to make FPGA, CPU and GPU tight coupling. The whole
solution include 8-channel HDMI input capture, real time encoding,
RTMP/UDP/RTP
publishing are realized within a 1U chassis, aiming to upgrade the encoding
efficiency 50% or more. GUI should be simple and practical suitable for
non-technical operations.
2.1 HDMI acquisition card
and driver design
Currently, HDMI capture card support 4-channel input most. With AVSTREAM
driver, it's versatile, wide adaptability, but did not consider
tightly-coupling with the new CPU.
Our capture card is designed only for high performance situation, so design
can reduce the general considerations and give more focus on its efficiency.
That makes the design have several features:
1) High integration: allowing 8 channel HDMI input and real-time capture;
2) High DMA transfer efficiency: For compatibility, traditional capture
cards use page table memory, which has very low transmission efficiency. Our
design apply for a large number of contiguous memory when system boot,
improving DMA transfer efficiency;
3) Using graphics memory: Traditional capture cards use system memory for
CPU to access image data. Our design mainly relies on hardware compression.
So graphics memory is used to acquire DXVA performance without CPU
intervention. This improves compression speed.
2.2 Encoding algorithm
Encoding algorithm is a highlight of our design. Compared with other
encoders, our algorithm improve encoding efficiency more than 50%, and can
support 8-channel real-time HD encoding at same time.
Algorithm is optimized in many aspects:
1) Optimization of data capture. Capture card directly converts data formats
and writes the data to buffer at hardware level. No CPU involved.
2) Hardware-accelerated encoding. Encoder uses the latest hardware
acceleration technologies. Without affecting the real-time encoding speed,
using H264 High Profile most complex encoding configuration to improve
encoding quality;
3) Multi-B-frames encoding. B-frames can significantly improve encoding
efficiency. But most video server will come across picture flutter when
encountered more than 2 consecutive B-frames. This algorithm make a
pre-distortion to avoid that, it can play video smoothly when encountered 5
consecutive B-frames.
4) Smart rate control. According to the common sense, moving image will
increase the bit-rate, the more movement intense, the higher bit-rate
increasing. But considering of human eyes feature of reducing resolution for
fast moving objects, macro-block (MB) level moving analysis is applied.
Static MB will be assigned higher quality and motion MB will be assigned
lower quality. So bit-rate can be reduced without influencing the visual
effects.
5) Statistical multiplexing. The encoder is designed for the 8-channel
real-time encoding. Taking into account the non-relevance of the 8-channel
input signal, we use statistical multiplexing methods to control total
bit-rate in a certain range. 8-channel encoded bit-rate can be borrowed
from each other.
X264 is globally-recognized the best H264 encoding software now. Compared with X264 under 720P resolution, optimization algorithm performance is shown in Figure 2-2 as blue line.
Existing encoding systems
use the 4-channel HDMI capture card and CPU software encoding. In order to
meet the 4-Channel HD encoding speed, X264 veryfast or fast mode is often
used.
From the diagram, you can see that, at low bit-rate cases, optimization
encoding algorithm is 1~2db better than X264, or we can say that the
optimization algorithm 600Kbps effect is equal to X264 1~1.4Mbps effect.
2.3 Software design
Software's basic functions are HDMI capture, real-time encoding,
RTMP/UDP/RTP
publishing. In order to achieve good compression efficiency, configuring a
large number of encoding parameters dynamically is need. To connection with
stream live server over
RTMP/UDP/RTP , stream id and IP address are also
need to be set.
Software UI is very simple, as shown in Figure 2-3. Users just need to set compression quality and IP address for each channel. Complex settings and optimization are be done internally by the software.
Compression quality has 4 options: Excellent, Good, Fair, Poor. The 4 options correspond 1.3Mbps, 1.0Mbps, 800Kbps, 600Kbps bit-rate at average. Bit-rate varies with program type: for sports program, bit-rate increasing 15~20%; for news program, bit-rate decreasing 10~15%.
In first version software UI, real-time average bit-rate is shown. In the second version software UI, 8 channel HDMI capture raw images preview and stream live server loop-back images are all shown.
2.4 Machine Assembly
Machine uses 1U chassis (250mm), I3-4370 (or G3220) CPU, MSI H81I miniITX
motherboard, dual ball bearing Turbo fan, 2x2GB DDR3 dual-channel memory, 1U
Flex power, 32GB SSD, Professional 8-channel HDMI capture card. See Figure
2-4,2-5,2-6.
3.1 Machine interfaces
and testing
1) Input: HDMI(x8);
2) HD format: 1280*720p50/60;
3) Output: RJ45 100/1000Mbps;
4) Output Protocol:
RTMP/UDP/RTP;
5) Power supply: AC110/220 50/60Hz.
Weight: 4Kg. Power consumption: less than 75W.
Testing: 3 machines 24 HDMI inputs are feed by 8 different satellite set-top
boxes and HDMI distributor. RTMP streams are send to WOWZA streaming server
through net switcher.
During a long time full load testing, a electricity blackout happened,
individual set-top box crashed and the WOWZA Server heaped overflow once, 3
encoder machines have not been an exception at all.
3.2 Compared with similar
existing equipment
When compared with similar 4-channel video encoder products, volume, power
consumption is calculated of two devices.
Encoding efficiency: the
effects in our encoder at 600Kbps can reach other encoder's 1~1.4Mbps
encoding effects, efficiency improved
over 50%
Power consumption: 75W
compared with 2x100W, decreasing
more than 65%
Dimensions: 1U chassis
compared with 2x3U chassis, decreasing
more than 80%
4. Conclusion
In summary, using the new high-performance 8 channel HD live stream
encoder will greatly save the network traffic, electricity and space usage,
improve equipment reliability and reduce operating costs and entry barriers.
Download encoding samples:
1) Excellent: 1.3Mbps www.tongshi.com/temp/Excellent.rar
2) Good: 1.0Mbps www.tongshi.com/temp/Good.rar
3) Fair: 800Kbps www.tongshi.com/temp/Fair.rar
4) Poor: 600Kbps www.tongshi.com/temp/Poor.rar
Watching live stream, please mail to support@Tongshi.com.
After getting live stream URL, paste it into VLC net stream to watch.