# AMB82 MINI Read QR Code and Datamatrix while record a video

**URL:** <https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625>\
**Category:** Peripherals\
**Tags:** evb-amb82\
**Created:** [January 22, 2024, 11:40am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625 "2024-01-22T11:40:49Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.amebaiot.com/u/Ivan)\
**Post date:** [April 22, 2024, 7:04am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/21 "2024-04-22T07:04:32Z")

</div>

I need to record video and at the same time also detect if a QR Code is in front of camera, if yes, i send the string throught serial to another microcontroller that make other operations.

In the video i record that the user put the QR Code in front of the camera and all the events that occours before and after the QR Code, this is for security reason.

Is this clear?

The next step is to control the start and stop record throught serial, the video recorded can be long like 5 minutes

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.amebaiot.com/u/Ivan)\
**Post date:** [April 22, 2024, 7:51am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/23 "2024-04-22T07:51:16Z")

</div>

It’s written in the first post… I can’t use two AMB82-Mini for my application

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [April 22, 2024, 7:55am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/24 "2024-04-22T07:55:28Z")

</div>

Hi @Ivan,

How much time do you have left for your prototype?  
We will try to see if there are any ways to get this feature out.

It might be highly possible, after reviewing the code. Recording at 720P is alright right?

Thank you.

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.amebaiot.com/u/Ivan)\
**Post date:** [April 22, 2024, 8:07am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/25 "2024-04-22T08:07:02Z")

</div>

I have time till the and of may

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [April 22, 2024, 8:54am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/26 "2024-04-22T08:54:27Z")

</div>

Hi @Ivan,

I have just successfully integrated this. However, there is still optimization that can be done to the following example. For now, you can be reassured that this feature is doable. Once the optimization of the code is done, we will commit to our official repository.

> #undef DEFAULT
> 
> #include “VideoStream.h”  
> #include “QRCodeScanner.h”  
> #include “StreamIO.h”  
> #include “MP4Recording.h”
> 
> #define CHANNEL 0  
> #define RECORDINGCHANNEL 1
> 
> // Default preset configurations for each video channel:  
> // Channel 0 : 1920 x 1080 30FPS H264  
> // Channel 1 : 1280 x 720 30FPS H264
> 
> VideoSetting config(CHANNEL);  
> VideoSetting configv1(RECORDINGCHANNEL);  
> QRCodeScanner Scanner;  
> MP4Recording mp4;  
> StreamIO videoStreamer(1, 1);
> 
> void setup() {  
> // Initialize serial communication  
> Serial.begin(115200);  
> // Configure camera video channel with video format information  
> Camera.configVideoChannel(CHANNEL, config);  
> Camera.configVideoChannel(RECORDINGCHANNEL, configv1);  
> Camera.videoInit();
> 
> mp4.configVideo(configv1);  
> mp4.setRecordingDuration(30);  
> mp4.setRecordingFileCount(1);  
> mp4.setRecordingFileName(“TestRecordingVideoOnly”);  
> mp4.setRecordingDataType(STORAGE\_VIDEO); // Set MP4 to record video only
> 
> // Configure StreamIO object to stream data from video channel to MP4 recording  
> videoStreamer.registerInput(Camera.getStream(RECORDINGCHANNEL));  
> videoStreamer.registerOutput(mp4);  
> if (videoStreamer.begin() != 0) {  
> Serial.println(“StreamIO link start failed”);  
> }
> 
> // Start data stream from video channel  
> // Camera.channelBegin(CHANNEL);  
> Camera.channelBegin(RECORDINGCHANNEL);  
> // Start recording MP4 data to SD card  
> Serial.println(“Mp4 begin”);  
> mp4.begin();
> 
> Scanner.StartScanning();  
> }
> 
> void loop() {  
> // User can use the result string and length from here.  
> // You can modify the delay to the rate of retrieving the result string and result length.  
> // Currently, third successful scan will allow you to get the result string and length reliably.  
> // Note that this loop may not be optimised, you are to do your own conditional checks to get your application working.  
> // This is to illustrate how to retrieve the qr code scanning results.
> 
> delay(1000);  
> Scanner.GetResultString();  
> Scanner.GetResultLength();  
> if (Scanner.ResultString != nullptr) {  
> Serial.print(“Result String is:”);  
> Serial.println(Scanner.ResultString);  
> }  
> if (Scanner.ResultLength != 0) {  
> Serial.print(“Result Length is:”);  
> Serial.println(Scanner.ResultLength);  
> }  
> }

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [April 24, 2024, 2:49am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/27 "2024-04-24T02:49:58Z")

</div>

Hi @Ivan,

You may set the recording time mp4.setRecordingDuration(300); to record 5 mins.

Thank you.

---

<div class="post-metadata">

**Author:** ![HDP](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HDP](https://forum.amebaiot.com/u/HDP)\
**Post date:** [April 24, 2024, 6:39am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/28 "2024-04-24T06:39:25Z")

</div>

Thank you for your analysis! One question left: where can I find the QRCodeScanner lib? It is not listed in my File-Examples-directory?

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.amebaiot.com/u/Ivan)\
**Post date:** [April 24, 2024, 6:51am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/29 "2024-04-24T06:51:07Z")

</div>

I know, but i need to start record for an unspecified time by serial command and also stop it by serial command

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.amebaiot.com/u/Ivan)\
**Post date:** [April 24, 2024, 6:53am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/30 "2024-04-24T06:53:30Z")

</div>

You can find the library and the example at this link [ambpro2\_arduino/Arduino\_package/hardware/libraries at dev · Kyderio/ambpro2\_arduino · GitHub](https://github.com/Kyderio/ambpro2_arduino/tree/dev/Arduino_package/hardware/libraries)

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [April 24, 2024, 7:29am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/31 "2024-04-24T07:29:07Z")

</div>

Hi @Ivan,

Unfortunately you will have to configure a duration to record the video when starting a recording. For instance, you may set a duration of 5 mins. And at the 3 minute mark, if you want to stop the recording, you may call the API mp4.end().

Thank you.

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [April 24, 2024, 7:30am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/32 "2024-04-24T07:30:04Z")

</div>

Hi @HDP,

You may refer to the libraries here. [ambpro2\_arduino/Arduino\_package/hardware/libraries/QRCodeScanner/src at dev · ambiot/ambpro2\_arduino · GitHub](https://github.com/ambiot/ambpro2_arduino/tree/dev/Arduino_package/hardware/libraries/QRCodeScanner/src)

Thank you.

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [May 3, 2024, 1:49am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/33 "2024-05-03T01:49:32Z")

</div>

Hi @Ivan,

Are you still facing any technical difficulties? Let me know as soon as possible so that I can help you early, before End of May arrive.

Thank you.

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.amebaiot.com/u/Ivan)\
**Post date:** [May 6, 2024, 8:29am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/34 "2024-05-06T08:29:37Z")

</div>

Sorry, I missed this message… I tested it now and it work fine. When i start the program i see a lot of debug string in the serial monitor

```auto
== Rtl8735b IoT Platform ==

[Normal mode]
BootFromNORFlash
[Start Boot ROM...]
=== Load PARTBL ===
=== Load Done ===
=== Load ISP_IQ ===
[fcs chk pass]
ISP_IQ @ 0x8461080, 0x1af80, 0x0
mfcs_data version 0x00010001
fcs_data version 0x00010101
=== Process ISP_IQ ===
=== Load Done ===
=== Load BL ===
[Image Start Table @ 0x18200]
=== Load Done ===

== Boot Loader ==
Dec 20 2023:16:58:59
=== Load FCS Para ===
=== Load Done ===

```

also when the loop is running

```auto
[VOE]release s0 isp buffer 0 

[VOE][WARN]useless release s0 slot0 status 0x00000000 

[VOE]release s0 isp buffer 1 

[VOE][WARN]useless release s0 slot1 status 0x00000000

```

how can i disable all this debug strings?

I searched in the arduino ide options but i can’t find an option to do that, i need to remove this in all of the libraries manually?

Thanks a lot for your help

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [May 6, 2024, 8:57am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/35 "2024-05-06T08:57:01Z")

</div>

Hi @Ivan,

Unfortunately, these debug messages cannot be removed at the moment, because the file that generates this is not open source. May I know if it is a must to remove the log? If yes, I will try to ask if I am able to provide you with the binary file with the printing log disabled.

Thank you.

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://forum.amebaiot.com/u/Ivan)\
**Post date:** [May 10, 2024, 7:46am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/36 "2024-05-10T07:46:13Z")

</div>

Maybe i can use another serial to comunicate with my other microcontroller, but if i’m able to manage this log strings i prefer and i think it’s helpful also for the comunity if you provide a flag to enable/disable it in arduino ide

---

<div class="post-metadata">

**Author:** ![Kelvin\_Huang](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/kelvin_huang/32/2130_2.png) [@Kelvin\_Huang](https://forum.amebaiot.com/u/Kelvin_Huang)\
**Post date:** [May 11, 2024, 2:10am UTC](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625/37 "2024-05-11T02:10:58Z")

</div>

Hi @Ivan,

Thanks for your feedback, we will see if it is possible to provide a way for users to manage the log.

Let us know if you require any assistance for your smart locker project because there are still around 2 more weeks till end of May. Would like to help with any technical issues as soon as possible.

[Previous page](https://forum.amebaiot.com/t/amb82-mini-read-qr-code-and-datamatrix-while-record-a-video/2625.md?page=1)
