# 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:** 1\
**Showing post:** 2

<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

---

_[View the full topic](https://devforum.zoom.us/t/how-to-encode-raw-video-obtained-from-startrawrecording/93614)._
