# How to encode raw video obtained from startRawRecording?

**URL:** <https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614>\
**Category:** macOS\
**Tags:** recording\
**Created:** [August 18, 2023, 11:12am UTC](https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614 "2023-08-18T11:12:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![maltamirano](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maltamirano/32/50044_2.png) [@maltamirano](https://devforum.zoom.us/u/maltamirano)\
**Post date:** [August 18, 2023, 11:12am UTC](https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614/1 "2023-08-18T11:12:05Z")

</div>

**Description**  
Hello @jon.zoom ,  
I have problems with the quality of the encoded video that I get from the raw video obtained after recording with **startRawRecording**. Please see image below.  
I am not sure if the problem is with the encoding or with how am I saving the raw video.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/a/e/ae8628fdcb3e614263c1a3e3698f73ab2f944049.jpeg)

I’m saving the raw video using the next code:

```auto
// Fired after the renderer is subscribed to the user's video stream
- (void)onRawDataReceived:(ZoomSDKYUVRawDataI420 *)data {
    char *bufferData = [data getBuffer];
    unsigned int bufferLen = [data getBufferLen];    
    [nsmdata appendBytes:bufferData length:bufferLen];
    BOOL written = [nsmdata writeToFile:filePath atomically:YES];
}

```

This is the command that I use to encode the video:

```auto
ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 640x360 -framerate 25 -i rawRecording-16778240.yuv -f mp4 rawRecording-16778240.mp4

```

**Which macOS Meeting SDK version**  
zoom-sdk-macos-5.15.5.20804.

**Device:**

- Device: [e.g. Apple MacBook Pro (16-inch, Intel)]
- OS: [macOS Ventura 13.4.1]

---

<div class="post-metadata">

**Author:** ![maltamirano](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maltamirano/32/50044_2.png) [@maltamirano](https://devforum.zoom.us/u/maltamirano)\
**Post date:** [September 4, 2023, 2:20pm UTC](https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614/2 "2023-09-04T14:20:15Z")

</div>

@chump Hello Chris!  
I saw that you solve the encoding problem with this work around [here](https://devforum.zoom.us/t/render-recordings-from-video-raw-data/64344/14)

Currently I’m saving the file like this, but I have this green bar above. However, the video is ok…ish, see image above.

```auto
// Fired after the renderer is subscribed to the user's video stream
- (void)onRawDataReceived:(ZoomSDKYUVRawDataI420 *)data {
    char *bufferData = [data getBuffer];
    unsigned int bufferLen = [data getBufferLen];    
    [nsmdata appendBytes:bufferData length:bufferLen];
    BOOL written = [nsmdata writeToFile:filePath atomically:YES];
}

```

I am trying to implement your solution with Objective-C in Xcode using the Y,U and V buffers, appending them and writing to the same file, but it is not working… This is what I am trying:

```auto
// Fired after the renderer is subscribed to the user's video stream
- (void)onRawDataReceived:(ZoomSDKYUVRawDataI420 *)data {    

         //Get raw data
        char *YbufferData = [data getYBuffer];
        char *UbufferData = [data getUBuffer];
        char *VbufferData = [data getVBuffer];
        
        unsigned int bufferLen = [data getBufferLen];
        
        //Append bytes
        [nsmdataY appendBytes:YbufferData length:bufferLen];
        [nsmdataU appendBytes:UbufferData length:bufferLen];
        [nsmdataV appendBytes:VbufferData length:bufferLen];
        
        //Write to filePath
        BOOL writtenY = [nsmdataY writeToFile:filePath atomically:YES];
        BOOL writtenU = [nsmdataU writeToFile:filePath atomically:YES];
        BOOL writtenV = [nsmdataV writeToFile:filePath atomically:YES];

```

Could you please give me some advice about how to write the file properly?

Thanks and Regards,  
Mauricio

---

<div class="post-metadata">

**Author:** ![amanda-recallai](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/amanda-recallai/32/44747_2.png) [@amanda-recallai](https://devforum.zoom.us/u/amanda-recallai)\
**Post date:** [September 9, 2023, 1:57am UTC](https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614/3 "2023-09-09T01:57:23Z")

</div>

@maltamirano, happy to try to help. Are you trying to build a meeting bot?

---

<div class="post-metadata">

**Author:** ![maltamirano](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maltamirano/32/50044_2.png) [@maltamirano](https://devforum.zoom.us/u/maltamirano)\
**Post date:** [September 14, 2023, 9:54am UTC](https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614/4 "2023-09-14T09:54:49Z")

</div>

@amanda-recallai Hello Amanda! I am trying to create an App that can extract the video streams to analyse them with an AI-System to give some feedback in real time to the participants based one the analysis made by the AI-System.  
Do you know how can I use [Gstreamer](https://gstreamer.freedesktop.org/) to encode in real time the raw video?

I already saw your blog entry about this, but it is not explained:

> **[How to Convert Zoom Raw Data into PNG and MP4](https://www.recall.ai/post/how-to-convert-zoom-raw-data-into-png-and-mp4)**
>
> A short tutorial on how to convert the raw video data you receive from Zoom into PNG frames or an MP4 file.

Thanks and regards,  
Mauricio

---

<div class="post-metadata">

**Author:** ![amanda-recallai](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/amanda-recallai/32/44747_2.png) [@amanda-recallai](https://devforum.zoom.us/u/amanda-recallai)\
**Post date:** [October 13, 2023, 12:26am UTC](https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614/5 "2023-10-13T00:26:58Z")

</div>

@maltamirano, happy to help - will need to loop in an engineer on my side to walk you through this.

Feel free to email me at amanda [at] recall.ai and we can set up a time!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [November 12, 2023, 10:27am UTC](https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614/6 "2023-11-12T10:27:08Z")

</div>

Closed on November 12, 2023, 10:27am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
