Giter Club home page Giter Club logo

rtspserver's People

Contributors

dodiayar avatar doublex69 avatar iamscottxu avatar phz76 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rtspserver's Issues

how to push cv:mat image in rtsp-server?

should i encode cv:mat img to h264 flow first?

because i see in the " rtsp_server->PushFrame(session_id, xop::channel_0, videoFrame) " ,
the '' videoFrame '' need set it's type to VIDEO_FRAME_I/P/B?

Full BufferWriter

It looks like BufferWriter has a max capacity. When a call to Append fails because the queue is full, it returns false but nothing ever checks or acts on the return value. So if there is a slow network bandwidth, there could be a lot of RTP packets lost because of the way the software is setup not because of the underlying protocol. Is that the intended behavior?

占用内存

程序启动后,连接上了rtsp server占用了超过3M的内存,如何减少内存的占用?

播放h264文件时解码失败的问题

根据demo,我从监控平台上抓取了Hi profile 的h264文件,进行推流时解码失败。
解析了一下nal,发现该文件nal由00 00 01开头,client端收到的是00 00 00 01 00 00 01开头。
测试数据文件在这里https://github.com/DeanXi/testdata
有人遇到和我一样的问题么,rtp拼包那里没有发现问题。

Support VP8 and Opus codec

Hi

I want to request support for VP8 and Opus codec. Opus has very short latency and VP8 is open source that is used by Skype and Whatsapp ( Facebook ).

Rtsp账号密码

你好:
RtspServer 如何加入用户名,密码校验 谢谢

Authentication doesn't work!

Hello,
I've added this line to my code :
server.setAuthConfig("-_-", "admin", "12345");
but i still can push my stream to the server using ffmpeg and watch the stream without any kind of authentication.
How can I make the authentication work?

Thank you
~Amir

播放h265视频遇到的现象

大牛这项目太牛了。在使用中遇到一个现象,写入H265包到session,发现用VLC 3.0.12可以播放,VLC 2.2.2也可以播放,用ffmpeg播放后台一直打印这样的错误信息, 不能看到画面。如果是播放H264视频,则ffmpeg, vlc均正常。请问大神,应该从那方面入手解决这个现象。

rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 15 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 19 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 15 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 19 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 19 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 19 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 15 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 19 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 19 times
[rtsp @ 000001ba01fa8a00] Illegal temporal ID in RTP/HEVC packet0
Last message repeated 15 times

多线程回调问题(rtsp_h264_file.cpp示例)

您好,在以rtsp_h264_file.cpp进行调试时,发现MediaSession.cpp中的
bool MediaSession::addMediaSource(MediaChannelId channelId, MediaSource* source)
函数本身是被主线程调用的,
而其内部的实现,回调函数source->setSendFrameCallback([this](MediaChannelId channelId, RtpPacket pkt)
实际上却是被子线程进行调用的。
而且函数内部没有加锁,额,这就造成我知识的盲区。我暂时理解是,因为主线程调用一次后就不再进行调用,所以就不需要进行加锁了,但我没有在其他地方看到类似的使用方法,不知道这样使用是否会有其他问题呢,还望您有空时指点一二,谢谢了

开启/关闭Rtsp服务,出现anon_inode:[eventpoll] 及 pipe 文件句柄泄漏

写压力测试程序 ,不停的开启/关闭Rtsp服务,出现anon_inode:[eventpoll] 及 pipe 文件句柄泄漏,修改EpollTaskScheduler::~EpollTaskScheduler() 析构函数
增加
if (epollfd_ >= 0)
{
close(epollfd_);
epollfd_ = -1;
}

TaskScheduler::~TaskScheduler() 析构函数
增加
wakeup_pipe_->Close();

增加上述代码后问题解决

hi3516平台

arm-hisiv300-linux-g++编译成功无异常

程序刚执行就报错
RtspServer # ./rtsp_server
rtsp://192.168.1.99/main
pure virtual method called
terminate called without an active exception
Aborted

使用过程中俩小问题

1、RtspConnection的handlecmdsetup中判断是udp传输后应该调用buildSetupUdpRes,大概拼写错了。

2、RtspConnection::handleCmdDescribe中,判断mediaSessionPtr是空之后,最好直接sendMessage并返回,不然输错suffix会崩掉

Timestamp not updating

Hi, I have put together a code that takes data from FFmpeg encoded h264 packets and sends it to RTSP server. With VLC (3.0.8), I am able to view the frames fine but noticed the time stays at "00:00" in the seek bar. I tried defining videoFrame.timestamp with both definitions under xop::H264Source::GetTimestamp():

auto time_point = chrono::time_point_cast<chrono::microseconds>(chrono::steady_clock::now());
return (uint32_t)((time_point.time_since_epoch().count() + 500) / 1000 * 90 );

and

struct timeval tv = {0};
gettimeofday(&tv, NULL);
uint32_t ts = ((tv.tv_sec*1000)+((tv.tv_usec+500)/1000))*90; // 90: _clockRate/1000;
return ts;

Appreciate any pointers on what might be causing this issue and how to fix it. Thanks.

我在Ubuntu上本地都连不上

用ffmpeg和vlc都连不上 大佬如果有空解一下迷惑哈 我直接复制的example/rtspserver的main ip改成了本机局域网ip 视频用的是opencv(我相信opencv应该不是连接不了的问题所在)

我修改了一些代码,实现URL可以自由变动

传入Rtsp类一个回调,实现两个功能
当客户端连接上之后,通过回调传入rtsp的URL,这样调用者通过回调判断URL 是否合法和是否存在,如果存在则return 1, 内部代码判断返回1后,建立session和sessionid,将建立好的sessionId通过回调传送给调用者,调用者拿到sessionId,
后续推流是一样过程
这样实现方式修改代码量非常少,不仅仅url可以动态变,
实现的是例如rtsp://ip:port/xxx?accessToken=xxx的token变动的方式,
另外一点则是回放的URL,rtsp://ip:port/playbackxxx?starttime=xxx&endtime=xxx

android移植

你好 我把他移植到Android平台,Server 能开启 ,能进行TCP连接,但是回调函数无法执行,请问是什么是什么原因导致的。

Length of RTP timestamp will be greater then unsigned int

Thanks for sharing.
This project is very powerful.

I found 1 issue that cause the stream can't be played.

chrono::time_point_cast<chrono::microseconds>(chrono::steady_clock::now());

The value of this function will be greater and greater.
Finally it will be greater than 32 bits, so some player can't play the stream.

Typo in example

file:example/rtsp_h264_file.cpp: line 75: s/snedFrameThread/sendFrameThread

测试rtsp_h264_file遇到的一些问题

你好,我在测试rtsp_h264_file遇到的一些问题
1、Makefile第一行DEUBG = -DXOP_DEBUG是不是应该改为DEBUG = -DXOP_DEBUG,还有我查找了整个仓库并没有找到XOP_DEBUG这个编译开关使用的地方;
2、我修改了/src/net/Logger.h头文件后重新make,没有响应,而是要make clean后再重新make,是不是Makefile里没有支持追踪头文件;
3、bind失败后LOG_DEBUG没有打印成功,发现LOG_DEBUG的实现需要定义_DEBUG宏,但是该宏在Makefile没有出现,我在Makefile里定义该宏后问题还是没有解决,是不是跟Makefile里没有支持追踪头文件有关?我把_DEBUG宏开关相关代码删除后,LOG_DEBUG能够正常打印;

Not working in new update

In new commit (c7a6d48) when make project show warning message (Image below). Output binary after run ' ./rtsp_h264_file test.h264' not working. Old commit (ac1b0fd) is still working.

Screenshot from 2021-09-07 23-27-14

H264文件推流

你好,我现在调用nvidia TX1的api实现了两路usb视频的编码,编码数据是h264,应该怎么调用你这个程序b把编码好的数据推成rtsp流呢 我编译后运行test 提示如下:

nvidia@tegra-ubuntu:~/RtspServer$ ./test
[DEBUG] [src/xop/TcpSocket.cpp:bind:27] <socket=6> bind <192.168.1.8:554> failed.
rtsp://192.168.1.8/live

Dropped packets when UDP on network

For my application I am reparsing ffmpeg avpacket.data into NALs and feeding them to RtspServer. This works perfectly when I connect locally using vlc. When I connect from another machine on the network (wired or wifi) we get massive packet drops. We never get a keyframe. If I use tcp it works fine.

Does RtspServer work with UDP for everyone else? Anyone have any ideas where I should look?

关于std c++11

使用了std c++11,嵌入式系统上交叉编译环境,很多不支持std c+11,肯定会限制在嵌入式系统的应用

RTSP推送出现no data received

通过ADB将ARM板上的554端口映射到主机本地,VLC可以正常登录服务器、播放、停止。
但是数据貌似有些问题,出现如下问题:

[000055de44a665b0] main playlist: playlist is empty
Created new TCP socket 37 for connection
Created new TCP socket 37 for connection
[00007f8ed80010f0] live555 demux error: no data received in 10s, aborting

代码中我没有打包音频数据,使用的RTSPDemo

注释掉了音频的通道:

    // 添加音视频流到媒体会话, track0:h264, track1:aac
    session->addMediaSource(xop::channel_0, xop::H264Source::createNew());
    //session->addMediaSource(xop::channel_1, xop::AACSource::createNew(44100,2));
    //session->startMulticast(); // 开启组播(ip,端口随机生成), 默认使用 RTP_OVER_UDP, RTP_OVER_RTSP

所以打包推送的时候也没有打包音频数据。

        xop::AVFrame vidoeFrame(nval + 1024);
        vidoeFrame.size = 0;
        vidoeFrame.type = xop::VIDEO_FRAME_P;
        vidoeFrame.timestamp = xop::H264Source::getTimeStamp();
        log(_debug, "%x %x %x %x %x", data[0],data[1],data[2],data[3],data[4]);

        if (data[4] == 0x65) //0x67:sps ,0x65:IDR
        {
            //添加sps, pps
            char tmpbuf[128] = {};
            char *ptmpbuf = tmpbuf;

            size_t size = sizeof(tmpbuf);
            uint32_t flag = 0;

            ipc_vget(ipc_ctx, "H264_SPSPPS", 11 ,tmpbuf,&size,&flag);
            memcpy(vidoeFrame.buffer.get(), ptmpbuf + 4, size - 4); // +4去掉H.264起始码
            vidoeFrame.size += size -4;

            memcpy(vidoeFrame.buffer.get() + vidoeFrame.size,val, nval);
            vidoeFrame.size += nval;

        }
        else
        {
            memcpy(vidoeFrame.buffer.get(), val+4, nval-4); // +4去掉H.264起始码
            vidoeFrame.size += (nval-4);
        }

        rtspServer->pushFrame(sessionId, xop::channel_0, vidoeFrame); //送到服务器进行转发, 接口线程安全

请问还有哪里参数需要设置吗? 或者是必须要发送音频数据吗?

关于延时

目前以及成功运行h264的码流推送服务,但是初测在局域网延时有2s左右,请问项目中有可能会造成延时的地方吗,还是应该从其它地方查。
应该是vlc有什么信息需要解析,用EasyPlayer的时候延迟在300ms,比较合理

rtsp_h264_file例子的使用

博主你好,请问你这个rtsp_h264_file的例子要怎么使用呢?我使用VLC播放器无法连接和打开rtsp_h264_file例子中的test.h264文件。新手求教,万分感谢

Android的MediaPlayer拉流失败

你好,我用安卓的MediaPlayer去拉流,rtspServer服务器程序会在play命令后,删除掉会话;我打印MediaPlayer的rtsp交互命令和vlc的是一样的,命令返回也是成功的;
准确点说,程序是在Chanel的HandleEvent处理中,它读socket没有数据后,就删掉了会话;但我用vlc去拉流时,它似乎并没有在rtsp命令交互后再去监听这个会话socket?

关于readFrame

大神

if (((m_buf[i + startCode] & 0x1F) == 0x5 || (m_buf[i + startCode] & 0x1F) == 0x1) &&
			((m_buf[i + startCode + 1] & 0x80) == 0x80))
		{
			bFindStart = true;
			i += 4;
			break;
		}

为什么这里只判断1和5啊, 2,3,4不是么?(抱歉刚开始学习这个^_^|||)

推h265流的时候播放器无法播放

在H265Source的handleFrame里面
应该先把头部的(00 00 00 01)去掉再计算naluType 所以应该加在获取frameBuf和framesize之后减去相应的数据。
uint8_t *frameBuf = frame.buffer.get();
uint32_t frameSize = frame.size;
frameBuf +=4;
frameSize-=4;

IP地址改变后立刻重启server总不成功

当监听到PC(作为server)的IP地址变了后,依次调用server的Stop() 和start()方法,以期重启server,
但在start()中就出错了,主要在
if (acceptor_->Listen(ip, port) < 0) {
return false;
}
再往里面就是
bool TcpSocket::Bind(std::string ip, uint16_t port)
请问有没有好的处理方法或建议?谢谢。

关于多路推流,帧类型,时间戳

1. 关于多路推流

  • 是否可以同时推流多路视频?

    我的想法是:在同一个xop::RtspServer server中,再添加一个xop::MediaSession *session,它们使用不同的后缀;例如:rtsp://127.0.0.1:554/0rtsp://127.0.0.1:554/1;这样是否可行?

  • 同一个MediaSession中的视频流和音频流是通过同一个URL播放的吗?

  • MediaChannelId是否可以在2个通道中都放入视频源?如果可以,那么不同通道的视频源如何播放?

    例如:session->addMediaSource(xop::channel_0, xop::H264Source::createNew());

    session->addMediaSource(xop::channel_1, xop::H265Source::createNew());

2. 关于帧类型和时间戳

  • 确定帧类型会有哪些优点?
  • 使用编码器提供的时间戳会有哪些优点?

刚播的时候有些花屏

是跟gop有关么, 没有收到完整的一组GOP, 所以会花屏, 是不是应该等下一个I帧?

replace with pthread_create

Dear All,
in EventLoop.cpp has code as :
std::shared_ptrstd::thread thread(new std::thread(&TaskScheduler::Start, task_scheduler_ptr.get()));
thread->native_handle();
threads.push_back(thread);

How can I replace with pthread_create ? Please tell me way to use.
Thanks you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.