private void SendFrame(Stream output)
        {
            VideoFrame     frame  = camera.GetPreviewFrameAsync().Result;
            SoftwareBitmap bitmap = SoftwareBitmap.Convert(frame.SoftwareBitmap, BitmapPixelFormat.Bgra8, 0);

            byte[] buffer = bitmap.GetEncodedBytes(BitmapEncoder.JpegEncoderId).Result;

            output.Write(buffer, 0, buffer.Length);
            output.Flush();
        }