# Raspberry Pi record video to file and pipe frames

**URL:** <https://discourse.julialang.org/t/raspberry-pi-record-video-to-file-and-pipe-frames/50493>\
**Category:** General Usage\
**Tags:** question, video\
**Created:** [November 20, 2020, 12:04pm UTC](https://discourse.julialang.org/t/raspberry-pi-record-video-to-file-and-pipe-frames/50493 "2020-11-20T12:04:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [November 20, 2020, 4:32pm UTC](https://discourse.julialang.org/t/raspberry-pi-record-video-to-file-and-pipe-frames/50493/2 "2020-11-20T16:32:48Z")

</div>

The solution seems to be using `VideoIO.appendencode`, where I can grab images off of the camera, do what I will with them, and encode them to a video file at the same time. Brilliant! But… The encoding process on the RPI is about 60 times slower than on a PC, resulting in a FPS of about 2. More details here:

> [@Slow appendencode on Raspberry Pi](https://discourse.julialang.org/t/slow-appendencode-on-raspberry-pi/50504):
>
> On a Raspberry Pi in the following MWE: using VideoIO, Dates, BenchmarkTools cam = VideoIO.opencamera() img = read(cam) filename = "video.mp4" framerate = 200 props = [:priv\_data =\> ("crf"=\>"0","preset"=\>"ultrafast")] encoder = prepareencoder(img, framerate=framerate, AVCodecContextProperties=props) io = Base.open("temp.stream","w") @btime appendencode!($encoder, $io, $img, 1) it takes ~430 ms to encode a single frame to a video stream. On my PC it takes ~7 ms – 60 times faster video encoding. …

---

_[View the full topic](https://discourse.julialang.org/t/raspberry-pi-record-video-to-file-and-pipe-frames/50493)._
