gstreamer-tips-picture-in-picture-compositing

http://www.oz9aec.net/index.php/gstreamer/347-more-gstreamer-tips-picture-in-picture-compositing

http://blog.sina.com.cn/s/blog_5106eff101018lsu.html

1. RTSP协议建立服务器(该代码是C,但看看我的客户端端代码,看看它如何的API是相当直截了当) 我修改了代码的URL

/* GStreamer
 * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
 * Copyright (c) 2012 enthusiasticgeek <[email protected]>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

//Edited by: enthusiasticgeek (c) 2012 for Stack Overflow Sept 11, 2012
//###########################################################################
//Important
//###########################################################################
//On ubuntu: sudo apt-get install libgstrtspserver-0.10-0 libgstrtspserver-0.10-dev
//Play with VLC
// CodeGo.net
//video decode only: gst-launch -v rtspsrc location=" CodeGo.net  ! rtph264depay ! ffdec_h264 ! autovideosink
//audio and video:
//gst-launch -v rtspsrc location=" CodeGo.net  name=demux demux. ! queue ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! autovideosink sync=false demux. ! queue ! rtppcmadepay ! alawdec ! autoaudiosink
//###########################################################################
#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>
/* define this if you want the resource to only be available when using
 * user/admin as the password */
#undef WITH_AUTH
/* this timeout is periodically run to clean up the expired sessions from the
 * pool. This needs to be run explicitly currently but might be done
 * automatically as part of the mainloop. */
static gboolean
timeout (GstRTSPServer * server, gboolean ignored)
{
 GstRTSPSessionPool *pool;
 pool = gst_rtsp_server_get_session_pool (server);
 gst_rtsp_session_pool_cleanup (pool);
 g_object_unref (pool);
 return TRUE;
}
int
main (int argc, char *argv[])
{
 GMainLoop *loop;
 GstRTSPServer *server;
 GstRTSPMediaMapping *mapping;
 GstRTSPMediaFactory *factory;
#ifdef WITH_AUTH
 GstRTSPAuth *auth;
 gchar *basic;
#endif
 gst_init (&argc, &argv);
 loop = g_main_loop_new (NULL, FALSE);
 /* create a server instance */
 server = gst_rtsp_server_new ();
 gst_rtsp_server_set_service(server,"8554"); //set the port #
 /* get the mapping for this server, every server has a default mapper object
 * that be used to map uri mount points to media factories */
 mapping = gst_rtsp_server_get_media_mapping (server);
#ifdef WITH_AUTH
 /* make a new authentication manager. it can be added to control access to all
 * the factories on the server or on individual factories. */
 auth = gst_rtsp_auth_new ();
 basic = gst_rtsp_auth_make_basic ("user", "admin");
 gst_rtsp_auth_set_basic (auth, basic);
 g_free (basic);
 /* configure in the server */
 gst_rtsp_server_set_auth (server, auth);
#endif
 /* make a media factory for a test stream. The default media factory can use
 * gst-launch syntax to create pipelines.
 * any launch line works as long as it contains elements named pay%d. Each
 * element with pay%d names will be a stream */
 factory = gst_rtsp_media_factory_new ();
 gst_rtsp_media_factory_set_launch (factory, "( "
  "videotestsrc ! video/x-raw-yuv,width=320,height=240,framerate=10/1 ! "
  "x264enc ! queue ! rtph264pay name=pay0 pt=96 ! audiotestsrc ! audio/x-raw-int,rate=8000 ! alawenc ! rtppcmapay name=pay1 pt=97 "")");
 /* attach the test factory to the /test url */
 gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
 /* don‘t need the ref to the mapper anymore */
 g_object_unref (mapping);
 /* attach the server to the default maincontext */
 if (gst_rtsp_server_attach (server, NULL) == 0)
 goto failed;
 /* add a timeout for the session cleanup */
 g_timeout_add_seconds (2, (GSourceFunc) timeout, server);
 /* start serving, this never stops */
 g_main_loop_run (loop);
 return 0;
 /* ERRORS */
failed:
 {
 g_print ("failed to attach the server\n");
 return -1;
 }
}

Makefile文件

# Copyright (c) 2012 enthusiasticgeek
# RTSP demo for Stack Overflow
sample:
 gcc -Wall -I/usr/include/gstreamer-0.10 rtsp.c -o rtsp `pkg-config --libs --cflags gstreamer-0.10 gstreamer-rtsp-0.10` -lglib-2.0 -lgstrtspserver-0.10 -lgstreamer-0.10

一旦你建立了二进制,简单来说它./rtsp然后打开另一个选项卡中的终端测试以下的pipeline。 测试解码流水线。它工作得很好!

gst-launch -v rtspsrc location=" CodeGo.net  name=demux demux. ! queue ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! autovideosink sync=false demux. ! queue ! rtppcmadepay ! alawdec ! autoaudiosink
 gst_rtsp_media_factory_set_launch (factory,      "( videotestsrc is-live=1 ! x264enc ! rtph264pay name=pay0 pt=96 )");
时间: 2024-08-14 20:21:08

gstreamer-tips-picture-in-picture-compositing的相关文章

A Complete Guide to the &lt;Picture&gt; Element

If you’ve ever struggled building responsive websites, this post is for you. It’s part of a series on responsive design, in particular responsive images, pulled from my book, Responsive Web Design. If you find this excerpt useful, and want even more

新生活......

搬到老校区两天了,宿舍的同学都很棒,虽然小黑屋很小,但是大家在一起觉得很惬意,今天在实验室呆了一天,觉得时间真的过得很快,觉得自己还有很多不会,应该用在实验室的时间加紧赶上,用师姐的一句话吧,生活还是需要梦想的.和旁边的师姐沟通,慢慢来学习,还不晚欧. 今天的收获: 0.对于不同的验证码有不同的处理方法,但是整合的方法还不太会 1.灰度化,就是对于一副彩色的图片,对于每一个像素,都是有R,G,B三个分量来各自分配比例调和出来的. RGB彩色图像可以看成是由3副单色的灰度图像构成的,可以直接取RG

OpenCV 数字验证码识别

本文针对OpenCv入门人士,因为我也不是专门做图像的,只是为了完成一次模式识别的小作业. 主要完成的功能就是自动识别图片中的数字,图片包括正常图片,有划痕图像和有噪点图像.分别如下 先上图,看识别效果! 接下来开始来点干货了: opencv的安装与配置:这个要是展开讲可以再写一篇博文了,我当时什么都不会配个opencv麻烦死了,最后参考网上studio2012的配置方法成功了,在此略过.看到这里你的opencv还不能用的话,赶紧别往下看了,先把opencv配好再来吧! opencv基本图片操作

Chromium网页Layer Tree绘制过程分析

网页绘图表面创建完成之后,调度器就会请求绘制CC Layer Tree,这样网页在加载完成之后就能快速显示出来.通过CC Layer Tree可以依次找到Graphics Layer Tree.Render Layer Tree和Render Object Tree.有了Render Object Tree之后,就可以执行具体的绘制工作了.接下来我们就分析网页CC Layer Tree的绘制过程. 老罗的新浪微博:http://weibo.com/shengyangluo,欢迎关注! CC La

SpringMVC处理multipart请求.

一.简述 multipart格式的数据会将一个表单拆分为多个部分(part),每个部分对应一个输入域.在一般的表单输入域中,它所对应的部分中会放置文本型数据,但是如果上传文件的话,它所对应的部分可以是二进制.类似这样: 二.配置multipart解析器 尽管multipart请求看起来很复杂,但在Spring MVC中处理它们却很容易.在编写控制器方法处理文件上传之前,我们必须要配置一个multipart解析器,通过它来告诉DispatcherServlet该如何读取multipart请求. S

以JPanel为基础实现一个图相框

代码: import java.awt.Graphics; import javax.swing.ImageIcon; import javax.swing.JPanel; public class Picture extends JPanel { private static final long serialVersionUID = -4437881316229152596L; private ImageIcon icon; public Picture(java.net.URL imgUR

【Bugly干货】关于 Android N 那些你不知道的事儿

今年3月,Google 破天荒提前半年发布了 Android N 开发者预览版.当然,作为一个不合格的谷粉并没有第一时间体验安装,因为至今仍然能够回忆起来去年今日此门中(雾)兴冲冲刷了 Android M Preview 的时候发现各种 Crash就连微信也(不出所料得)中招时自己一脸懵逼的心情.当然,为自己的机智而庆幸并没有过多久,很快就有微信好友(当然也是纯纯的谷粉)反馈微信又双叒叕在 Android 新版本下Crash了……好吧这次我们的时间很充裕,因为 5 个 preview 之后才会发

form里面文件上传并预览

其实form里面是不能嵌套form的,如果form里面有图片上传和其他input框,我们希望上传图片并预览图片,然后将其他input框填写完毕,再提交整个表单的话,有两种方式! 方式一:点击上传按钮的链接弹出上传页面,上传文件,上传完毕再返回表单页面:这种比较简单,其实就是表单页面的上传按钮仅仅是一个链接,仅用于打开上传文件的弹出页面: 方式二:就是表单里面有<input type="file" name="picture"/>,点击上传按钮后,会在上传

iOS - AVPlayer 音视频播放

iOS - AVPlayer 音视频播放 本文目录 前言 1.本地/网络音视频播放 2.本地/网络音视频播放设置 3.AVPlayerViewControllerDelegate 画中画协议方法 回到顶部 前言 NS_CLASS_AVAILABLE(10_7, 4_0) @interface AVPlayer : NSObject @available(iOS 4.0, *) public class AVPlayer : NSObject NS_CLASS_AVAILABLE_IOS(8_0)

GDI双缓冲绘图

一.简介 在进行复杂图形绘制时,若直接在屏幕DC上进行绘制,则会出现明显的闪烁.闪烁产生的原因是当绘制的图形较为 复杂时,图形绘制过程中就被刷新到屏幕上,导致结果断断续续地显示出来.双缓冲绘图的原理是在另开辟一块内存用于绘制,当所有绘制工作完成后将内存数据一 次性拷贝到屏幕上. 双缓冲绘图步骤: 创建兼容DC(CreateCompatibleDC) 创建兼容位图(CreateCompatibleBitmap) 将兼容位图选入兼容DC(SelectObject) 在兼容DC中进行绘制工作 将兼容D