zoukankan      html  css  js  c++  java
  • 流媒体开发之开源项目live555---live555 server 编译 包括更改帧率大小

    由于要测试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<winsock2.h>

    #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! ");

    ####################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 ",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

  • 相关阅读:
    安装 pgadmin4 docker
    DevExpress 、XtraGrid 自定义统计数据
    LINQ之Join(from join on )与GroupJoin(from join on into)将两个集合进行关联与分组
    LINQ之LookUp
    LINQ之GroupBy(group p by into)
    LINQ之SelectMany(from.. from..复合from子句)
    Row_number over (Partition by yyy) in Entity Framework
    为表或者表字段添加扩展属性(MS_Description、sp_addextendedproperty、注释)
    学习vue,待续中。。。
    用Python爬取《王者荣耀》英雄皮肤数据并可视化分析,用图说话
  • 原文地址:https://www.cnblogs.com/pengkunfan/p/3975194.html
Copyright © 2011-2022 走看看