How to encode raw video obtained from startRawRecording?

@chump Hello Chris!
I saw that you solve the encoding problem with this work around here

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

// 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:

// 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