1.安装ffmpeg
yum install ffmpeg
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
yum install ffmpeg ffmpeg-devel -y
ffmpeg -h
2.安装openssl
centos:
yum install openssl-devel
ubuntu:
apt-get install libssl-dev
3.安装gcc g++(非必须)
yum install gcc
yum install gcc-c++
4.下载安装live555
源码
http://www.live555.com/liveMedia
live555-latest.tar.gz
编译
环境
ubantu x86_64
tar xf live555-latest.tar.gz
cd live
./genMakefiles linux
./genMakefiles linux-64bit (64bit)
make
生成./mediaServer/live555MediaServer
修改
H264VideoFileServerMediaSubsession
-->createNewStreamSource
高码率:
https://gitee.com/tkly/live555_high_bit_rate
5.MP4转H264格式(视频存放到mediaServer同目录下)
ffmpeg -i input.mpt -vcodec h264 output.264
6.live555: The input frame data was too large for our buffer size 解决方法
MultiFramedRTPSink::afterGettingFrame1(): The input frame data was too large for our buffer size (100452). 13457 bytes of trailing data was dropped! Correct this by increasing "OutPacketBuffer::maxSize" to at least 113457, *before* creating this 'RTPSink'. (Current value is 100000.)
这个问题的解决方式,在国外的一个网站找到了解决的方法,其原文如下:
/BUFFER SIZE PROBLEM///
Generally, while running HD stream, one can face packet loss due to ridiculously large NAL units. This will create an error stating something like ->
“MultiFramedRTPSink::afterGettingFrame1(): The input frame data was too large for our buffer size (60753). 34086 bytes of trailing data was dropped! Correct this by increasing "OutPacketBuffer::maxSize" to at least 94839, *before* creating this 'RTPSink'. (Current value is 60000.)”
To solve this, you need to make the following changes to your code:
1. Go to “live/liveMedia/MultiFramedRTPsource.cpp” and change “increaseRecieveBufferTo(env, RTPgs-> socketNUm(), 2000000)”
2. Go to “live/liveMedia/StreamParser.cpp” and increase BANK_SIZE to 300000 or 600000.
(This will also help remove StreamParser Error that you might encounter!)
3. In “live/liveMedia/MediaSink.cpp” change the value of unsigned OutPacketBuffer::max size to 600000.
4. In “mediaServer/DynamicRTSPServer.cpp”, change OutPacketBuffer::maxSize to 600000 at all places where it is defined.
5. *Most importantly, you need to change the code in your own program, more so than the libraries themselves. This means that if you just do what pt.5 tells you to, you can avoid pts 1-4. Therefore, in your code change OutPacketBuffer::maxsize to 600000 (Our code file is testH264VideoStreamer.cpp so we made the above change in that. Note: testH264VideoStreamer.cpp lies in testProgs directory). You NEED to change this value in your code before you create any RTP sinks.
6. Also to allow for more holistic changes, go to “testProgs/playCommon.cpp” and change the value of fileSinkBufferSize to 600000.
///WHAT ELSE CAN BE DONE
It is more advisable to reduce the buffer size of your stream by increasing compression levels. Also you would need to increase the buffer size of vlc player to allow for smooth streaming. To do so, go to VLC-> Tools -> Preferences -> Select “Show All” -> Click on Stream Output -> Change “stream output muxer caching” to a suitable value in ms. (1500 - 3000)
与此同时,在我做的H264 直播工程中, 还需要设置const unsigned estimatedSessionBandwidth 的值,需要把它调到一个合适大小的值。
7.RTSP播放器
https://blog.csdn.net/xiejiashu/article/details/79051199
Windows RTSP播放器:https://github.com/EasyDSS/EasyPlayer-RTSP-Win/releases