Tag: rtsp client

通过C代码实现的RTSP管道无法正常工作?

我的情景如下: – 我在端口554处设置了IP地址为192.168.1.24的RTSP服务器。我在客户端使用以下gst-launch命令来接收数据包,一切正常。 gst-launch rtspsrc location = rtsp://admin:admin123@192.168.1.24:554/axis-media/media.amp ! fakesink 但是当我通过C代码实现相同的东西时,它给了我错误。我的C代码如下: – #include #include static gboolean bus-call (GstBus *bus, GstMessage *msg, gpointer data) { GMainLoop *loop = (GMainLoop *) data; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_EOS: g_print (“End of stream\n”); g_main_loop_quit (loop); break; case GST_MESSAGE_ERROR: { gchar *debug; GError *error; gst_message_parse_error (msg, &error, &debug); g_free […]

使用FFmpeg libavformat记录RTSP流

我正试图用FFmpeg libavformat记录来自Axis相机的RTSP流。 我可以从文件中获取video,然后将其保存到另一个文件,这没关系。 但是摄像机发送奇怪的数据,FPS为100,摄像机每隔4帧发送一次,因此结果FPS约为25.但是libavformat设置数据包dts / pts为90000 fps(默认值?),新文件流有100fps。 结果是一小时video,只有100帧。 这是我的代码 #include #include #include #include #include int main(int argc, char** argv) { AVFormatContext* context = avformat_alloc_context(); int video_stream_index; av_register_all(); avcodec_register_all(); avformat_network_init(); //open rtsp if(avformat_open_input(&context, “rtsp://195.200.199.8/mpeg4/media.amp”,NULL,NULL) != 0){ return EXIT_FAILURE; } if(avformat_find_stream_info(context,NULL) < 0){ return EXIT_FAILURE; } //search video stream for(int i =0;inb_streams;i++){ if(context->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) video_stream_index = […]