Saving high quality 3D video on linux with gst-launch?

Raspberry Pi cameras (V1, V2, wide angle etc), HDMI capture modules etc.
Post Reply
chbla
Posts: 4
Joined: Thu Oct 28, 2021 7:17 pm

Saving high quality 3D video on linux with gst-launch?

Post by chbla »

Hi there,

I've got a StereoPi V2 camera kit and I want to save high quality 3D video. I figured it's best to stream it via UDP and use gst-launch on the remote (linux) machine.
To view the stream I use:

Code: Select all

gst-launch-1.0 -v udpsrc port=3000 buffer-size=300000 ! h264parse ! avdec_h264 ! autovideosink sync=false
While this is working, I'm not sure how to save the video. Played around with different filesink settings but I cannot play it back in VLC or mplayer.

Can anyone give me a hint?
Also looking for the best settings to save highest quality video "normal" framerates of 30/40 in case anyone has some inputs.

Thanks!

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Saving high quality 3D video on linux with gst-launch?

Post by Realizator »

Hi Chiba,
Looks like you are getting the raw h264 stream, which has no video information inside. That's why you can face difficulties with FPS and even scrolling the video file in VLC. To "normalize" the recorded file you should put it into a container (like mp4). This is a very fast process with no encoding/decoding, and we are doing this onboard for every video file recorded.

To do this you can use this simple command:

Code: Select all

ffmpeg -i file_in.h264 -c copy file_out.mp4
p.s. And if you want YouTube to recognize the 3D format of the recorded video, use this code:

Code: Select all

ffmpeg  -i file_in.h264 -map 0 -c copy -metadata:s:v stereo_mode=left_right %s.3d.mkv
After that the processed file can be shown in a few 3D formats by youtube, like anaglyph in the browser on the desktop computer or side-by-side in the mobile YouTube application. Pro tip: do not forget to turn on "decimation" on the StereoPi, and this will increase the FOV you are getting.
Eugene a.k.a. Realizator

chbla
Posts: 4
Joined: Thu Oct 28, 2021 7:17 pm

Re: Saving high quality 3D video on linux with gst-launch?

Post by chbla »

Hi, and thanks for the detailed answer!

What I figured out in the meantime is the -e flag for gstreamer, I can save the video like this:

Code: Select all

gst-launch-1.0 -e udpsrc port=3000 ! h264parse ! queue ! mp4mux ! filesink location=out.mp4
My goal is to record high quality video in 3D, save it, and later view it in an oculus go/quest.
The camera is stationary, and the focus really is quality with a natural framerate. Right now I'm testing it in the office.

I will look into the decimation feature. Any hints for settings to use with an oculus Go? Somehow I'm not sure about the right settings on the StereoPi side as well as the settings on the ocolus for playing back the video - looks like I need to adjust the offsets a bit.

chbla
Posts: 4
Joined: Thu Oct 28, 2021 7:17 pm

Re: Saving high quality 3D video on linux with gst-launch?

Post by chbla »

Another thing I noticed: If the light is getting darker in the room, the camera doesn't adjust. I tried closing the blinds while turning the light on, and the image is almost dark. Exposure settings don't seem to have any effects?

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Saving high quality 3D video on linux with gst-launch?

Post by Realizator »

Huh, exposure should definitely work.
Have you assembled the kit with the screen? The best way to see how exposure works is to look at the screen whilst changing the light conditions.

BTW, our experience says that mp4mux is often doing the bad files. We used this approach first, but later switched to ffmpeg post-processing.

As for the vidseo settings - keep 1280x720/30fps/3Mbit first to adjust your quality and brightness issue. You can increase the bitrate to 5 or 10Mbit for the higher recording quality, but in this case livestream can be affected.

After getting the result you need, try with the FullHD settings.
Eugene a.k.a. Realizator

chbla
Posts: 4
Joined: Thu Oct 28, 2021 7:17 pm

Re: Saving high quality 3D video on linux with gst-launch?

Post by chbla »

Thanks a lot for the help!

I've rebooted, and the exposure settings seem to work again. However, the changes are very small only.
The problem is, I'm using a case (of a robot like vehicle) with a semi transparent mirror glass for protection, a kind of lidar look.
It's from an old smart mirror.

I previously used an USB camera which adapted very fast if I put it behind the glass, there is only a small noticeable difference in brightness.
If I use my phone camera, there is almost no difference with or without glass.

If I use the stereopi, the image is almost completely dark and only the light sources are visible.
I'm unsure if the cameras are really that bad or if I can change the settings somehow so it is brighter?
I've tried setting ISO to max, Exposure to Auto, and AV to the highest setting, I believe it's 24.
But there is not really a noticeable change.

Any hints how I could improve this?

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Saving high quality 3D video on linux with gst-launch?

Post by Realizator »

chbla, your use case is new for us :)
Could you please share a few photos taken with and without this mirror glass?
Also, could you please share a few details about this glass? Is this specific item (with some IR/UV filter features)?
Eugene a.k.a. Realizator

Post Reply