# read/write raw video data in FIFO

Source: https://forum.modalai.com/topic/269/read-write-raw-video-data-in-fifo
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2021-06-05 14:12:07 UTC by shlee853
Replies: 2 · Views: 729

## shlee853 · 2021-06-05 14:12:07 UTC

Hi 

Do you have an example code to read/write raw video stream in generated FIFO using  voxl-rtsp -m option?

Thanks,

## Reply by Alex Kushleyev (ModalAI staff) · 2021-06-05 17:14:53 UTC

Hi, you can use the following commands.

1) In first terminal, run voxl-rtsp which will connect to camera and create the fifo and wait for the client to open the fifo

>voxl-rtsp -m /dev/my_fifo -f h264
voxl-rtsp version 1.0.4
Enabling output fifo /dev/my_fifo
Setting output format to: h264
Connected
Started camera 0
Created session
Video track created
Updated camera parameters
AE Mode: 1, Exposure: 0us, Gain: 0us, AWB Mode: 1
rtsp://<your_voxl_ip_address>:8900/live
Camera Output FIFO starting: /dev/my_fifo .. will block until client is ready
** process will proceed when you start reading the fifo **

2) then in second terminal (This opens the fifo and sends the raw data from the fifo into a file):
>cat /dev/my_fifo > raw_video.h264

3) press control-c in 1st terminal to stop the process, the `cat` process will also exit since the fifo will be closed.

Note that using `voxl-rtsp` you can use `-f` to specify which format to use for data output, include h264 (Defualt), h265, or even yuv or raw formats.

You can also just dump the video to a file without fifo, using `voxl-rtsp -o <filename>`. From `voxl-rtsp -h` : 
> -o <filename>     Save video to filename (No save to file by default). If extension of the file is .mp4, then video will be written in MP4 container, otherwise raw

So if you wanted to just use voxl-rtsp without a fifo to save raw yuv (no mp4 container) to file, then just use `voxl-rtsp -f h264 (or h265) -o my_video.h264 (or .h265)` 

Did that answer your question?

## Reply by shlee853 · 2021-06-05 22:21:32 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev great!

That’s a point what I need. I’ll try it

Thanks,
