# STEP 3 : Testing and application on your gst element

1. we found print command on 244 and 245 that we found on latest testing and comment those line for define new process working on element.

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645016848854_image.png" alt=""><figcaption></figcaption></figure>

2\. We will create frame counter for mesure framnum on this element plugin.&#x20;

* a. The first define the Global variable for add on every loop, That’s mean when frame data pass throught this element is add 1 to counter and save file.

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645018375647_image.png" alt=""><figcaption></figcaption></figure>

* b.  Rebuild this element and inspect the data from gst-inspect

```bash
$ cd ../../ && ninja -C build
$ gst-inspect-1.0 videodatagst
```

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645018452274_image.png" alt=""><figcaption></figcaption></figure>

The name of this gstremer element is videodatagst.&#x20;

3\. Run the gst-element for watching the frame number

```bash
$ gst-launch-1.0 videotestsrc ! videodatagst ! fakesink
```

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645018659185_image.png" alt=""><figcaption></figcaption></figure>

We can lock framnum with declare framenum on gst-luanch-1.0 command

```bash
$ gst-launch-1.0 videotestsrc num-buffers=69 ! videodatagst ! fakesinkbas
```

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645018771221_image.png" alt=""><figcaption></figcaption></figure>

4\. Next, We will check size buffer when working.&#x20;

* declare [GstMapInfo](https://gstreamer.freedesktop.org/documentation/gstreamer/gstmemory.html#GstMapInfo). for get buffer data. but it can’t readable cause the data on buffer is similar like number of string. (can’t read directly)
* we will create data on 8 bit unsigned int for sort data on buffersize and print that data.
* save file.

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645019805243_image.png" alt=""><figcaption></figcaption></figure>

5\. Build the gst element and run it.

```bash
$ ninja -C build
$ gst-launch-1.0 videotestsrc num-buffers=69 ! videodatagst ! fakesink
```

6\. Next, we will check input data video of our element pad and print it.

* The first we will add GstCaps for declare variable get data on pad
* print caps.
* save file.

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645020520975_image.png" alt=""><figcaption></figcaption></figure>

7\. Re-build and run gst element

```bash
$ ninja -C build
$ gst-launch-1.0 videotestsrc num-buffers=69 ! videodatagst ! fakesink
```

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645020588445_image.png" alt=""><figcaption></figcaption></figure>

8\. Adjust the resolution of video to 4k and look and size buffer will increase and data on pad will change resolution.

```bash
$ gst-launch-1.0 videotestsrc num-buffers=69 ! video/x-raw,width=4096,height=2160 ! videodatagst ! fakesink
```

<figure><img src="https://paper-attachments.dropbox.com/s_8D12BA9D3ACC276FE6456B192705A16DC9CD19AC9DCDCFFA08371C99F10A1BD1_1645020770743_image.png" alt=""><figcaption></figcaption></figure>

From data log we found the changing is buffersize 326 → 4682 and resolution of video from 320x240 → 4096x2160(4k).
