Mixing multiple sources with different framerates

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Mixing multiple sources with different framerates

Eduardo Herraiz
Hi all,

I am trying to mix 3 different sources with Gstreamer.
 
I have 2 usb cams and a usb framegrabber capturing a VGA laptop exit.
http://ifisc.uib-csic.es/~edu/screens_gstreamer/allsources.png

It works, but with a very slow framerate. I suppose that is a problem with the different bitrates of the sources, because the framegrabber has a 10 fps an the others 25 fps.
And in console I can see errors, every second, like this: "There may be a timestamping problem, or this computer is too slow."
This is the command I used:
 gst-launch-0.10 \
  videomixer2 name=mix ! xvimagesink \
   v4l2src device="/dev/video0" ! video/x-raw-yuv,width=640,height=480 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
     videobox border-alpha=0 top=-384 left=0 ! mix. \
   v4l2src device="/dev/video1" ! video/x-raw-yuv,width=720,height=576 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
     videobox border-alpha=0 top=0 left=0 ! mix. \
   v4l2src device="/dev/video2" ! video/x-raw-yuv,width=1024,height=768 ! ffmpegcolorspace  ! \
      videobox border-alpha=0 top=0 left=-512 ! mix.

When I try without the slow source, seems to work properly.
http://ifisc.uib-csic.es/~edu/screens_gstreamer/twosources.png


I have no idea how to solve this and if is possible to merge, in a correct way, different sources with variable bitrates,
Anybody knows?

This link was helpful for me and I based my work on it:
http://www.oz9aec.net/index.php/gstreamer/347-more-gstreamer-tips-picture-in-picture-compositing

Thank you
Edu


--
*****************************************************************
Edu Herraiz - Web developer
http://www.eduherraiz.com

IFISC
Instituto de Física Interdisciplinar y Sistemas Complejos (CSIC-UIB)
email: [hidden email]
*****************************************************************


 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Mixing multiple sources with different framerates

Mike Mitchell
Eduardo,
Try adding a videorate element and queue to the end of each feed. It will probably also require forcing the caps on videomixer so that videorate knows what to match to. Videorate will duplicate or drop frames to sync the rates. Using "videorate silence=false" will show you each time a frame is added or dropped.  Remove it once you see it working. 

The three queues will thread your three inputs up to videomixer2 sink. 

I could not test this but here's a rough interpretation of my recommendation. Good luck.

 gst-launch-0.10 \
 videomixer2 name=mix ! 
video/x-raw-yuv,width=1536,height=1056, framerate=30/1 ! xvimagesink \
  v4l2src device="/dev/video0" ! video/x-raw-yuv,width=640,height=480 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
    videobox border-alpha=0 top=-384 left=0 ! 
"videorate silence=false" ! queue ! mix. \
  v4l2src device="/dev/video1" ! video/x-raw-yuv,width=720,height=576 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
    videobox border-alpha=0 top=0 left=0 ! 
"videorate silence=false" ! queue ! mix. \
  v4l2src device="/dev/video2" ! video/x-raw-yuv,width=1024,height=768 ! ffmpegcolorspace  ! \
     videobox border-alpha=0 top=0 left=-512 ! 
"videorate silence=false" ! queue ! mix.


Mike Mitchell





On Wed, Oct 5, 2011 at 3:56 AM, Eduardo Herraiz <[hidden email]> wrote:
Hi all,

I am trying to mix 3 different sources with Gstreamer.

I have 2 usb cams and a usb framegrabber capturing a VGA laptop exit.
http://ifisc.uib-csic.es/~edu/screens_gstreamer/allsources.png

It works, but with a very slow framerate. I suppose that is a problem with the different bitrates of the sources, because the framegrabber has a 10 fps an the others 25 fps.
And in console I can see errors, every second, like this: "There may be a timestamping problem, or this computer is too slow."
This is the command I used:
 gst-launch-0.10 \
 videomixer2 name=mix ! xvimagesink \
  v4l2src device="/dev/video0" ! video/x-raw-yuv,width=640,height=480 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
    videobox border-alpha=0 top=-384 left=0 ! mix. \
  v4l2src device="/dev/video1" ! video/x-raw-yuv,width=720,height=576 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
    videobox border-alpha=0 top=0 left=0 ! mix. \
  v4l2src device="/dev/video2" ! video/x-raw-yuv,width=1024,height=768 ! ffmpegcolorspace  ! \
     videobox border-alpha=0 top=0 left=-512 ! mix.

When I try without the slow source, seems to work properly.
http://ifisc.uib-csic.es/~edu/screens_gstreamer/twosources.png


I have no idea how to solve this and if is possible to merge, in a correct way, different sources with variable bitrates,
Anybody knows?

This link was helpful for me and I based my work on it:
http://www.oz9aec.net/index.php/gstreamer/347-more-gstreamer-tips-picture-in-picture-compositing

Thank you
Edu


--
*****************************************************************
Edu Herraiz - Web developer
http://www.eduherraiz.com

IFISC
Instituto de Física Interdisciplinar y Sistemas Complejos (CSIC-UIB)
email: [hidden email]
*****************************************************************



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Mixing multiple sources with different framerates

Eduardo Herraiz
In reply to this post by Eduardo Herraiz
Mike,

Thank you for the answer. :D
I think are a good recommendations but didn't work for me.

I have continued to your directions and this is the result:

gst-launch-0.10 \
 videomixer2 name=mix ! video/x-raw-yuv,width=1536,height=768,framerate=25/1 ! xvimagesink \
  v4l2src device="/dev/video0" ! video/x-raw-yuv,width=640,height=480 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
    videobox border-alpha=0 top=-384 left=0 ! videorate silent=false ! video/x-raw-yuv,framerate=25/1 ! queue ! mix. \
  v4l2src device="/dev/video1" ! video/x-raw-yuv,width=720,height=576 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
    videobox border-alpha=0 top=0 left=0 ! videorate silent=false ! video/x-raw-yuv,framerate=25/1 ! queue ! mix. \
  v4l2src device="/dev/video2" ! video/x-raw-yuv,width=1024,height=768 ! ffmpegcolorspace  ! \
     videobox border-alpha=0 top=0 left=-512 ! videorate silent=false ! video/x-raw-yuv,framerate=25/1 ! queue ! mix.

It works, but unimproved. The same framerate (1/1) like the last version.
I can't see any information about the frames dropped or added in console from videorate.
I still getting errors, every second:
""""""""""""
gstbasesink.c(2866): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
There may be a timestamping problem, or this computer is too slow.
""""""""""""

I will continue trying to configure videorate properly, but if you (or anybody) have a happy idea of how I can solve this, let me know. :D

Bests
Edu

--
*****************************************************************
Edu Herraiz - Web developer
http://www.eduherraiz.com
email: [hidden email]
*****************************************************************


 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Mixing multiple sources with different framerates

Eduardo Herraiz
In reply to this post by Eduardo Herraiz
Hi,

Looking for another solutions I tried with the option "sync=false" in the xvimagesink :
gst-launch-0.10 \
 videomixer2 name=mix ! video/x-raw-yuv,width=1536,height=768,framerate=25/1 ! xvimagesink sync=false \
  v4l2src device="/dev/video0" ! video/x-raw-yuv,width=640,height=480 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
    videobox border-alpha=0 top=-384 left=0 ! videorate silent=FALSE ! video/x-raw-yuv,framerate=25/1 ! queue ! mix. \
  v4l2src device="/dev/video1" ! video/x-raw-yuv,width=720,height=576 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
    videobox border-alpha=0 top=0 left=0 ! videorate silent=FALSE ! video/x-raw-yuv,framerate=25/1 ! queue ! mix. \
  v4l2src device="/dev/video2" ! video/x-raw-yuv,width=1024,height=768 ! ffmpegcolorspace  ! \
     videobox border-alpha=0 top=0 left=-512 ! videorate silent=FALSE ! video/x-raw-yuv,framerate=25/1 ! queue ! mix.

It works with a high framerate!!, but reading about sync option seems to be a debugging option:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-ximagesink.html

I can't see any information about dropped or added frames with videorate.

Can I use this option for a production application? What's wrong with this?

Bests
Edu

*****************************************************************
Edu Herraiz - Web developer
http://www.eduherraiz.com

IFISC
email: [hidden email]
*****************************************************************


 
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Mixing multiple sources with different framerates

Mike Mitchell
Edu,
Well there are no dropped frames now, your frame rates all match! Your original problem was different.  Using the sync option is fine, whatever works.

Mike Mitchell



On Thu, Oct 6, 2011 at 4:01 AM, Eduardo Herraiz <[hidden email]> wrote:
Hi,

Looking for another solutions I tried with the option "sync=false" in the xvimagesink :
gst-launch-0.10 \
 videomixer2 name=mix ! video/x-raw-yuv,width=1536,height=768,framerate=25/1 ! xvimagesink sync=false \
 v4l2src device="/dev/video0" ! video/x-raw-yuv,width=640,height=480 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
   videobox border-alpha=0 top=-384 left=0 ! videorate silent=FALSE ! video/x-raw-yuv,framerate=25/1 ! queue ! mix. \
 v4l2src device="/dev/video1" ! video/x-raw-yuv,width=720,height=576 ! videoscale ! video/x-raw-yuv,width=512,height=384 ! ffmpegcolorspace ! \
   videobox border-alpha=0 top=0 left=0 ! videorate silent=FALSE ! video/x-raw-yuv,framerate=25/1 ! queue ! mix. \
 v4l2src device="/dev/video2" ! video/x-raw-yuv,width=1024,height=768 ! ffmpegcolorspace  ! \
    videobox border-alpha=0 top=0 left=-512 ! videorate silent=FALSE ! video/x-raw-yuv,framerate=25/1 ! queue ! mix.

It works with a high framerate!!, but reading about sync option seems to be a debugging option:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-ximagesink.html

I can't see any information about dropped or added frames with videorate.

Can I use this option for a production application? What's wrong with this?

Bests
Edu

*****************************************************************
Edu Herraiz - Web developer
http://www.eduherraiz.com

IFISC
email: [hidden email]
*****************************************************************



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel