Mix two videos

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Mix two videos

bradox
I am trying to use gstreamer to mix two videos in one file so one displays besides the other....I have tested with avi and flv files and here is my code and the outcome:

gst-launch -v \
filesrc location=video1.avi ! avidemux name=demux1 \
filesrc location=video2.avi ! avidemux name=demux2 \
videomixer name=mix \
        sink_0::xpos=0   sink_0::ypos=0 sink_0::alpha=0 \
        sink_1::xpos=0   sink_1::ypos=0 \
        sink_2::xpos=320 sink_2::ypos=0 \
    ! xvimagesink \
videotestsrc pattern="black" \
    ! video/x-raw-yuv,width=640,height=240 \
    ! mix.sink_0 \
demux1.video_00 \
    ! queue ! decodebin ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=320,height=240 \
    ! mix.sink_1 \
demux2.video_00 \
    ! queue ! decodebin ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=320,height=240 \
    ! mix.sink_2 \

and I get:

ne:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)640, height=(int)240, framerate=(fraction)30/1
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)640, height=(int)240, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)640, height=(int)240, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstVideoMixer:mix.GstVideoMixerPad:sink_0: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)640, height=(int)240, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)24/1, width=(int)400, height=(int)226
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)24/1, width=(int)400, height=(int)226
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)24/1, width=(int)400, height=(int)226
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)25/1, width=(int)320, height=(int)240
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)25/1, width=(int)320, height=(int)240
/GstPipeline:pipeline0/GstDecodeBin:decodebin1/GstTypeFindElement:typefind.GstPad:src: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)25/1, width=(int)320, height=(int)240
/GstPipeline:pipeline0/GstDecodeBin:decodebin1/GstTypeFindElement:typefind.GstPad:sink: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)25/1, width=(int)320, height=(int)240
/GstPipeline:pipeline0/GstDecodeBin:decodebin1.GstGhostPad:sink: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)25/1, width=(int)320, height=(int)240
/GstPipeline:pipeline0/GstDecodeBin:decodebin1.GstGhostPad:sink.GstProxyPad:proxypad1: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)25/1, width=(int)320, height=(int)240
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:sink: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)24/1, width=(int)400, height=(int)226
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)24/1, width=(int)400, height=(int)226
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)24/1, width=(int)400, height=(int)226
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/ffdec_msmpeg4v2:ffdec_msmpeg4v20.GstPad:sink: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)24/1, width=(int)400, height=(int)226
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:src0: caps = video/x-raw-yuv, width=(int)400, height=(int)226, framerate=(fraction)24/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/ffdec_msmpeg4v2:ffdec_msmpeg4v20.GstPad:src: caps = video/x-raw-yuv, width=(int)400, height=(int)226, framerate=(fraction)24/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstDecodeBin:decodebin1/ffdec_msmpeg4v2:ffdec_msmpeg4v21.GstPad:sink: caps = video/x-msmpeg, msmpegversion=(int)42, framerate=(fraction)25/1, width=(int)320, height=(int)240
/GstPipeline:pipeline0/GstDecodeBin:decodebin1.GstGhostPad:src0: caps = video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstDecodeBin:decodebin1/ffdec_msmpeg4v2:ffdec_msmpeg4v21.GstPad:src: caps = video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp1.GstPad:src: caps = video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp1.GstPad:sink: caps = video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstDecodeBin:decodebin1.GstGhostPad:src0.GstProxyPad:proxypad3: caps = video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstVideoScale:videoscale1.GstPad:src: caps = video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstVideoScale:videoscale1.GstPad:sink: caps = video/x-raw-yuv, width=(int)320, height=(int)240, framerate=(fraction)25/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp0.GstPad:src: caps = video/x-raw-yuv, width=(int)400, height=(int)226, framerate=(fraction)24/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp0.GstPad:sink: caps = video/x-raw-yuv, width=(int)400, height=(int)226, framerate=(fraction)24/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:src0.GstProxyPad:proxypad2: caps = video/x-raw-yuv, width=(int)400, height=(int)226, framerate=(fraction)24/1, format=(fourcc)I420, interlaced=(boolean)false
ERROR: from element /GstPipeline:pipeline0/GstAviDemux:demux2: Internal data stream error.
Additional debug info:
gstavidemux.c(5071): gst_avi_demux_loop (): /GstPipeline:pipeline0/GstAviDemux:demux2:
streaming stopped, reason not-negotiated
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
/GstPipeline:pipeline0/GstVideoMixer:mix.GstVideoMixerPad:sink_0: caps = NULL
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)I420, width=(int)320, height=(int)240, framerate=(fraction)24/1, interlaced=(boolean)false
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:sink: caps = video/x-raw-yuv, width=(int)400, height=(int)226, framerate=(fraction)24/1, format=(fourcc)I420, interlaced=(boolean)false
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstVideoScale:videoscale0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstVideoScale:videoscale1.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstVideoScale:videoscale1.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp1.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstFFMpegCsp:ffmpegcsp1.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:src0: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/ffdec_msmpeg4v2:ffdec_msmpeg4v20.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/ffdec_msmpeg4v2:ffdec_msmpeg4v20.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin1.GstGhostPad:src0: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin1/ffdec_msmpeg4v2:ffdec_msmpeg4v21.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin1/ffdec_msmpeg4v2:ffdec_msmpeg4v21.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin1/GstTypeFindElement:typefind.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin1/GstTypeFindElement:typefind.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstDecodeBin:decodebin1.GstGhostPad:sink: caps = NULL
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstAviDemux:demux2.GstPad:audio_00: caps = NULL
/GstPipeline:pipeline0/GstAviDemux:demux2.GstPad:video_00: caps = NULL
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstAviDemux:demux1.GstPad:audio_00: caps = NULL
/GstPipeline:pipeline0/GstAviDemux:demux1.GstPad:video_00: caps = NULL
Freeing pipeline ...



and in the other test

gst-launch -v \
filesrc location=screenrec_1.flv ! flvdemux name=demux1 \
filesrc location=facerec_1.flv ! flvdemux name=demux2 \
videomixer name=mix \
      sink_0::xpos=0   sink_0::ypos=0 sink_0::alpha=0 \
      sink_1::xpos=0   sink_1::ypos=0 \
      sink_2::xpos=1280 sink_2::ypos=0 \
  ! xvimagesink \
videotestsrc pattern="black" \
  ! video/x-raw-yuv,width=1600,height=800 \
  ! mix.sink_0 \
demux1.video_00 \
  ! queue ! decodebin ! ffmpegcolorspace ! videoscale \
  ! video/x-raw-yuv,width=1280,height=800 \
  ! mix.sink_1 \
demux2.video_00 \
  ! queue ! decodebin ! ffmpegcolorspace ! videoscale \
  ! video/x-raw-yuv,width=320,height=240 \
  ! mix.sink_2 \

I get:

Setting pipeline to PAUSED ...
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)1600, height=(int)800, framerate=(fraction)30/1
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)1600, height=(int)800, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)1600, height=(int)800, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstVideoMixer:mix.GstVideoMixerPad:sink_0: caps = video/x-raw-yuv, format=(fourcc)AYUV, width=(int)1600, height=(int)800, framerate=(fraction)30/1


and stays like that for ever


In neither of the cases I get a video....what am I doing wrong?

thanks