Working with the Zoom RAW video data .yuv file

Hello,
I successfully implemented a meeting bot that joins the meeting and records the video and audio using the example code (Linux SDK with ubuntu container).

So, the bot generate a .yuv file, I’ve tried to open the file with vlc using:

/Applications/VLC.app/Contents/MacOS/VLC --rawvid-fps 25 --rawvid-width 1920 --rawvid-height 1080 --rawvid-chroma I420 output.yuv

but got the frames in a very weird format (see image attached)

Also, tried using ffmpeg:

 ~/Downloads/ffmpeg -s 640x480 -i output.yuv -ss 00:00:00 -c:v libx264 -s:v 640x480 -preset slow -t 00:08:20 output.mp4

But again the frames always “jumps”, see image:

Also tried 320x160 resolution.

Also tried to stream the file to custom RTMP server using ffmpeg but same results (As @MaxM Described here: https://devforum.zoom.us/t/live-streaming-with-rtmp/63328/3)

cc: @chunsiong.zoom

Appreciate any help working with this file format.

Here is the code which generates the output.yuv file:

void ZoomSDKRenderer::SaveToRawYUVFile(YUVRawDataI420* data) {

	// Open the file for writing
	std::ofstream outputFile("output.yuv", std::ios::out | std::ios::binary | std::ios::app);
	if (!outputFile.is_open())
	{
		std::cout << "Error opening file." << std::endl;
		return;
	}
	// Calculate the sizes for Y, U, and V components
	size_t ySize = data->GetStreamWidth() * data->GetStreamHeight();
	size_t uvSize = ySize / 4;

	// Write Y, U, and V components to the output file
	outputFile.write(data->GetYBuffer(), ySize);
	outputFile.write(data->GetUBuffer(), uvSize);
	outputFile.write(data->GetVBuffer(), uvSize);


	// Close the file
	outputFile.close();
	outputFile.flush();
}

You can try to deal with it this way.

...
size_t len =  data-> GetBufferLen();
outputFile.write(data->GetBuffer(), len);
...

@gofmannir I’ve tried your implementation of saving the file, it works fine.

For ffmpeg conversion, I’m doing it like this

ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 640*360 -framerate 25 -i chrome.yuv -f mp4 chrome.mp4

@chunsiong.zoom That worked! thanks :).
Now, in anther related topic, there is the ‘.pcm’ audio file, There is a useful command to combine both the video and the audio to the mp4 file?

Iv’e used 2 ffmpeg commands like this:

ffmpeg -f rawvideo -pix_fmt yuv420p -video_size 640*360 -framerate 25 -i output.yuv -f mp4 video.mp4 && ffmpeg -i video.mp4 -f s16le -ar 32000 -ac 1 -i audio.pcm -c:v copy -c:a aac -strict experimental final.mp4

@chunsiong.zoom Maybe you know a better way with 1 command?
Also, is it right the 32000hz ? not seen it in the documentation.

@gofmannir the sample rate is 32000hz.

The command which you have shared should work for muxing