简体   繁体   English

在 gstreamer 的管道中使用 mpegtsmux 录制视频

[英]using mpegtsmux in gstreamer's pipeline for recording video

I would like to capture a video stream (+audio) in MJPEG from my webcam into .mts container using this pipeline:我想使用以下管道将 MJPEG 格式的视频流(+音频)从我的网络摄像头捕获到 .mts 容器中:

gst-launch-1.0  v4l2src do-timestamp=true  device=/dev/video0 \ !    
'image/jpeg,framerate=30/1,width=1280,height=720' ! videorate \
! queue ! mux2.  pulsesrc do-timestamp=true \ 
device="alsa_input.pci-0000_00_1b.0.analog-stereo" !  \
'audio/x-raw,rate=88200,channels=1,depth=24' !  audioconvert ! \
 avenc_aac compliance=experimental ! queue ! \
  mux2. mpegtsmux name="mux2" ! filesink location=/home/sina/Webcam.mts

it seems that my pipeline doesn't recognize the mpegtsmux (?) when i use avimux or even matroskamux it works but as far as I know for MPEG-TS I need to use the correct muxer which is "mpegtsmux"当我使用 avimux 甚至 matroskamux 时,我的管道似乎无法识别 mpegtsmux (?)

This is the warning:这是警告:

WARNING: erroneous pipeline: could not link queue0 to mux2警告:错误的管道:无法将 queue0 链接到 mux2

Can you please tell me what part of my pipeline is wrong?你能告诉我我的管道的哪一部分是错误的吗? or what shall I change in order to get a timestamped video stream at the end (duration of the video must be shown when I play it via kdenlive or VLC)?或者我应该改变什么才能在最后获得带时间戳的视频流(当我通过 kdenlive 或 VLC 播放视频时必须显示视频的持续时间)?

Best, Sina最好的,新浪

I think you are missing some encoder before mux.我认为您在多路复用之前缺少一些编码器。 Just try this without audio(added x264enc):试试这个没有音频(添加 x264enc):

gst-launch-1.0 v4l2src device=/dev/video0 ! videorate ! queue ! x264enc ! mpegtsmux name="mux2" mux2. ! filesink location=bla.mts

The warning you are getting is saying it clearly.. it cannot link mux because the mux does not support capabilities image/jpeg.. just check the Capabilities section of sink pad with command:你得到的警告说得很清楚..它不能链接多路复用器,因为多路复用器不支持功能图像/jpeg ..只需使用命令检查接收器垫的功能部分:

gst-inspect-1.0 mpegtsmux

But it supports for example video/x-h264 - therefore the need for x264enc但它支持例如 video/x-h264 - 因此需要 x264enc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM