Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
raw [2020/03/29 17:03] – [GRAY8 vs RTP] yair | raw [2020/05/05 02:27] – [strides and offsets] yair | ||
---|---|---|---|
Line 4: | Line 4: | ||
**solution**: | **solution**: | ||
- | map the GRAY8 **one plane** source into a quarter width **four plane** RGBA output image\\ | + | a image formats are **just a convention**, internally they are byte(octet) streams. |
- | we will then remap it to Y8 on the receiving side. \\ | + | |
- | the trick is to use gstreamer built in forma spec and let it optimize | + | view the image format as just a stream of octets. here is our stream in Y8 format |
+ | | ||
+ | | ||
+ | | ||
+ | and again, data quartered and represented in 8 bit depth and with stride of 4 | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | note the above represents two sequential pixels. | ||
+ | |||
+ | the trick is to use gstreamer built in [[https:// | ||
the [[https:// | the [[https:// | ||
Line 15: | Line 26: | ||
as easy as \\ | as easy as \\ | ||
<code dot> | <code dot> | ||
- | gst-launch-1.0 | + | gst-launch-1.0 |
+ | | ||
! video/ | ! video/ | ||
! identity dump=1 \ | ! identity dump=1 \ | ||
! rawvideoparse format=rgba width=1 height=4 \ | ! rawvideoparse format=rgba width=1 height=4 \ | ||
! identity dump=1 \ | ! identity dump=1 \ | ||
- | ! filesink location=rgb12 -q \ | + | ! fakesink |
- | && hexyl -v rgb12 | + | |
00000000 (0x7f369c00a8c0): | 00000000 (0x7f369c00a8c0): | ||
00000000 (0x556228700560): | 00000000 (0x556228700560): | ||
- | ┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐ | ||
- | │00000000│ eb eb eb eb eb eb eb eb ┊ eb eb eb eb eb eb eb eb │××××××××┊××××××××│ | ||
- | └────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘ | ||
</ | </ | ||
+ | **note**: why white pixel is not FF=(255)?\\ | ||
+ | gstreamer uses YUV colorimetry when generating a GRAY8 test image \\ | ||
+ | and YUV doesnt use the entire 0-255 space. [[https:// | ||
+ | |||
+ | |||
+ | |||
+ | ====FakeRawPay==== | ||
+ | gray8 raw video transported as RTP payload via a " | ||
+ | conforming to [[https:// | ||
+ | pay | ||
+ | <code dot> | ||
+ | gst-launch-1.0 -v \ | ||
+ | videotestsrc pattern=white is-live=1 \ | ||
+ | ! video/ | ||
+ | ! rawvideoparse width=1 height=4 format=rgba \ | ||
+ | ! rtpvrawpay \ | ||
+ | ! queue \ | ||
+ | ! udpsink host=localhost port=5000 | ||
+ | </ | ||
+ | depay and back to gray8 | ||
+ | <code dot> | ||
+ | gst-launch-1.0 -v \ | ||
+ | udpsrc port=5000 \ | ||
+ | ! " | ||
+ | ! rtpvrawdepay \ | ||
+ | ! queue \ | ||
+ | ! rawvideoparse width=4 height=4 format=gray8 \ | ||
+ | ! videoconvert \ | ||
+ | ! fpsdisplaysink | ||
+ | </ | ||
+ | | ||
+ | |||
+ | |||
====strides and offsets==== | ====strides and offsets==== | ||
- | rawvideoparse let you specify | + | |
- | **(Syntax is < | + | there are caveats to this approach (yuv). get the hammer |
+ | |||
+ | |||
+ | {{ : | ||
< | < | ||
Line 76: | Line 120: | ||
</ | </ | ||
- | {{ : | ||
<hidden extended format view> | <hidden extended format view> | ||
Line 123: | Line 166: | ||
</ | </ | ||
- | See raw video format [[https:// | + | <hidden more digging> |
- | + | ||
- | + | ||
- | ====FakeRawPay==== | + | |
- | gray8 raw video transported as RTP payload via a " | + | |
- | conforming to [[https:// | + | |
- | pay | + | |
- | <code dot> | + | |
- | gst-launch-1.0 -v \ | + | |
- | videotestsrc pattern=white is-live=1 \ | + | |
- | ! video/ | + | |
- | ! rawvideoparse width=1 height=4 format=rgba \ | + | |
- | ! rtpvrawpay \ | + | |
- | ! queue \ | + | |
- | ! udpsink host=localhost port=5000 | + | |
- | </ | + | |
- | depay and back to gray8 | + | |
- | <code dot> | + | |
- | gst-launch-1.0 -v \ | + | |
- | udpsrc port=5000 \ | + | |
- | ! " | + | |
- | ! rtpvrawdepay \ | + | |
- | ! queue \ | + | |
- | ! rawvideoparse width=4 height=4 format=gray8 \ | + | |
- | ! videoconvert \ | + | |
- | ! fpsdisplaysink | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ====raw parsing==== | + | |
- | <code c> | + | |
- | gst-launch-1.0 videotestsrc pattern=white num-buffers=1 \ | + | |
- | ! video/ | + | |
- | ! identity dump=1 \ | + | |
- | ! filesink location=white.gray8 -q | + | |
- | + | ||
- | gst-launch-1.0 | + | |
- | ! rawvideoparse format=rgba width=1 height=4 \ | + | |
- | ! identity dump=1 \ | + | |
- | ! filesink location=white.rgba -q | + | |
- | </ | + | |
- | + | ||
- | | + | |
- | + | ||
<file cpp / | <file cpp / | ||
Line 202: | Line 201: | ||
MAKE_GRAY_FORMAT (GRAY8, "raw video", | MAKE_GRAY_FORMAT (GRAY8, "raw video", | ||
PACK_GRAY8), | PACK_GRAY8), | ||
- | </ | + | </ |
- | + | [[https:// | |
- | [[https:// | + | </hidden> |
+ | [[https:// | ||
+ | [[https:// | ||