简体   繁体   中英

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:

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"

This is the warning:

WARNING: erroneous pipeline: could not link queue0 to 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)?

Best, Sina

I think you are missing some encoder before mux. Just try this without audio(added 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:

gst-inspect-1.0 mpegtsmux

But it supports for example video/x-h264 - therefore the need for x264enc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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