title: Why isn't my v210 format video showing as such through a V4L loopback device?
body: <p>In a user-space application, I'm writing v210 formatted video data to a V4L2 loopback device.  When I watch the video in VLC or other viewer, I just get clownbarf and claims that the stream is UYUV or other, not v210.  I suspect I need to tell the loopback device something more than what I have, to make the stream appear as v210 to the viewer.  Is there one more place/way to tell it that it'll be handling  a certain format?</p>
  
  <p>What I do now:</p>
  
  <pre><code>int frame_w, frame_h = ((some sane values))
  
  outputfd = open("/dev/video4", O_RDWR); 
  // check VIDIOC_QUERYCAPS, ...
  
  struct v4l2_format fmt;
  memset(&amp;fmt, 0, sizeof(fmt));
  fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
  fmt.fmt.pix.width = frame_w;
  fmt.fmt.pix.height = frame_h;
  fmt.fmt.pix.bytesperline = inbpr;    // no padding
  fmt.fmt.pix.field = 1;
  fmt.fmt.pix.sizeimage = frame_h * fmt.fmt.pix.bytesperline;
  fmt.fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;
  
  v210width = (((frame_w+47)/48)*48);  // round up to mult of 48 px
  byte_per_row = (v210width*8)/3;       
  fmt.fmt.pix.pixelformat = 'v' | '2' &lt;&lt; 8 | '1' &lt;&lt; 16 | '0' &lt;&lt; 24;
  fmt.fmt.pix.width = v210width;
  fmt.fmt.pix.bytesperline = byte_per_row ;
  
  ioctl(outputfd, VIDIOC_S_FMT, &amp;fmt);
  
  // later, in some inner loop...
  ... write stuff to uint8_t buffer[] ...
  write(outputfd, buffer, buffersize);
  </code></pre>
  
  <p>If I write UYVY format, or RGB or others, it can be made to work. Viewers display the video and report the correct format.</p>
  
  <p>This code is based on examples, reading the V4L docs, and some working in-house code.  No one here knows exactly what are all the things one must do to open and write to a video device.</p>
  
  <p>While there is an easily found example online of how to read video from a V4L device, I couldn't find a similar quality example for writing.  If such exists, it may show the missing piece.</p>