【ARM-Linux开发】TI 关于Gstreamer使用的几个参考
http://processors.wiki.ti.com/index.php/Example_GStreamer_Pipelines#H.264_RTP_Streaming
http://processors.wiki.ti.com/index.php/GStreamer
https://gstreamer.freedesktop.org/documentation/application-development/basics/helloworld.html
https://github.com/GStreamer/gst-examples
https://github.com/GStreamer/gst-rtsp-server/tree/master/examples
https://gstreamer.ti.com/gf/project/gstreamer_ti/scmsvn/?action=browse&path=%2Fbranches%2F
https://gstreamer.freedesktop.org/documentation/rtp.html
https://gstreamer.freedesktop.org/
https://gstreamer.ti.com/gf/project/gstreamer_ti/
最近做一个项目是要用OpenCV来加工处理rtsp流,直接用opencv 中自带的VideoCapture video(rtsp://192.168.1.221:554)这种方式能够拉到rtsp流,但是很容易解码错误,毕竟opencv也不是做视频解码的,后来决定用vlc来处理,代码如下。
#include "libvlc.h"
#include "libvlc_media.h"
#include "libvlc_media_player.h"
#include <opencv2\opencv.hpp>
#include <opencv2\video\background_segm.hpp>
#include "opencv2/imgproc.hpp"
#include <opencv2/highgui.hpp>
#include <opencv2/video.hpp>
#include <opencv2/objdetect.hpp>
Mat videobuf;
void* lock(void *data, void**p_pixels)
{
*p_pixels = videobuf.data;
return NULL;
}
void VideoShow::rtspstream()
{
videobuf.create(height,width,CV_8UC3);
libvlc_media_t* media = NULL;
libvlc_media_player_t* mediaPlayer = NULL;
char const* vlc_args[] =
{
"-I",
"dummy",
"--ignore-config",
};
libvlc_instance_t* instance = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);
media = libvlc_media_new_location(instance, "rtsp://192.168.1.221:554");
mediaPlayer = libvlc_media_player_new_from_media(media);
//libvlc_media_player_set_media(mediaPlayer, media);
libvlc_video_set_callbacks(mediaPlayer, lock, NULL, NULL, NULL);
libvlc_video_set_format(mediaPlayer, "RV24", width, height, width*24/8);
libvlc_media_release(media);
for(int i=0;i<5;i++)
{
libvlc_media_player_play(mediaPlayer);
Sleep(500);
}
}
int main()
{
Mat show ;
while(true){
show = videobuf;
imshow("rtsp",show);
waitKey(30);
}
}