gstreamer - Gstreamer将相机视频输入保存到文件返回空文件
问题描述
我正在尝试从相机保存视频输入(也可以是逐帧),我可以像这样显示其输入:
gst-launch-1.0 udpsrc port=50004 ! application/x-rtp,encoding=JPEG,payload=26 ! rtpjpegdepay ! decodebin ! videoconvert ! autovideosink
我想将此视频以视频格式或逐帧保存到文件中。所以我试着跑
gst-launch-1.0 udpsrc port=50004 ! application/x-rtp,encoding=JPEG,payload=26 ! rtpjpegdepay ! decodebin ! videoconvert ! avimux ! filesink location=video.avi
但是我的 video.avi 文件是空的。我究竟做错了什么?我是 GStreamer 的初学者,我在网上找不到有用的信息,所以我无法弄清楚该管道的每个部分在做什么。
编辑
详细运行我得到这个:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = application/x-rtp, encoding=(string)JPEG, payload=(int)26, media=(string)video, clock-rate=(int)90000
/GstPipeline:pipeline0/GstRtpJPEGDepay:rtpjpegdepay0.GstPad:sink: caps = application/x-rtp, encoding=(string)JPEG, payload=(int)26, media=(string)video, clock-rate=(int)90000
/GstPipeline:pipeline0/GstRtpJPEGDepay:rtpjpegdepay0.GstPad:src: caps = image/jpeg, framerate=(fraction)0/1, width=(int)640, height=(int)480
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = image/jpeg, framerate=(fraction)0/1, width=(int)640, height=(int)480
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = image/jpeg, framerate=(fraction)0/1, width=(int)640, height=(int)480
[INFO] bitstreamMode 1, chromaInterleave 0, mapType 0, tiled2LinearEnable 0
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstImxVpuDecoder:imxvpudecoder0.GstPad:sink: caps = image/jpeg, framerate=(fraction)0/1, width=(int)640, height=(int)480
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:sink: caps = image/jpeg, framerate=(fraction)0/1, width=(int)640, height=(int)480
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink: caps = image/jpeg, framerate=(fraction)0/1, width=(int)640, height=(int)480
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstImxVpuDecoder:imxvpudecoder0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)640, height=(int)480, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)jpeg, colorimetry=(string)bt601, framerate=(fraction)0/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)640, height=(int)480, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)jpeg, colorimetry=(string)bt601, framerate=(fraction)0/1
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)640, height=(int)480, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)jpeg, colorimetry=(string)bt601, framerate=(fraction)0/1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstDecodePad:src_0.GstProxyPad:proxypad1: caps = video/x-raw, format=(string)I420, width=(int)640, height=(int)480, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)jpeg, colorimetry=(string)bt601, framerate=(fraction)0/1
解决方案
"encoding=JPEG"只是在管道的那个阶段指定 jpeg,但稍后由 decodebin 解码,从而产生未压缩的原始视频。
您可以检查您的 gstreamer 安装支持哪些编码器
gst-inspect-1.0 | grep enc
这也列出了音频编码器。可能你必须安装额外的 gstreamer 包来获得任何或更多的编码器,比如 gstreamer1.0-plugins-bad 或 gstreamer1.0-plugins-ugly(这个包包含 x264enc)。
然后再次尝试来自@Alper 的管道:
gst-launch-1.0 udpsrc port=50004 ! application/x-rtp,encoding=JPEG,payload=26 ! rtpjpegdepay \
! decodebin ! videoconvert ! x264enc ! avimux ! filesink location=video.avi
推荐阅读
- django - django中的QuesrySet错误
- python - 如何离线安装 Pytorch?
- php - 我怎样才能让我的销售价格与我的正常价格有不同的颜色?
- windows - 如何在windows的“omnidb”中将csv文件数据导入postgresql
- gradle - 如何改进并行 gradle 构建的构建失败报告?
- ios - 如何将触摸绘制的路径与给定的贝塞尔路径进行比较?
- git - 远程存储库上的 Git 操作失败(凭据管理器错误)
- java - 使用 exapnd/collaps 动画高度保持不变后,我在相对布局中有一些视图,但我想根据 java 代码进行更改
- excel - 如何选择下拉列表中的每个选项并单击按钮(同源策略问题 - 第二次迭代时权限被拒绝)
- javascript - 在 Jquery 中创建一个多数组给出错误