[英]How to create a mp4 video file from PNG images using Gstreamer
I am playing with gstreamer command line interface and stuck while creating a mp4 video file from PNG images. 我正在玩gstreamer命令行界面,并在从PNG图像创建mp4视频文件时卡住了。 Can you guys please help to resolve this. 你们能帮忙解决这个问题吗?
Using below command I created PNG images from video camera: 使用以下命令,我从摄像机创建了PNG图像:
gst-launch-1.0.exe -v ksvideosrc ! gst-launch-1.0.exe -v ksvideosrc! queue ! 排队! decodebin ! 解码器! videoconvert ! 视频转换! pngenc ! pngenc! multifilesink location="frame%05d.png" multifilesink location =“ frame%05d.png”
I was able to play the pPNG images using below command: 我可以使用以下命令播放pPNG图像:
gst-launch-1.0 -v multifilesrc location="frame%05d.png" index=0 ! gst-launch-1.0 -v multifilesrc location =“ frame%05d.png” index = 0! pngdec ! pngdec! glimagesink glimagesink
But while creating a mp4 video from PNG images I received EOS from pipeline: 但是,当从PNG图像创建mp4视频时,我从管道中收到了EOS:
Setting pipeline to PAUSED ... Pipeline is PREROLLING ... /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-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)sRGB, framerate=(fraction)0/1 /GstPipeline:pipeline0/GstVideo 将管道设置为PAUSED ...管道正在预修... /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src:caps = image / png / GstPipeline:pipeline0 / GstDecodeBin:decodebin0 / GstPngParse:pngPased。下沉:caps = image / png /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstPngDec:pngdec0.GstPad:sink:caps = image / png,width =(int)640,height =(int)480 / GstPipeline:pipeline0 / GstDecodeBin: encodebin0 / 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,隔行扫描模式=(string)逐行,multiview-mode =(string)mono,multiview-flags =(GstVideoMultiviewFlagsSet) 0:ffffffff:/右视优先/左翻转/左翻转/右翻转/右翻转/半纵横/混合单,像素纵横比=(分数)1/1,色度= (string)sRGB,framerate =(fraction)0/1 / GstPipeline:pipeline0 / GstVideo Convert: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, pixel-aspect-ratio=(fraction)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, pixel-aspect-ratio=(fraction)1/1 Redistribute latency... /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 Convert:videoconvert0.GstPad:src:caps = video / x-raw,width =(int)640,height =(int)480,framerate =(fraction)0/1,format =(string)Y444,interlace-mode = (字符串)逐行,多视图模式=(字符串)单声道,多视图标志=(GstVideoMultiviewFlagsSet)0:ffffffff:/右视图优先/左翻转/左翻转/右翻转/右翻转/右翻转/半长宽比/混合单像素,像素长宽比=(分数)1/1 /GstPipeline:pipeline0/GstVideoRate:videorate0.GstPad:src:caps = video / x-raw,width =(int)640,height =(int )480,帧率=(分数)0/1,格式=(字符串)Y444,隔行扫描模式=(字符串)逐行,多视图模式=(字符串)单声道,多视图标志=(GstVideoMultiviewFlagsSet)0:ffffffff:/ right -view-first / left-flipped / left-flop / right-flipped / right-flop / half-aspect / mixed-mono,pixel-aspect-ratio =(fraction)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,隔行扫描模式=(字符串)渐进 , multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)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, pixel-aspect-ratio=(fraction)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-mono, pixel-aspect-ratio=(fract ,multiview-mode =(string)mono,multiview-flags =(GstVideoMultiviewFlagsSet)0:ffffffff:/右视图优先/左翻转/左翻转/右翻转/右翻转/半视角/混合-单声道,像素纵横比=(分数)1/1 / GstPipeline:管道0 / GstVideoRate:videorate0.GstPad:sink:caps = video / x-raw,width =(int)640,height =(int)480,framerate =(分数)0/1,格式=(字符串)Y444,隔行扫描模式=(字符串)逐行,多视图模式=(字符串)单声道,多视图标记=(GstVideoMultiviewFlagsSet)0:ffffffff:/右视图优先/左翻转/左翻转/右翻转/右翻转/半纵横/混合单像素,像素纵横比=(分数)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:/右视图优先/左翻转/左翻转/右翻转/右翻转/半视角/混合单声道,像素纵横比=(分数 ion)1/1, colorimetry=(string)sRGB, framerate=(fraction)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-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)sRGB, framerate=(fraction)0/1 /GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src: caps = video/x-h264, codec_data=(buffer)01f4001effe1001c67f4001e919b281407b602d41804150000030001773594000f162d9601000668ebec448440, stream-format=(string)avc, alignment=(string)au, level=(string)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=(st 离子)1/1,比色法=(字符串)sRGB,帧率=(分数)0/1 / GstPipeline:管道0 / GstDecodeBin:decodebin0.GstDecodePad:src_0.GstProxyPad:proxypad1:caps = video / x-raw,format =(string )RGB,宽度=(int)640,高度=(int)480,隔行扫描模式=(字符串)逐行,多视图模式=(字符串)单声道,多视图标记=(GstVideoMultiviewFlagsSet)0:ffffffff:/右视图-第一个/左翻转/左翻转/右翻转/右翻转/半纵横/混合单像素像素纵横比=(分数)1/1,比色法=(字符串)sRGB,帧率=(分数)0/1 /GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src:caps = video / x-h264,codec_data =(buffer)01f4001effe1001c67f4001e919b281407b602d41804150000030001773594000f162d9601000668ebec448440,字符串,水平) =(字符串)3,轮廓=(字符串)高4:4:4,宽度=(整数)640,高度=(整数)480,像素长宽比=(分数)1/1,帧率=(分数)0/1,隔行扫描模式=(字符串)逐行,比色法=(字符串)bt601,色度位=(字符串)jpeg,多视图模式=(st ring)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstQTMuxPad:video_0: caps = video/x-h264, codec_data=(buffer)01f4001effe1001c67f4001e919b281407b602d41804150000030001773594000f162d9601000668ebec448440, stream-format=(string)avc, alignment=(string)au, level=(string)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-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstPad:src: caps = video/quicktime, variant=(string)iso /GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/quicktime, variant=(strin ring)mono,multiview-flags =(GstVideoMultiviewFlagsSet)0:ffffffff:/右视图优先/左翻转/左翻转/右翻转/右翻转/半视角/混合单声道/ GstPipeline:pipeline0 / GstMP4Mux:mp4mux0.GstQTMuxPad:video_0:caps = video / x-h264,codec_data = {buffer)01f4001effe1001c67f4001e919b281407b602d41804150000030001773594000f162d9601000668ebec448440,stream-format = {string)avc,level = {string)高4:4:4,宽度=(整数)640,高度=(整数)480,像素长宽比=(分数)1/1,帧率=(分数)0/1,隔行扫描模式=(字符串)渐进式,色度=(字符串)bt601,色度位=(字符串)jpeg,多视图模式=(字符串)单声道,多视图标记=(GstVideoMultiviewFlagsSet)0:ffffffff:/右视图优先/左翻转/ left-flopd / right-flipped / right-flopped / half-aspect / mixed-mono /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstPad:src:caps = video / quicktime,variant =(string)iso / GstPipeline:pipeline0 / GstFileSink:filesink0.GstPad:sink:caps = video / quicktime,variant =(strin g)iso Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstPad:src: caps = video/quicktime, variant=(string)iso, streamheader=(buffer)< > /GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/quicktime, variant=(string)iso, streamheader=(buffer)< > Got EOS from element "pipeline0". g)iso管道已预卷...正在设置管道以进行播放...新时钟:GstSystemClock /GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstPad:src:caps = video / quicktime,variant =(string)iso,streamheader =(buffer )<> /GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink:caps = video / quicktime,variant =(string)iso,streamheader =(buffer)<>从元素“ pipeline0”获得了EOS。 Execution ended after 0:00:00.814042926 Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline … 0:00:00.814042926之后执行结束。将管道设置为PAUSED ...将管道设置为READY ...将管道设置为NULL ...释放管道...
To create a mp4 out of your png's you could use the following pipeline : 要从png中创建mp4,可以使用以下管道:
gst-launch-1.0 -e multifilesrc location="frame%05d.png" gst-launch-1.0 -e multifilesrc location =“ frame%05d.png”
caps="image/png,framerate=30/1" ! caps =“ image / png,framerate = 30/1”! pngdec ! pngdec! videoconvert ! 视频转换! queue ! 排队! x264enc ! x264enc! queue ! 排队! mp4mux ! mp4mux! filesink location=image.mp4 filesink location = image.mp4
Note: 注意:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.