MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

STEREO 3D SBS + RASPIVID + FFMPEG = :-(

Sun Dec 23, 2018 12:35 pm

We are attempting to use Raspivid + ffmpeg to live stream stereo (-3d sbs) video. However, only one video is being recognized and streamed. We are not sure if the issue is Raspivid or ffmpeg.

Saving a stereo video via Raspivid works fine:
raspivid -t 6000 -w 1536 -h 768 -fps 30 -b 10000000 -3d sbs -o stereo.h264

The issue is streaming via ffmpeg. It doesn't seem to recognize the stereo format (-3d sbs) being outputted (-o -) from Raspivid.

We are using Node.js to create a webserver and the spawn() function to send Raspivid a command.

const raspividOptions = ['-t', '0', '-w', width, '-h', height, '-3d', 'sbs', -fps', framerate, '-g', framerate, '-o', '-'];
const cameraStream = spawn('raspivid', raspividOptions);
let conversionStream = ffmpeg(cameraStream.stdout)

We know Raspivid stereo requires that the width and height be multiples of 128, so we're using -w 1536 -h 768.
When we view the live stream, only one video is being shown (not both side-by-side).

Is there something that can be done in Raspivid and/or ffmpeg to ensure both side-by-side streams are used?

Help!?

ethanol100
Posts: 581
Joined: Wed Oct 02, 2013 12:28 pm

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 2:03 pm

Can you try to save the video to a file as a first step? (You did this, this... I did not read this first)
Does raspivid creates the right video?
If you now pipe the video data using "cat" instead of piping using raspivid into ffmpeg, does it work?
Do you have any known good side by side video to test instead of the raspivid source?

The video created in raspivid has no knowledge of being 3d or side by side. It is just a single video with both views included side by side.
Do you expect ffmpeg to know that this is a side by side video? Other programs rely on file endings(i.e. kodi), like *.sbs.mp4.

After these test you should be able to blame raspivid or ffmpeg.

How do you stream? Which container do you use? if you stream as mkv you can try to add stereo metadata (-metadata:s:v stereo_mode=left_right) to your stream?

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 3:34 pm

@ ethanol100

Creating and saving a stereo video file via Raspivid works.

It's possible that when piping the video output from Raspivid to ffmpeg, the video isn't actually side-by-side but, possibly, two video tracks with metadata? This would possibly explain why saving the file yields a true side-by-side single video file while streaming it out yields only one.

I am unfamiliar with "cat". We're using ffmpeg to create hls live streams.

ethanol100
Posts: 581
Joined: Wed Oct 02, 2013 12:28 pm

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 4:59 pm

cat is a program which sends a file to stdout.
You can try to replace the raspivid command with

Code: Select all

cat stereo.h264 
in your python code to send the previous recorded video instead of a live one, which could play much too fast, but you can try it. ffmpeg should be able to handle this.

As I said the raw video stream from raspivid has no information of what kind or if 3d is present in the video. It just packs the images of the two camras into one frame. Are you sure your raspivid command is the correct one? Can you run htop on the CM via ssh while streaming and check if raspivid is run with the expected parameters?

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 5:08 pm

We're not using python. We're using Node which uses a spawn() command to launch Raspivid with CLI options. See my original message above.

No idea why we're not able to just send the stereo video to ffmpeg. it's a puzzle we're very eager to solve.

ethanol100
Posts: 581
Joined: Wed Oct 02, 2013 12:28 pm

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 5:14 pm

I think it should be exactly the same, sorry, I'm not using python nor node.
I would try something like

Code: Select all

const raspividOptions = ['/home/pi/stereo.h264'];
const cameraStream = spawn('cat', raspividOptions);
to send the old recorded stereo.h264 file, as a test case.

ethanol100
Posts: 581
Joined: Wed Oct 02, 2013 12:28 pm

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 6:28 pm

As you are not providing enough information/code to really help, I modified a script I found at hls stream.
I saved the file under the name stream3d.sh:

Code: Select all

#!/bin/bash
#
# Capture raspivid.  segment it via ffmpeg and serve it via python.
#

# echo commands as they are executed
set -x

# kill subprocesses upon ^C
function handle_sigint()
{
    for proc in `jobs -p`
    do
        kill $proc
    done
}

# register the signal handler
trap handle_sigint SIGINT

# create a clean FIFO for our H264 feed
rm -rf live.h264
mkfifo live.h264

# create an HTML5 <video> frame for our HLS index
rm video.html
cat <<EOF > video.html
<html>
HLS Video:
<br>
<video src="index.m3u8" width="1280" height="480" controls="x">
</video>
</html>
EOF

# Start a Python HTTP Server.  By default it listens on port 8000.
# Start raspivid, pipe its output into the FIFO.
# Use ffmpeg to combine video and audio and segment the result.

python -m SimpleHTTPServer &
raspivid -3d sbs -w 1280 -h 480 -fps 25 -g 25 -hf -t 10000000 -b 1800000 -o - -ih > live.h264 &
ffmpeg -i live.h264 \
-vcodec copy -an \
-map 0:0 \
-f segment -segment_list_flags live -segment_wrap 20 -segment_time 5.0 -segment_format mpegts -segment_list_size 10 -segment_list index.m3u8 "segment%04d.ts" 
I created a folder hls3d on the pi under /home/pi. copied the file stream3d.sh there. Made it executable with "chmod +x stream3d.sh". And after running with ./stream3d.sh in the folder /home/pi/hls3d I could browse to the http://*the IP of the Pi*:8000/video.html on my android phone. (Does not for on Desktop...)

This has a 40sec delay, but worked perfectly fine.

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 6:58 pm

@ethanol100

We're using two primary Node.js files: index.js and lib/server.js
The index.js starts the streaming server. You will see in server.js that we've added:
const raspividOptions = ['-o', '-', '-t', '0', '-w', width, '-h', height, '-fps', framerate, '-g', framerate, '-3d', 'sbs'];

index.js

Code: Select all

#!/usr/bin/env node

'use strict';

const program = require('commander');
const os = require('os');
const info = require('./package.json');
const server = require('./lib/server');

// Coercion function for number range
const range = (min, max, value, def) => {
  if (value < min || value > max) return def;
  return Number(value);
};

process.title = 'raspi-live';

program
  .name(info.name)
  .description(info.description)
  .version(info.version, '-v, --version');

program
  .command('start')
  .description('start streaming video from the raspberry pi camera module')
  .option('-d, --directory <directory>', 'streaming video file hosting location', `${os.homedir()}/camera`)
  .option('-f, --format <format>', 'video streaming format [hls, dash]', /^(hls|dash)$/i, 'hls')
  .option('-w, --width <width>', 'video resolution width', Number, 1280)
  .option('-h, --height <height>', 'video resolution height', Number, 720)
  .option('-r, --framerate <fps>', 'video frames per second', Number, 25)
  .option('-x, --horizontal-flip', 'flip the camera horizontally')
  .option('-y, --vertical-flip', 'flip the camera vertically')
  .option('-c, --compression-level <compression-level>', 'compression level [0-9]', range.bind(null, 0, 9), 9)
  .option('-t, --time <time>', 'duration of streaming files', Number, 2)
  .option('-l, --list-size <list-size>', 'number of streaming files in the playlist', Number, 10)
  .option('-s, --storage-size <storage-size>', 'number of streaming files for storage purposes', Number, 10)
  .option('-p, --port <port>', 'port number the server runs on', Number, 8080)
  .action(({ directory, format, width, height, framerate, horizontalFlip = false, verticalFlip = false, compressionLevel, time, listSize, storageSize, port }) => {
    console.log('configuration:', directory, format, width, height, framerate, horizontalFlip, verticalFlip, compressionLevel, time, listSize, storageSize, port);
    server(directory, format, width, height, framerate, horizontalFlip, verticalFlip, compressionLevel, time, listSize, storageSize, port);});

program.parse(process.argv);
if (!program.args.length) program.help();

lib/server.js

Code: Select all

const express = require('express');
const app = express();
const compression = require('compression');
const cors = require('cors');
const path = require('path');
const fs = require('fs');
const spawn = require('child_process').spawn;
const ffmpeg = require('fluent-ffmpeg');

module.exports = (directory, format, width, height, framerate, horizontalFlip, verticalFlip, compressionLevel, time, listSize, storageSize, port) => {
  // Create the camera output directory if it doesn't already exist
  // Sync, because this is only run once at startup and everything depends on it
  if (fs.existsSync(directory) === false) fs.mkdirSync(directory);

  // Start the camera stream
  const raspividOptions = ['-o', '-', '-t', '0', '-w', width, '-h', height, '-fps', framerate, '-g', framerate, '-3d', 'sbs'];
  if (horizontalFlip) raspividOptions.push('-hf');
  if (verticalFlip) raspividOptions.push('-vf');

  const cameraStream = spawn('raspivid', raspividOptions);

  // Setup up a special shutdown function that's called when encountering an error
  // so that we always shut down the camera stream properly
  const kill = (err) => {
    cameraStream.kill();
    throw err;
  };

  // Set up camera stream conversion
  let conversionStream = ffmpeg(cameraStream.stdout)
    .noAudio();

  if (format === 'hls') {
    const outputOptions = [
      '-hls_time',
      time,
      '-hls_list_size',
      listSize,
      '-hls_delete_threshold',
      storageSize,
      '-hls_flags',
      'split_by_time+delete_segments+second_level_segment_index',
      '-strftime',
      1,
      '-hls_segment_filename',
      path.join(directory, '%s-%%d.m4s'),
      '-hls_segment_type',
      'fmp4'
    ];

    conversionStream
      .videoCodec('copy')
      .format('hls')
      .inputOptions(['-re'])
      .outputOptions(outputOptions)
      .output(path.join(directory, 'livestream.m3u8'));
  }
  else if (format === 'dash') {
    const outputOptions = [
      '-seg_duration',
      time,
      '-window_size',
      listSize,
      '-extra_window_size',
      storageSize,
      '-init_seg_name',
      'init.m4s',
      '-media_seg_name',
      '$Time$-$Number$.m4s'
    ];

    conversionStream
      .videoCodec('copy')
      .format('dash')
      .inputOptions(['-re'])
      .outputOptions(outputOptions)
      .output(path.join(directory, 'livestream.mpd'));
  }
  else {
    kill(Error('unsupported format'));
  }

  // Start stream processing
  conversionStream
    .on('error', (err, stdout, stderr) => kill(err))
    .on('start', (commandLine) => console.log('started video processing: ' + commandLine))
    .on('stderr', (stderrLine) => console.log('conversion: ' + stderrLine))
    .run();

  // Endpoint the streaming files will be available on
  const endpoint = '/camera';

  // Setup express server
  app.use(cors());
  app.use(compression({ level: compressionLevel }));
  app.use(endpoint, express.static(directory));
  app.listen(port);

  console.log('camera stream server started');
};

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 7:26 pm

@ ethanol100

Your original solution worked! However, it only worked on Safari.
I added hls.js to the html in stream3d.sh and now it works also on Chrome!

THANK YOU!


ethanol100 wrote:
Sun Dec 23, 2018 6:28 pm
As you are not providing enough information/code to really help, I modified a script I found at hls stream.
I saved the file under the name stream3d.sh:

Code: Select all

#!/bin/bash
#
# Capture raspivid.  segment it via ffmpeg and serve it via python.
#

# echo commands as they are executed
set -x

# kill subprocesses upon ^C
function handle_sigint()
{
    for proc in `jobs -p`
    do
        kill $proc
    done
}

# register the signal handler
trap handle_sigint SIGINT

# create a clean FIFO for our H264 feed
rm -rf live.h264
mkfifo live.h264

# create an HTML5 <video> frame for our HLS index
rm video.html
cat <<EOF > video.html
<html>
HLS Video:
<br>
<video src="index.m3u8" width="1280" height="480" controls="x">
</video>
</html>
EOF

# Start a Python HTTP Server.  By default it listens on port 8000.
# Start raspivid, pipe its output into the FIFO.
# Use ffmpeg to combine video and audio and segment the result.

python -m SimpleHTTPServer &
raspivid -3d sbs -w 1280 -h 480 -fps 25 -g 25 -hf -t 10000000 -b 1800000 -o - -ih > live.h264 &
ffmpeg -i live.h264 \
-vcodec copy -an \
-map 0:0 \
-f segment -segment_list_flags live -segment_wrap 20 -segment_time 5.0 -segment_format mpegts -segment_list_size 10 -segment_list index.m3u8 "segment%04d.ts" 
I created a folder hls3d on the pi under /home/pi. copied the file stream3d.sh there. Made it executable with "chmod +x stream3d.sh". And after running with ./stream3d.sh in the folder /home/pi/hls3d I could browse to the http://*the IP of the Pi*:8000/video.html on my android phone. (Does not for on Desktop...)

This has a 40sec delay, but worked perfectly fine.
Last edited by MRV on Sun Dec 23, 2018 7:46 pm, edited 1 time in total.

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 7:39 pm

@ ethanol100

First, thank you for your assistance.
Second, may I send you a private message somehow?
Perhaps via email?

ethanol100
Posts: 581
Joined: Wed Oct 02, 2013 12:28 pm

Re: Stereoscopic camera capture - now implemented (2014).

Sun Dec 23, 2018 8:15 pm

You're welcome. I'm not fluent enough with nodejs to understand where your problems occur in your scripts. Others may be more helpful there.

Sure, you can drop me an email, if you want (my username at googlemail.com), but it is better to ask for help in the forum, where the real people with knowledge are(6by9, jamesh,...).

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Mon Dec 24, 2018 9:04 am

Sent you an email. Hopefully you got it.
Thanks again Ethanol100 !

ethanol100 wrote:
Sun Dec 23, 2018 8:15 pm
You're welcome. I'm not fluent enough with nodejs to understand where your problems occur in your scripts. Others may be more helpful there.

Sure, you can drop me an email, if you want (my username at googlemail.com), but it is better to ask for help in the forum, where the real people with knowledge are(6by9, jamesh,...).

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Wed Dec 26, 2018 8:30 pm

@ ethanol100

So, thanks again for assisting me with HSL. I got the HLS stream working. I was able to use the Raspivid | ffmpeg pipeline to create the m3u8 file. Everything worked fine.

However,

HLS has a significant latency regardless of the settings. As other posts have mentioned, HLS is nice but not recommended for low-latency live streaming. My interest is to view the live, real-time stream from my Raspberry Pi on a (nearby) mobile device. Is there a Raspivid +ffmpeg solution to simply broadcast the video that can be viewed in real-time in an html video tag etc? There must be a way to view this video using WebRTC without using a proprietary solution (such as UV4L).

User avatar
HermannSW
Posts: 1240
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Stereoscopic camera capture - now implemented (2014).

Wed Dec 26, 2018 8:51 pm

Not sure what your concern is wrt uv4l, here is another low latency streaming solution:
viewtopic.php?t=204921
bookmark list: https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/fork-raspiraw
https://github.com/Hermann-SW/userland
https://twitter.com/HermannSW

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Wed Dec 26, 2018 9:03 pm

UV4L is actually really nice but not free if you want to include it in your commercial hardware products.
HermannSW wrote:
Wed Dec 26, 2018 8:51 pm
Not sure what your concern is wrt uv4l, here is another low latency streaming solution:
viewtopic.php?t=204921

MRV
Posts: 23
Joined: Thu Jul 19, 2018 3:09 am

Re: Stereoscopic camera capture - now implemented (2014).

Wed Dec 26, 2018 10:10 pm

@ HermannSW
Wow. This works great!
https://github.com/131/h264-live-player is an excellent real-time streaming solution. Got stereo video working via Raspivid as well!

@ ethanol100
Thanks again for the HLS solution!

User avatar
HermannSW
Posts: 1240
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Wed Jan 02, 2019 5:05 pm

I had installed UV4L before, but never got it working.
Today I started h264-live-player, but the "New guy" message was missing.
It looked like some other service blocked port 8080.
I when to Raspberry port 8080 in browser and saw UV4L main selection screen there!
Clicking on "MJPEG/Stills stream" immediately showed the the streaming video from Raspberry camera (full HD mjpeg).
I changed to 640x480 in Control panel and change was available immediately after clicking apply.
Image


P.S:
3 concurrent streams possible, delay of 4/30th seconds between each:
https://www.youtube.com/watch?v=KtB9akZ ... e=youtu.be
bookmark list: https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/fork-raspiraw
https://github.com/Hermann-SW/userland
https://twitter.com/HermannSW

User avatar
HermannSW
Posts: 1240
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Sun Jan 06, 2019 9:54 am

I am really excited on UV4L, especially its display server.
It allows to remotely control HDMI display of Raspberry even when no HDMI monitor is connected.
Even raspivid preview window overlay gets correctly displayed in browser if on:
https://twitter.com/HermannSW/status/10 ... 0751306752
Image


I just tried it on Android smartphone, my first working low latency Raspberry camera viewer there:
Image
bookmark list: https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/fork-raspiraw
https://github.com/Hermann-SW/userland
https://twitter.com/HermannSW

RpiName
Posts: 710
Joined: Sat Jul 06, 2013 3:14 am

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Mon Jan 07, 2019 3:04 am

HermannSW wrote:
Sun Jan 06, 2019 9:54 am
I am really excited on UV4L, especially its display server.
It allows to remotely control HDMI display of Raspberry even when no HDMI monitor is connected.
Even raspivid preview window overlay gets correctly displayed in browser if on:
You may be interested in this new webapp. It allows to share the screen as above but also audio ("what you hear") to the browser, and include keyboard emulation to control the rpi from the web page:

https://www.linux-projects.org/uv4l/tut ... d-sharing/

User avatar
HermannSW
Posts: 1240
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Tue Jan 08, 2019 10:53 pm

Thanks for the tip. I don't need audio yet, but the hint with keyboard emulation was good (I know the same can be achieved with a parallel ssh session, but doing all in browser is cool). Btw, toggling "send mouse events" results in "not implemented yet" popup ;-)

This is screenshot from Raspbian Stretch booted into console with login. It nicely demonstates that Raspberry camera preview window (which is some kind of framebuffer overlay(?)) works as well:
Image
bookmark list: https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/fork-raspiraw
https://github.com/Hermann-SW/userland
https://twitter.com/HermannSW

User avatar
HermannSW
Posts: 1240
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Tue Jan 08, 2019 11:17 pm

I just did the same with Android smartphone browser.
I did put "pi" in the "Data Channels->message" field and pressed "Send" button.
"pi" got typed in Raspberry console session as expected.

My question is, how I do send the Return key from Android browser in order to see password prompt in console session?
bookmark list: https://stamm-wilbrandt.de/en/Raspberry_camera.html

https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/fork-raspiraw
https://github.com/Hermann-SW/userland
https://twitter.com/HermannSW

Realizator
Posts: 27
Joined: Thu Jul 14, 2016 12:53 pm
Contact: Website

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Wed Mar 06, 2019 9:17 am

@6by9, I have a question about fullscreen stereoscopic preview in raspivid and raspistill.
By default with the stock Raspbian we can see broken preview only (images are partially overlapped, and also there are black fields on both sides).
We solved this by modifying raspivid and changing MMAL_ENCODING_OPAQUE to MMAL_ENCODING_I420, as you mentioned in several topics on this forum. It gives us normal full-screen preview for both SBS and TB modes. To save back compatibility, we added a new key "-fs" (force stereo preview) to our raspivid and raspistill. Without this key our modified raspivid and raspistill works as original versions.

Can you suggest some easier ways for regular users to obtain fullscreen stereoscopic preview on HDMI? I'm talking about our StereoPi users, most of which will do their first steps in stereoscopic experiments and OpenCV.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6895
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Wed Mar 06, 2019 9:42 am

Realizator wrote:
Wed Mar 06, 2019 9:17 am
@6by9, I have a question about fullscreen stereoscopic preview in raspivid and raspistill.
By default with the stock Raspbian we can see broken preview only (images are partially overlapped, and also there are black fields on both sides).
We solved this by modifying raspivid and changing MMAL_ENCODING_OPAQUE to MMAL_ENCODING_I420, as you mentioned in several topics on this forum. It gives us normal full-screen preview for both SBS and TB modes. To save back compatibility, we added a new key "-fs" (force stereo preview) to our raspivid and raspistill. Without this key our modified raspivid and raspistill works as original versions.

Can you suggest some easier ways for regular users to obtain fullscreen stereoscopic preview on HDMI? I'm talking about our StereoPi users, most of which will do their first steps in stereoscopic experiments and OpenCV.
Sorry, I haven't run stereoscopic for ages, and can't recall or find the reference you're referring to over OPAQUE vs I420.
Can you post a quick picture of what you're seeing as last time I tried stereoscopic it did the right thing on a 3D display when tvservice had been told to do stereoscopic.
Are you trying to force the two images side by side (or TB) on the same 2D display? I'm not sure what video_render does in those situations, but could be told to display the two frames appropriately. If a raspistill/vid flag is required, then I'm quite happy for one to be added.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Realizator
Posts: 27
Joined: Thu Jul 14, 2016 12:53 pm
Contact: Website

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Wed Mar 06, 2019 10:39 am

6by9 wrote:
Wed Mar 06, 2019 9:42 am
Sorry, I haven't run stereoscopic for ages, and can't recall or find the reference you're referring to over OPAQUE vs I420.
We've found this solution in these topics:
https://www.raspberrypi.org/forums/view ... p?p=918041
https://www.raspberrypi.org/forums/view ... p?p=364164
6by9 wrote:
Wed Mar 06, 2019 9:42 am
Can you post a quick picture of what you're seeing as last time I tried stereoscopic it did the right thing on a 3D display when tvservice had been told to do stereoscopic.
I've recorded short experiment for you: https://youtu.be/6nCInrTC29M
Here we can see a single image only.
6by9 wrote:
Wed Mar 06, 2019 9:42 am
Are you trying to force the two images side by side (or TB) on the same 2D display? I'm not sure what video_render does in those situations, but could be told to display the two frames appropriately. If a raspistill/vid flag is required, then I'm quite happy for one to be added.
Yes, 3D SBS or TB on 2D display. We've tried to solve it by HDMI mode settings and raspivid keys, but has no success.

We can do pull request to https://github.com/raspberrypi/userland for you to review our approach (from user G0l, it's my teammate).
May be it is easier to change default settings instead of adding new key, it's on your decision.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6895
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Stereoscopic camera capture (for COMPUTE MODULE) - now implemented (2014).

Wed Mar 06, 2019 11:01 am

Realizator wrote:
Wed Mar 06, 2019 10:39 am
6by9 wrote:
Wed Mar 06, 2019 9:42 am
Sorry, I haven't run stereoscopic for ages, and can't recall or find the reference you're referring to over OPAQUE vs I420.
We've found this solution in these topics:
https://www.raspberrypi.org/forums/view ... p?p=918041
https://www.raspberrypi.org/forums/view ... p?p=364164
It's a fudge rather than a fix. It just removes all the signalling so video_render has no information to go on for stereoscopic, and hence interprets it as a single plane (quite probably squashed by decimation).
Realizator wrote:
6by9 wrote:
Wed Mar 06, 2019 9:42 am
Can you post a quick picture of what you're seeing as last time I tried stereoscopic it did the right thing on a 3D display when tvservice had been told to do stereoscopic.
I've recorded short experiment for you: https://youtu.be/6nCInrTC29M
Here we can see a single image only.
Thank you. a picture is worth 1000 words.
Realizator wrote:
6by9 wrote:
Wed Mar 06, 2019 9:42 am
Are you trying to force the two images side by side (or TB) on the same 2D display? I'm not sure what video_render does in those situations, but could be told to display the two frames appropriately. If a raspistill/vid flag is required, then I'm quite happy for one to be added.
Yes, 3D SBS or TB on 2D display. We've tried to solve it by HDMI mode settings and raspivid keys, but has no success.

We can do pull request to https://github.com/raspberrypi/userland for you to review our approach (from user G0l, it's my teammate).
May be it is easier to change default settings instead of adding new key, it's on your decision.
I'll see if there is an easy way to check whether the display is actually stereoscopic from within video_render. Switching to I420 has a fairly significant performance hit on the GPU.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”