Results 1 to 5 of 5

Thread: Problem processing video frame through NDI SDK

  1. #1
    Newbie Member
    Join Date
    Feb 2018
    Location
    China
    Posts
    1

    Question Problem processing video frame through NDI SDK

    Here is the thing, I want to extract video frames from a video stream through the SDK. Now I can get the video frame in c++ struct that named `NDIlib_video_frame_v2_t`. However, I couldn't find any document of processing this kind of structure. I would like to convert video frame in picture and then get the bitmap of it. Can anybody give me some hint or is there any easier way to achieve the goal. I've just use NDI SDK for quite a short time. Thank you!

  2. #2
    Registered User
    Join Date
    Aug 2015
    Location
    london
    Posts
    196
    Quote Originally Posted by Quinn0379 View Post
    Here is the thing, I want to extract video frames from a video stream through the SDK. Now I can get the video frame in c++ struct that named `NDIlib_video_frame_v2_t`. However, I couldn't find any document of processing this kind of structure. I would like to convert video frame in picture and then get the bitmap of it. Can anybody give me some hint or is there any easier way to achieve the goal. I've just use NDI SDK for quite a short time. Thank you!
    in general the pdata member of the structure is a pointer to a memory array of uncompressed UYVY pixels.
    You will find more information in the SDK examples and the headers, and the PDF for the SDK.

    Exceptions to this would be where the source of the stream is RGB - in which case you would get an array of bgra pixels instead of UYVY

  3. #3
    I suggest that you look at NDIlib_video_frame_v2_t in Processing.NDI.structs.h.

    As livepad said, p_data is a pointer to the pixel data.

    NDIlib_video_frame_v2_t has members for the resolution, stride and format (fourcc) in addition to how and when they should be displayed.

    You also have some control over the formats you receive when you create your receiver by setting your color_format and whether you allow_video_fields.
    John Perkins
    Software Engineer

    "No, it's my natural color..."

  4. #4
    Registered User
    Join Date
    Sep 2018
    Location
    Tel Aviv
    Posts
    8
    Quote Originally Posted by John Perkins View Post
    As livepad said, p_data is a pointer to the pixel data.
    Hi everyone,
    I'm trying to understand how the p_data looks.

    When I do this:
    Code:
    case NDIlib_frame_type_video:
         uint8_t *data = video_frame.p_data;
         cout << data << endl;
    I receive a weird print which doesn't really look like a pixel data:
    Click image for larger version. 

Name:	aaaaa.PNG 
Views:	20 
Size:	22.3 KB 
ID:	142908

    What is this?
    Am I really getting the pixel data?
    Have I missed something?

  5. #5
    Registered User zenvideo.co.uk's Avatar
    Join Date
    Apr 2016
    Location
    Salford, UK
    Posts
    25
    Quote Originally Posted by yashinski.dev View Post
    Hi everyone,
    I'm trying to understand how the p_data looks.

    When I do this:

    case NDIlib_frame_type_video:
    uint8_t *data = video_frame.p_data;
    cout << data << endl;

    I receive a weird print which doesn't really look like a pixel data:

    What is this?
    Am I really getting the pixel data?
    Have I missed something?
    I don't know what you expect to see using that method, given that the data is either 32bit-per-pixel RGB+Alpha or 32bit-per-two-pixels 4:2:2 sampled UYVY, which you would possibly want to convert into RGB(A) in order to work with it. Trying to view a stream of individual bytes probably isn't going to reveal much, particularly if it is UYVY 4:2:2 data. If you want a quick way to extract an 8bit-per-pixel monochrome image, just pull out every other byte (the 'Y' luminance values) from the data array (if it's in UYVY format) into a new byte array "xres" by "yres" of the NDIlib_video_frame_v2_t structure.
    Martin Kay
    ZEN Computer Services - Salford, UK

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •