流媒体开发之开源项目live555-尊龙游戏旗舰厅官网
由于要测试8148解码器的性能,需要搭建不同帧率25fps - >30fps,宏块大小defualt 100 000 -》 200 000不同大小的h264码流,所以就需要编译改动的live555 server ,没想到很顺利,用的是vs2010,一步到位没报任何错误。这里做一下笔记方便下次使用:
1.准备源码www.live555.com 下载最新源码包,解压
主要包括服务端和客户端
用到的主要有4大模块:livemedia groupsock basicuseageenvironmental usageenvironment testprogs
服务端:livemedia groupsock basicuseageenironmental usageenvironmental mediaserver
客户端:livemedia groupsock basicusageenvironmental usageenvironmental testprogs(单路收取流的话就用:openrtsp.cpp playcommon.cpp 再转发的话加个fifo.c队列缓存)
2.编译选用win32工程先说客户端
先建一个空的工程,然后添加所有live555目录下的include下的头文件.hh添加到header头文件里面,然后添加cpp文件主要是四大模块livemedia groupsock basicusageenvironmental usageenvironmental 不包括testprogs ,为了方便调用,app testprogs 独立建一个工程目录myclient 然后在里面添加openrtsp.cpp playcommon.cpp playcommon.hh;
文件添加完之后,得设置工程属性:
vs2010添加方法如下:
方法一:
工程properties
linker->input->additional depandencies
方法二:
直接包含
#include
#pragma comment(lib,"ws_32.lib")
继续在工程里面
工程properties
c/c ->general->additional include directories 包含include下的所有头文件爱你.hh(我这里就全部在一个工程目录下live555server/client)
服务端一样,不同的是在api 不同服务端有个专门的mediaserver 目录 作为主程序,我们直接将下面的两个dynamicrtspserver.cpp live555mediaserver.cpp两个 文件添加到myserver 工程目录下。
####################1 片包大小
顺便修改下maxbuffer 宏块大小在dynamicrtspserver.cpp中:
new_sms("h.264 video");
outpacketbuffer::maxsize = 200000; // allow for some possibly large h.264 frames
printf("maxsize h264 change by pkf 200k!\n");
####################2 帧率大小
在h264or5streamframer.cpp中:
// h264or5videostreamframer implementation //
h264or5videostreamframer
::h264or5videostreamframer(int hnumber, usageenvironment& env, framedsource* inputsource,
boolean createparser, boolean includestartcodeinoutput)
: mpegvideostreamframer(env, inputsource),
fhnumber(hnumber),
flastseenvps(null), flastseenvpssize(0),
flastseensps(null), flastseenspssize(0),
flastseenpps(null), flastseenppssize(0) {
fparser = createparser
? new h264or5videostreamparser(hnumber, this, inputsource, includestartcodeinoutput)
: null;
fnextpresentationtime = fpresentationtimebase;
fframerate = 25.0; // we assume a frame rate of 25 fps, unless we learn otherwise (from parsing a vps or sps nal unit)
}
然后就是building咯。。。ok完成
2014-12-11 关于帧率修改的修正:
上面的帧率只是在帧率为0的情况下的默认值,后面会被同文件下的里一个函数重新复制修改unsigned h264or5videostreamparser::parse() 这个解析函数有如下修改:
else if (issps(nal_unit_type)) { // sequence parameter set
// first, save a copy of this nal unit, in case the downstream object wants to see it:
usingsource()->savecopyofsps(fstartofframe foutputstartcodesize, curframesize() - foutputstartcodesize);
if (fparsedframerate == 0.0) {
// we haven't yet parsed a frame rate from the stream.
// so parse this nal unit to check whether frame rate information is present:
unsigned num_units_in_tick, time_scale;
analyze_seq_parameter_set_data(num_units_in_tick, time_scale);
if (time_scale > 0 && num_units_in_tick > 0) {
usingsource()->fframerate = fparsedframerate = 25;//2*time_scale/(2.0*num_units_in_tick);//这里才是真正的产生作用的地方!
2015-5-18 关于server read file loop:
在bytestreamfilesource.cpp 中的handleclosure();前面添加
if(feof(ffid))
{
fprintf(stderr,"frames=%d,tostremf = %d, fmaxs=%d\n",fpreferredframesize,flimitnumbytestostream,fmaxsize);
seekfile64(ffid, 0, seek_set);
doreadfromfile();
return;
}
3.live555mediaserver 的使用:把x.h264 文件和live555_server.exe放同一目录下运行.exe 版本0.83
4.最后美图附图一张
http://www.cnblogs.com/-simple-/p/3398009.html
http://www.cnblogs.com/skyseraph/archive/2012/04/11/2442840.html
http://blog.csdn.net/aobai219/article/details/5841951
http://blog.csdn.net/lf8289/article/details/7785898
http://blog.csdn.net/wolfliuming/article/details/6087070
http://download.csdn.net/detail/zgzhaobo/4220620
转载于:https://www.cnblogs.com/pengkunfan/p/3975194.html
总结
以上是尊龙游戏旗舰厅官网为你收集整理的流媒体开发之开源项目live555---live555 server 编译 包括更改帧率大小的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 自定义键盘keyfere——pcsens
- 下一篇: html学习笔记2—列表与清单