0

I have 2 script : A server that send a h264 video stream and a client that plays the stream. Both uses gstreamer-1.0. Here is the code of the client:

DEST=10.2.2.30
LATENCY=0

VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"


VIDEO_DEC="rtph264depay ! avdec_h264 max_threads=0"

VIDEO_SINK="videoconvert ! videoscale  ! autovideosink sync=false async=false"


gst-launch-1.0 -v rtpbin name=rtpbin latency=$LATENCY                                  \
     udpsrc caps=$VIDEO_CAPS port=6000 ! rtpbin.recv_rtp_sink_0                       \
       rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK                                             \
     udpsrc port=6001 ! rtpbin.recv_rtcp_sink_0                                       \
         rtpbin.send_rtcp_src_0 ! udpsink port=6005 host=$DEST sync=false async=false

Instead of playing the stream, I would like to record it to a yuv file. how can I do that ?

user655561
  • 659
  • 1
  • 9
  • 24

1 Answers1

2

Just replace autovideosink with a filesink, and potentially a capsfilter to decide which YUV-format you want. So for I420 you could do something like:

VIDEO_SINK="videoconvert ! 'video/x-raw,format=(string)I420' ! filesink location=myfile.yuv sync=false async=false"

or if you want a specific resolution:

VIDEO_SINK="videoconvert ! videoscale ! 'video/x-raw,format=(string)I420,width=1280,height=720' ! filesink location=myfile.yuv sync=false async=false"

Hope that helps.

Havard Graff
  • 2,805
  • 1
  • 15
  • 16