【问题标题】:How to create a mp4 video file from PNG images using Gstreamer如何使用 Gstreamer 从 PNG 图像创建 mp4 视频文件
【发布时间】:2019-09-17 23:08:11
【问题描述】:

我正在使用 gstreamer 命令行界面,在从 PNG 图像创建 mp4 视频文件时卡住了。请各位大神帮忙解决一下。

使用以下命令,我从摄像机创建了 PNG 图像:

gst-launch-1.0.exe -v ksvideosrc !队列 !解码器!视频转换! ! multifilesink location="frame%05d.png"

我可以使用以下命令播放 pPNG 图像:

gst-launch-1.0 -v multifilesrc location="frame%05d.png" index=0 !解码器! glimagesink

但在从 PNG 图像创建 mp4 视频时,我从管道收到了 EOS:

将管道设置为 PAUSED ... 管道正在预滚... /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = image/png /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngParse:pngparse0.GstPad:sink: caps = image/png /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngDec:pngdec0.GstPad:sink: caps = image/png, width=(int)640, height=(int)480 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngParse:pngparse0.GstPad:src: caps = image/png, width=(int)640, height=(int)480 /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngDec:pngdec0.GstPad:src: caps = video/x-raw, format=(string)RGB, width=(int)640, height=(int)480, interlace-mode= (string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-纵横比/混合单声道,像素纵横比=(分数)1/1,色度=(字符串)sRGB,帧率=(分数)0/1 /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, width=(int)640, height=(int)480, framerate=(fraction)0/1, format=(string)Y444 , interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right -flopped/half-aspect/mixed-mono,像素纵横比=(分数)1/1 /GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:src: caps = video/x-raw, width=(int)640, height=(int)480, framerate=(fraction)0/1, format=(string)Y444 , interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right -flopped/half-aspect/mixed-mono,像素纵横比=(分数)1/1 重新分配延迟... /GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:sink: caps = video/x-raw, width=(int)640, height=(int)480, framerate=(fraction)0/1, format=(string)Y444 , interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right -flopped/half-aspect/mixed-mono,像素纵横比=(分数)1/1 /GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:sink: caps = video/x-raw, width=(int)640, height=(int)480, framerate=(fraction)0/1, format=(string)Y444 , interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right -flopped/half-aspect/mixed-mono,像素纵横比=(分数)1/1 /GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)RGB, width=(int)640, height=(int)480, interlace-mode=(string)progressive , multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-单声道,像素纵横比=(分数)1/1,色度=(字符串)sRGB,帧率=(分数)0/1 /GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0.GstProxyPad:proxypad1: caps = video/x-raw, format=(string)RGB, width=(int)640, height=(int)480, interlace-mode= (string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-纵横比/混合单声道,像素纵横比=(分数)1/1,色度=(字符串)sRGB,帧率=(分数)0/1 /GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src:帽=视频/ X-H264,codec_data =(缓冲液)01f4001effe1001c67f4001e919b281407b602d41804150000030001773594000f162d9601000668ebec448440,流格式=(字符串)AVC中,对准=(字符串)AU,电平=(字符串)3 , profile=(string)high-4:4:4, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)0/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, chroma-site=(string)jpeg, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-第一/左翻转/左翻转/右翻转/右翻转/半纵横比/混合单声道 /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstQTMuxPad:video_0:帽=视频/ X-H264,codec_data =(缓冲液)01f4001effe1001c67f4001e919b281407b602d41804150000030001773594000f162d9601000668ebec448440,流格式=(字符串)AVC中,对准=(字符串)AU,电平=(字符串)3 , profile=(string)high-4:4:4, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)0/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, chroma-site=(string)jpeg, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-第一/左翻转/左翻转/右翻转/右翻转/半纵横比/混合单声道 /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstPad:src: caps = video/quicktime, variant=(string)iso /GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/quicktime, variant=(string)iso 管道预装... 将管道设置为 PLAYING ... 新时钟:GstSystemClock /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstPad:src:帽=视频/ QuickTime的,变体=(字符串)异,streamheader =(缓冲) /GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink:帽=视频/ QuickTime的,变体=(字符串)异,streamheader =(缓冲) 从元素“pipeline0”获得 EOS。 执行在 0:00:00.814042926 之后结束 将管道设置为 PAUSED ... 将管道设置为 READY ... 将管道设置为 NULL ... 释放管道……

【问题讨论】:

    标签: video gstreamer gstreamer-1.0


    【解决方案1】:

    要从您的 png 文件中创建一个 mp4,您可以使用以下管道:

    gst-launch-1.0 -e multifilesrc location="frame%05d.png"
    大写=“图像/png,帧率=30/1”!解码器!视频转换!队列 ! x264enc !队列 ! mp4 多路复用器!文件接收位置=image.mp4

    注意:

    1. 如果您只需要 60fps 的视频,以上将创建一个 30fps 的 mp4 将 multifilesrc 中的大写更改为 caps="image/png,framerate=60/1" 对于 60fps 的视频。
    2. 如果您有任何特定硬件,您也可以更改编码器 编码器。

    【讨论】:

    猜你喜欢
    • 2013-08-03
    • 2018-05-08
    • 2014-08-24
    • 1970-01-01
    • 2020-09-14
    • 1970-01-01
    • 1970-01-01
    • 2021-09-02
    • 1970-01-01
    相关资源
    最近更新 更多