Splitting stereo video into two videos?

Raspberry Pi cameras (V1, V2, wide angle etc), HDMI capture modules etc.
Post Reply
atrunyan
Posts: 8
Joined: Fri Oct 22, 2021 4:36 pm

Splitting stereo video into two videos?

Post by atrunyan »

Hi, I'm hoping to be able to split my recorded split screen video into a left and right video so that I can make a disparity map video from them. Is this possible? How would I go about doing this?

stereomaton
Posts: 215
Joined: Tue May 21, 2019 12:33 pm
Location: France

Re: Splitting stereo video into two videos?

Post by stereomaton »

For offline conversion (after the half-sbs file is created), here is a ffmpeg command to split your video input.mp4 into two files output_l.mp4 and output_r.mp4:

Code: Select all

ffmpeg -i input.mp4 -filter_complex 'split[a][b],[a]stereo3d=sbs2l:ml[l],[b]stereo3d=sbs2l:mr[r]' -map '[l]' output_l.mp4 -map '[r]' output_r.mp4
If you want to do it live, see https://github.com/realizator/stereopi-fisheye-robot (and in particular 6_dm_video.py for live disparity map after the calibration is done ; you can also find a code to split the frame in two images in this file if you are interested in this specific part only)
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras

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

Re: Splitting stereo video into two videos?

Post by Realizator »

Stereomaton, thank you for your answer!

atrunyan, I'm curious why do you need two independent video files to get the disparity map, but not the single side-by-side file. What's the aim of the project?
Eugene a.k.a. Realizator

atrunyan
Posts: 8
Joined: Fri Oct 22, 2021 4:36 pm

Re: Splitting stereo video into two videos?

Post by atrunyan »

Hi Realizator,
I'm trying to create 3D models in agisoft from collected stereovideo, and I'm unsure if I can directly input stereo video into the software, or if I need to input frames from each camera. I am also looking into how to give it my calibration camera info to get accurately sized models.
Also, Id like to create depth maps from pre-recorded video, but am unsure how to do that and save the depth map video. I'm able to see depth maps with stills, but still unable to save the result.

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

Re: Splitting stereo video into two videos?

Post by Realizator »

Hi atrunyan,
atrunyan wrote:
Thu Jun 30, 2022 6:21 pm
I am also looking into how to give it my calibration camera info to get accurately sized models.
- as I understand, you can use the built-in Agisoft calibration. I.e. just feed it up with calibration images, and it'll calibrate camera.

I'm not familiar with Agisoft, but brief search shows me a few topics related to the camera specs passing to the code (like this one). So I think you can either calibrate images inside Agisoft, or try to pass your calibnration data. I'd prefer the first way.

Also, AFAIK, photogrammetry usually rely on the sequence of frames from one camera (preferrably including the camera position/orientation data for each frame). But this is too specific topic, related to Agisoft.
Eugene a.k.a. Realizator

Post Reply