AMB 82 mini Video from portrait (vertical) to landscape (horizontal)

hi all,

I just a noob with amb 82 mini and I am sorry if my question isn’t very precise.

I just install Arduino IDE 2,2,1 with the latest Realtek Ameba Boards version 4.05.Build20231102
I try to set my video in horizontal (landscape) and I try to use the config.setRotation(1)
like below :

#define CHANNEL 0
#define CHANNEL_JPEG 1

VideoSetting configV1(VIDEO_FHD, CAM_FPS, VIDEO_H264, 1);
VideoSetting configV2(VIDEO_FHD, CAM_FPS, VIDEO_JPEG, 1);

configV1.setRotation(1);
Camera.configVideoChannel(CHANNEL, configV1);
configV2.setRotation(1);
Camera.configVideoChannel(CHANNEL_JPEG, configV2);

for the JPEG it is ok but for the h264 is not !

could you please explain me what it is missing ?

regards
thanks in advance

Hi @Ram_Cla ,
Based on our VideoOnly.ino example code with setRotation API on H264 encoded video channel, the streaming is working fine. You may test with the code attached below in your environment:

/*
 Please adjust VideoSetting to get better video quality when streaming to V7RC APP:
     VideoSetting config(VIDEO_D1, CAM_FPS, VIDEO_H264, 0);

 Example guide:
 https://www.amebaiot.com/en/amebapro2-arduino-video-rtsp/
*/

#include "WiFi.h"
#include "StreamIO.h"
#include "VideoStream.h"
#include "RTSP.h"

#define CHANNEL 0

// Default preset configurations for each video channel:
// Channel 0 : 1920 x 1080 30FPS H264
// Channel 1 : 1280 x 720  30FPS H264
// Channel 2 : 1280 x 720  30FPS MJPEG

VideoSetting config(VIDEO_FHD, CAM_FPS, VIDEO_H264, 1);
RTSP rtsp;
StreamIO videoStreamer(1, 1);   // 1 Input Video -> 1 Output RTSP

char ssid[] = "Network_SSID";   // your network SSID (name)
char pass[] = "Password";       // your network password
int status = WL_IDLE_STATUS;

void setup() {
    Serial.begin(115200);

    // attempt to connect to Wifi network:
    while (status != WL_CONNECTED) {
        Serial.print("Attempting to connect to WPA SSID: ");
        Serial.println(ssid);
        status = WiFi.begin(ssid, pass);

        // wait 2 seconds for connection:
        delay(2000);
    }

    // Configure camera video channel with video format information
    // Adjust the bitrate based on your WiFi network quality
    //config.setBitrate(2 * 1024 * 1024);     // Recommend to use 2Mbps for RTSP streaming to prevent network congestion
    config.setRotation(1);
    Camera.configVideoChannel(CHANNEL, config);
    Camera.videoInit();

    // Configure RTSP with identical video format information
    rtsp.configVideo(config);
    rtsp.begin();

    // Configure StreamIO object to stream data from video channel to RTSP
    videoStreamer.registerInput(Camera.getStream(CHANNEL));
    videoStreamer.registerOutput(rtsp);
    if (videoStreamer.begin() != 0) {
        Serial.println("StreamIO link start failed");
    }

    // Start data stream from video channel
    Camera.channelBegin(CHANNEL);

    delay(1000);
    printInfo();
}

void loop() {
    // Do nothing
}

void printInfo(void) {
    Serial.println("------------------------------");
    Serial.println("- Summary of Streaming -");
    Serial.println("------------------------------");
    Camera.printInfo();

    IPAddress ip = WiFi.localIP();

    Serial.println("- RTSP -");
    Serial.print("rtsp://");
    Serial.print(ip);
    Serial.print(":");
    rtsp.printInfo();
}

One reason that causing your bug might be your channel configuration videoStreamer setup incorrectly. Please check your code again. Thanks

Hi dakamaster,
Thanks for your response but it do not resolve my issue
I have got the same thing event if I copy/paste your code the amb 82 mini by the Arduino program

The rotation works (AMB 82 mini on the side in landscape :slight_smile: and my head this in the right position on my shoulder :slight_smile: )but the default aspect video format is still for in portrait mode (I see more below and above) and I expect landscape (to see more thing in my left et my right)

Do you have any idea to achieve this ?

Regard

Hi @Ram_Cla ,

Thanks for your explanation.

You might misunderstood the feature of setRotation() API.
Firstly, this API is defined under VedioSetting Class, which means this is a feature for processing the video upon it is captured from the camera lens/sensor. You may adjust the length and width of the captured image using setRotation() conviniently.

Remember, we are using a fixed-length camera, thus the number of pixels it captured is also fixed before feeding into the VideoSetting Class.

Thus, if you expected to view more, means the focal length might need to be adjust during the image pixels capturing. Which cannot be achieved using 82 mini.

Hope I have clarified your doubt. Thanks! :smiley:

Hello,
I resolve my problem by modifying the VideoSetting and after set the rotation to “1”
Thanks for your help
Regards