Changes between Version 20 and Version 21 of gstreamer


Ignore:
Timestamp:
12/17/2020 10:03:56 PM (2 years ago)
Author:
Tim Harvey
Comment:

added colorimetry converstion to v4l2h264enc and v4l2jpegenc examples and a troubleshooting section

Legend:

Unmodified
Added
Removed
Modified
  • gstreamer

    v20 v21  
    604604gst-launch-1.0 v4l2src device=$DEVICE ! \
    605605     $GST_CONVERT output-io-mode=dmabuf-import ! \
     606     video/x-raw,colorimetry=bt709 ! \
    606607     v4l2h264enc output-io-mode=dmabuf-import ! \
    607608     rtph264pay ! udpsink host=$SERVER port=$PORT
     
    609610gst-launch-1.0 v4l2src device=$DEVICE ! \
    610611     $GST_CONVERT output-io-mode=dmabuf-import ! \
    611      video/x-raw,width=1440,height=960 ! \
     612     video/x-raw,width=1440,height=960,colorimetry=bt709 ! \
    612613     v4l2h264enc output-io-mode=dmabuf-import ! \
    613614     rtph264pay ! udpsink host=$SERVER port=$PORT
     
    615616gst-launch-1.0 v4l2src device=$DEVICE ! \
    616617     $GST_CONVERT output-io-mode=dmabuf-import extra-controls=cid,horizontal_flip=1 ! \
    617      video/x-raw,width=1440,height=960 ! \
     618     video/x-raw,width=1440,height=960,colorimetry=bt709 ! \
    618619     v4l2h264enc output-io-mode=dmabuf-import ! \
    619620     rtph264pay ! udpsink host=$SERVER port=$PORT
     
    621622gst-launch-1.0 v4l2src device=$DEVICE ! \
    622623     $GST_CONVERT output-io-mode=dmabuf-import extra-controls=cid,rotate=90 ! \
    623      video/x-raw,width=1440,height=960 ! \
     624     video/x-raw,width=1440,height=960,colorimetry=bt709 ! \
    624625     v4l2h264enc output-io-mode=dmabuf-import ! \
    625626     rtph264pay ! udpsink host=$SERVER port=$PORT
    626627}}}
     628 * note the above examples also use v4l2convert to convert to bt709 coloriemtry required by the encoder elements
    627629
    628630For anything not able to be handled by the video4linux2 element and any mem2mem drivers there are software based elements that can convert pixel colorspace and/or scale however note these are extremely CPU intensive:
     
    678680video4linux2:  v4l2mpeg4enc: V4L2 MPEG4 Encoder
    679681}}}
    680  * The CODA960 encoder requires NV12/I420/YV12 YUV pixel formats with rec709 colorimetry
     682 * The CODA960 encoder requires NV12/I420/YV12 YUV pixel formats with rec709 colorimetry (bt709)
    681683 * The CODA driver requires CMA memory for buffers when it is used. Make sure to provide the kernel with enough CMA memory with the kernel command-line (ie 'cma=64M' for 64MB which should be enough)
    682684 * Encoder and Decoder options are exposed through the v4l2 control IDs (CID) and can be listed with the v4l2-ctl -L and v4l2-ctl -l parameters on the devices exposed by the coda driver
     
    689691{{{#!bash
    690692# stream H264/RTP/UDP
    691 GST_CONVERT=$(gst-inspect-1.0 | grep -e "v4l2.*convert*" | sed -e 's/.*:\s*\(v4l2.*convert\):.*/\1/')
    692693gst-launch-1.0 v4l2src device=$DEVICE ! \
    693         $GST_CONVERT output-io-mode=dmabuf-import ! \
     694        $GST_CONVERT output-io-mode=dmabuf-import ! video/x-raw,colorimetry=bt709 ! \
    694695        v4l2h264enc output-io-mode=dmabuf-import ! \
    695696        rtph264pay ! udpsink host=$SERVER port=$PORT
     
    705706{{{#!bash
    706707# stream JPEG/RTP/UDP
    707 gst-launch-1.0 v4l2src device=$DEVICE ! v4l2jpegenc ! rtpjpegpay ! udpsink host=$SERVER port=$PORT
     708gst-launch-1.0 v4l2src device=$DEVICE ! \
     709        $GST_CONVERT output-io-mode=dmabuf-import ! video/x-raw,colorimetry=bt709 ! \
     710        v4l2jpegenc output-io-mode=dmabuf-import ! \
     711        rtpjpegpay ! udpsink host=$SERVER port=$PORT
    708712# client on $SERVER:$PORT could be viewing via 'gst-launch-1.0 udpsrc port=$PORT ! application/x-rtp,payload=96 ! rtpjpegdepay ! jpegdec ! autovideosink'
    709713}}}
     
    13571361If something doesn't work right, make sure all of the defaults being used in your pipeline element properties are correct. Many of the examples above or found online may omit the 'device' property from the source or sink elements which will make it default to the first appropriate device.
    13581362
     1363
     1364[=#GST_DEBUG]
     1365== gst-inspect and GST_DEBUG
    13591366You can see all the properties of a particular element with the 'gst-inspect <elementname>' command. You can see a list of all elements with 'gst-inspect' without arguments.
    13601367
     
    13641371
    13651372For example, if you wanted to see DEBUG level messages for the {{{videotestsrc}}} element you can set GST_DEBUG=videotestsrc:4
     1373
     1374== Colorspace and Colorimetry compatibility
     1375If you see errors such as 'Device wants bt709 colorimetry' you need to use the v4l2convert ($GST_CONVERT) element to convert your colorspace between elements. This is often needed between v4l2src capture devices and various CODA elements such as v4l2h264enc and vr4l2jpegenc.
     1376
     1377For example:
     1378{{{#!bash
     1379gst-launch-1.0 v4l2src device=$DEVICE ! \
     1380     $GST_CONVERT output-io-mode=dmabuf-import ! \
     1381     video/x-raw,colorimetry=bt709 ! \
     1382     v4l2h264enc output-io-mode=dmabuf-import ! \
     1383     rtph264pay ! udpsink host=$SERVER port=$PORT
     1384}}}
    13661385
    13671386== insufficient CMA memory when using CODA