-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Real-time stream #8969
Comments
Hi @DuyguSerbes I am not aware of an example of streams being saved in mp4 format, though a RealSense user shared a Python script for saving the streams in .avi video format. If you require mp4 format, building librealsense with the V4L2 backend should enable raw camera data to be accessed by standard Linux tools. In regard to real-time streaming: the link below provides scripting for aligning depth, color and infrared. Depth is necessary to be included in that situation because the SDK needs for depth to be aligned to another type of stream, so you cannot have just RGB and infrared alignment, for example. If you prefer for the streams to be displayed as individual panels instead of in alignment, a RealSense user in the link below shared a modified version of the opencv_viewer_example Python example program that includes infrared. Conceivably, if you only wish RGB and infrared to be displayed then you could remove the depth stream code from the script, since alignment is not involved in this particular application. |
@DuyguSerbes if you prefer python another alternative is ffmpeg-python https://github.com/kkroening/ffmpeg-python There is no repository with RealSense code, but the library is well documented. With these settings I am usually able to get a 720p 30fps stream going on a Raspberry Pi 4. This also uses the Raspberry Pi's hardware encoder, which is much more efficient than OpenCV. If you have an Nvidia GPU you may be able to use Nvenc for hardware accelerated encoding.
You can use OpenCV to convert an RGB8 color frame to yuv420p. Unfortunately RealSense's YUYV and yuv420p are different formats. You can feed the color frame to ffmpeg with You can have ffmpeg write straight to disk, but if you are writing to an external USB drive I have had issues where ffmpeg blocks the USB bus and the RealSense camera drops frames. If you pull the encoded bytes yourself with something like This will technically be "h264" and not "mp4", but you can transcode the stream without recompressing it.
|
Also if you want more detail than H264 and can deal with a higher data rate, motion JPEG might be interesting. This library https://pypi.org/project/PyTurboJPEG/ takes about 10ms to compress a 848x480 RGB image and 20ms to compress a 1280x720 RGB image on a Raspberry Pi. A desktop computer should be able to do much better. |
Hi @DuyguSerbes Do you require further assistance with this case, please? Thanks! |
Case closed due to no further comments received. |
Issue Description
Hello all,
I am looking for a real-time stream solution for realsense D435i camera. I would like to use real-time infrared and RGB stream. Can you suggest any repository written in C/C++ or Python?
Also I want to save the stream in mp4 format for other processes.
The text was updated successfully, but these errors were encountered: