尝试在 Gstreamer 中同时播放多个视频文件

发布于 2024-12-04 10:29:54 字数 1842 浏览 0 评论 0原文

我正在尝试为 gstreamer 创建一个命令,以便它可以同时播放多个视频文件。所以我做了一些研究,发现了这个

gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
    videotestsrc pattern=1 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=0 left=0 ! mix. \
    videotestsrc pattern=15 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=0 left=-320 ! mix. \
    videotestsrc pattern=13 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=-180 left=0 ! mix. \
    videotestsrc pattern=0 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=-180 left=-320 ! mix. \
    videotestsrc pattern=3 ! video/x-raw-yuv, framerate=5/1, width=640, height=360 ! mix.

这是输出图像= https://i.sstatic.net/ 4lZWL.png

这是我修改的代码,应该是这样的

https://i.sstatic.net/Mdsc0.png

time gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=0 left=0 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=0 left=-320 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=-180 left=0 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=-180 left=-320 ! mix. 

但它不起作用。有人有其他解决方案吗?

Im trying to make a command for gstreamer so it can play multiple video files simultaneously. So I done some research and found this one

gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
    videotestsrc pattern=1 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=0 left=0 ! mix. \
    videotestsrc pattern=15 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=0 left=-320 ! mix. \
    videotestsrc pattern=13 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=-180 left=0 ! mix. \
    videotestsrc pattern=0 ! video/x-raw-yuv, framerate=5/1, width=320, height=180 ! \
    videobox border-alpha=0 top=-180 left=-320 ! mix. \
    videotestsrc pattern=3 ! video/x-raw-yuv, framerate=5/1, width=640, height=360 ! mix.

This is the output image= https://i.sstatic.net/4lZWL.png

and here is the code that i modified that suppose to be like this

https://i.sstatic.net/Mdsc0.png

time gst-launch -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=0 left=0 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=0 left=-320 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=-180 left=0 ! mix. \
    filesrc location=./Cityscape1Min_720p_mp4.mp4 ! video/x-raw-yuv, framerate=5/1, \
        width=320, height=180 ! videobox border-alpha=0 top=-180 left=-320 ! mix. 

But it does not work. Anyone have other solutions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南城旧梦 2024-12-11 10:29:54

我喜欢这种方法,它会创建一个 2x2 的矩阵。 sink_0 是您的背景,您也可以将其设置为图像。有关画中画<的更多信息/a>.

gst-launch -e \
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=200 sink_2::ypos=0 \
        sink_3::xpos=0   sink_3::ypos=100 \
        sink_4::xpos=200 sink_4::ypos=100 \
    ! xvimagesink \
videotestsrc pattern="black" \
    ! video/x-raw-yuv,width=400,height=200 \
    ! mix.sink_0 \
uridecodebin uri='file:///home/user/video/test1.mp4' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_1 \
uridecodebin uri='file:///home/user/video/test2.mp4' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_2 \
uridecodebin uri='file:///home/user/video/test.avi' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_3 \
uridecodebin uri='mms://server/video/test.wmv' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_4 \

I like this approach, it will create a matrix of 2x2. sink_0 is your background, you can also set it as an image. More info on picture in picture.

gst-launch -e \
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=200 sink_2::ypos=0 \
        sink_3::xpos=0   sink_3::ypos=100 \
        sink_4::xpos=200 sink_4::ypos=100 \
    ! xvimagesink \
videotestsrc pattern="black" \
    ! video/x-raw-yuv,width=400,height=200 \
    ! mix.sink_0 \
uridecodebin uri='file:///home/user/video/test1.mp4' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_1 \
uridecodebin uri='file:///home/user/video/test2.mp4' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_2 \
uridecodebin uri='file:///home/user/video/test.avi' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_3 \
uridecodebin uri='mms://server/video/test.wmv' \
    ! ffmpegcolorspace ! videoscale \
    ! video/x-raw-yuv,width=200,height=100 \
    ! mix.sink_4 \
韶华倾负 2024-12-11 10:29:54

从所有实际视频中删除 framerate=5/1。对我来说,只有 videotestsrc 可以使用 framerate capfilter 进行修改。

gst-launch-0.10 -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
    uridecodebin uri=file:///home/user/Desktop/sintel_trailer-480p.webm ! \
            ffmpegcolorspace ! videoscale ! \
            video/x-raw-yuv, width=320, height=180 ! \
            videobox border-alpha=0 top=0 left=0 ! mix. \
    videotestsrc pattern=15 ! \
            video/x-raw-yuv, width=320, height=180 ! \
            videobox border-alpha=0 top=0 left=-320 ! mix. \
    videotestsrc pattern=13 ! \
            video/x-raw-yuv, width=320, height=180 ! \
            videobox border-alpha=0 top=-180 left=0 ! mix. \
    videotestsrc pattern=0 ! \
            video/x-raw-yuv, width=320, height=180 ! \
            videobox border-alpha=0 top=-180 left=-320 ! mix. \
    videotestsrc pattern=3 ! \
            video/x-raw-yuv, framerate=5/1, width=640, height=360 ! mix.

Remove framerate=5/1 from all your actual videos. For me, only videotestsrc can be modified with framerate capfilter.

gst-launch-0.10 -e videomixer name=mix ! ffmpegcolorspace ! xvimagesink \
    uridecodebin uri=file:///home/user/Desktop/sintel_trailer-480p.webm ! \
            ffmpegcolorspace ! videoscale ! \
            video/x-raw-yuv, width=320, height=180 ! \
            videobox border-alpha=0 top=0 left=0 ! mix. \
    videotestsrc pattern=15 ! \
            video/x-raw-yuv, width=320, height=180 ! \
            videobox border-alpha=0 top=0 left=-320 ! mix. \
    videotestsrc pattern=13 ! \
            video/x-raw-yuv, width=320, height=180 ! \
            videobox border-alpha=0 top=-180 left=0 ! mix. \
    videotestsrc pattern=0 ! \
            video/x-raw-yuv, width=320, height=180 ! \
            videobox border-alpha=0 top=-180 left=-320 ! mix. \
    videotestsrc pattern=3 ! \
            video/x-raw-yuv, framerate=5/1, width=640, height=360 ! mix.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文