Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
raw [2020/03/30 01:06] – [GRAY8 vs RTP] yairraw [2021/02/13 21:49] (current) yair
Line 1: Line 1:
 ====GRAY8 vs RTP==== ====GRAY8 vs RTP====
 **problem**: \\ **problem**: \\
-single plane raw formats are not part of [[https://tools.ietf.org/html/rfc4175|rfc4175]], and as such 2nd class citizens to gstreamer, RTSP and [[https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-grey.html|anywhere]]. +single plane raw formats are not part of [[https://tools.ietf.org/html/rfc4175|rfc4175]], and as such 2nd class citizens to gstreamer, RTSP or [[https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-grey.html|anywhere]] else
  
 **solution**: \\ **solution**: \\
-a missing channel in any image format is **just a convention**, we can package a datastream as long as we mind our strides. +an image format is **just a convention**, internally they are byte(octet) streams. we can re-package a datastream to another format, as long as we mind our strides. 
  
 view the image format as just a stream of octets. here is our stream in Y8 format view the image format as just a stream of octets. here is our stream in Y8 format
Line 15: Line 15:
        +--+--+--+--+ +--+--+--+--+        +--+--+--+--+ +--+--+--+--+
  
 +note the above represents two sequential pixels. 
  
-map the GRAY8 **one plane** source into a quarter width **four plane** RGBA output image\\ +the trick is to use gstreamer built in [[https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html?gi-language=c#formats|format spec]] and let that handle the conventions. 
-we will then remap it to Y8 on the receiving side. \\ +
-the trick is to use gstreamer built in format [[https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html?gi-language=c#formats|design document]] and let it handle the format conventions. +
  
 the [[https://www.collabora.com/news-and-blog/blog/2016/02/16/a-programmers-view-on-digital-images-the-essentials/|hammer]] the [[https://www.collabora.com/news-and-blog/blog/2016/02/16/a-programmers-view-on-digital-images-the-essentials/|hammer]]
Line 41: Line 40:
 and YUV doesnt use the entire 0-255 space. [[https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/738|issue]] and YUV doesnt use the entire 0-255 space. [[https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/738|issue]]
  
 +**note2**: this example is running on linux/debian, \\
 +to adapt to windows using powershell replace ''\'' with ''`'' and \\
 +place quotes around  ''video/x-raw, format=GRAY8, width=4, height=4''
  
  
Line 68: Line 70:
 </code> </code>
      
- 
-====raw parsing==== 
-<code c> 
-gst-launch-1.0 videotestsrc pattern=white num-buffers=1 \ 
-! video/x-raw, format=GRAY8, width=4, height=4 \ 
-! identity dump=1 \ 
-! filesink location=white.gray8 -q 
- 
-gst-launch-1.0  multifilesrc location=white.gray8 num_buffers=1 \ 
-! rawvideoparse format=rgba width=1 height=4 \ 
-! identity dump=1 \ 
-! filesink location=white.rgba -q 
-</code> 
  
  
 ====strides and offsets==== ====strides and offsets====
  
-we dont need to dig into the following as we use the capabilities as listed in [[https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html?gi-language=c#formats|design document]]. \\ +there are caveats to this approach (yuv). get the hammer and study the [[https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html?gi-language=c#formats|design document]]. 
-but hopefully this section will advance your understanding.+
  
  
Line 220: Line 208:
 </hidden> </hidden>
  
-[[https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h#L174|fourcc]] on linux +[[https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h#L174|fourcc]] on linux\\ 
 +[[https://docs.microsoft.com/en-us/windows/win32/medfound/image-stride?redirectedfrom=MSDN|MSDN on stride]]