Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
raw [2020/03/29 17:09] – [GRAY8 vs RTP] yair | raw [2024/06/30 17:30] (current) – yair | ||
---|---|---|---|
Line 1: | Line 1: | ||
====GRAY8 vs RTP==== | ====GRAY8 vs RTP==== | ||
**problem**: | **problem**: | ||
- | single plane raw formats are not part of [[https:// | + | single plane raw formats are not part of [[https:// |
**solution**: | **solution**: | ||
- | map the GRAY8 **one plane** source into a quarter width **four plane** RGBA output image\\ | + | an image format is **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 24: | Line 35: | ||
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)? | + | **note**: why white pixel is not FF=(255)? |
- | gstreamer | + | gstreamer |
+ | and YUV doesnt use the entire 0-255 space. [[https:// | ||
+ | |||
+ | **note2**: this example is running on linux/ | ||
+ | to adapt to windows using powershell replace '' | ||
+ | place quotes around | ||
+ | |||
+ | |||
+ | ====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 78: | Line 123: | ||
</ | </ | ||
- | {{ : | ||
<hidden extended format view> | <hidden extended format view> | ||
Line 125: | Line 169: | ||
</ | </ | ||
- | 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 204: | Line 204: | ||
MAKE_GRAY_FORMAT (GRAY8, "raw video", | MAKE_GRAY_FORMAT (GRAY8, "raw video", | ||
PACK_GRAY8), | PACK_GRAY8), | ||
- | </ | + | </ |
- | + | [[https:// | |
- | [[https:// | + | </hidden> |
+ | [[https:// | ||
+ | [[https:// | ||