Cmd 将视频覆盖(或播放)在图像上作为背景-使用gstreamer

Cmd 将视频覆盖(或播放)在图像上作为背景-使用gstreamer,cmd,gstreamer,Cmd,Gstreamer,我正在做一个项目,在这个项目中,我需要显示一个视频,根据颜色“alpha键控”一个感兴趣的区域,并在图像上运行它,以便感兴趣区域下的图像在视频上可见 $ gst-launch-0.10 -e \ videomixer name=mix\ ! ffmpegcolorspace \ ! xvimagesink \ videotestsrc pattern=0 \ ! video/x-raw-yuv, framerate=1/1, width=350, heig

我正在做一个项目,在这个项目中,我需要显示一个视频,根据颜色“alpha键控”一个感兴趣的区域,并在图像上运行它,以便感兴趣区域下的图像在视频上可见

$ gst-launch-0.10 -e \
    videomixer name=mix\
    ! ffmpegcolorspace \
    ! xvimagesink \
    videotestsrc pattern=0 \
    ! video/x-raw-yuv, framerate=1/1, width=350, height=250 \
    ! textoverlay font-desc="Sans 24" text="CAM1" valign=top halign=left shaded-background=true \
    ! videobox border-alpha=0 top=-200 left=-50 \
    ! mix.
     multifilesrc location="drawing_total_mask_1.jpg" caps="image/jpeg,framerate=1/1"
    ! jpegdec \
    ! textoverlay font-desc="Sans 26" text="Live from Pl" halign=left shaded-background=true auto-resize=false \
    ! ffmpegcolorspace \
    ! video/x-raw-yuv,format=\(fourcc\)AYUV \
    ! mix.   
搜索它时,我发现类似这样的东西,它允许我在图像上显示测试视频(
videotestsrc
),但当我提供一个备用视频源时,它不会这样做

我用来给出我自己的源代码的代码以及它后面的错误

$ gst-launch-0.10 -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink    filesrc location = "asd.mp4" ! video/x-raw-yuv, framerate=1/1, width=350, height=250 !      textoverlay font-desc="Sans 24" text="CAM1" valign=top halign=left shaded-background=true !      videobox border-alpha=0 top=-200 left=-50 ! mix.   multifilesrc location=drawing_total_mask_1.jpg" caps="image/jpeg,framerate=1/1" ! jpegdec !      textoverlay font-desc="Sans 26" text="Live from Pl" halign=left shaded-background=true auto-resize=false !      ffmpegcolorspace ! video/x-raw-yuv,format=\(fourcc\)AYUV ! mix.
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstTextOverlay:textoverlay0: Could not multiplex stream.
Additional debug info:
gsttextoverlay.c(1848): gst_text_overlay_video_event (): /GstPipeline:pipeline0/GstTextOverlay:textoverlay0:
received non-TIME newsegment event on video input
WARNING: from element /GstPipeline:pipeline0/GstTextOverlay:textoverlay1: Could not multiplex stream.
Additional debug info:
gsttextoverlay.c(1848): gst_text_overlay_video_event (): /GstPipeline:pipeline0/GstTextOverlay:textoverlay1:
received non-TIME newsegment event on video input
ERROR: from element /GstPipeline:pipeline0/GstCapsFilter:capsfilter1: Filter caps do not completely specify the output format
Additional debug info:
gstcapsfilter.c(393): gst_capsfilter_prepare_buf (): /GstPipeline:pipeline0/GstCapsFilter:capsfilter1:
Output caps are unfixed: video/x-raw-yuv, framerate=(fraction)1/1, width=(int)350, height=(int)250, format=(fourcc){ AYUV, YUY2, Y444, UYVY, Y42B, YV12, I420, Y41B }
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
我找不到什么是正确的,我没有做,使它的工作

总之
我想要一个由我提供的带有透明alpha区域的视频,当在图像上运行时,它将在视频中感兴趣的alpha区域上显示图像。 任何帮助都将不胜感激


提前感谢。

您需要解复用并解码视频文件才能使用它。只需使用
filesrc!视频/x-raw-yuv
不会神奇地从mp4中提取视频数据。尝试类似于
h264parse!ffdec_h264
(如果您的mp4持有
h.264
编码数据)

我找到了一种方法来解决我在问题中提出的问题。我将它发布在这里,以帮助那些需要帮助的人

这将在图像上运行视频。 注意:如果视频有任何“橙色”区域,它将应用alpha键控透明度,下面的图像将显示在tranparent region.cheers上

gst-launch videomixer name=mix sink_0::alpha=1.0 sink_0::zorder=1 sink_1::zorder=2 
! ffmpegcolorspace ! xvimagesink filesrc location =vidoe.avi ! decodebin 
! alpha method=custom target-r=245 target-g=161 target-b=11 angle=10  
! ffmpegcolorspace ! mix.sink_1 multifilesrc location="image.jpg"
    caps="image/jpeg,framerate=1/1" 
! jpegdec 
! textoverlay font-desc="Sans 26" text="Live from Pl" halign=left 
    shaded-background=true auto-resize=false 
! ffmpegcolorspace ! video/x-raw-yuv,format=\(fourcc\)AYUV ! mix.sink_0

你能不能帮我把你说的话放在任何管道里作为例子,或者用上面的一个。谢谢