jameszah / ESP32-CAM-Video-Telegram

Record avi video on ESP32-CAM and send to Telegram on event or request
GNU General Public License v3.0
113 stars 26 forks source link

wifi-manager issue, and photo quality #49

Closed JackFrap closed 10 months ago

JackFrap commented 10 months ago

Hello, 1- I set the wifi parameters through the wifi manager. But sometimes when I turn on the device it goes back to wifi-manager mode by itself and I have to re-enter the wifi parameters again. Is it possible to disable the wifi manager and enter the wifi parameters directly from the code? Thank you 2- How can I set the code so that with the "/photo" command it sends the photo with the highest possible image quality?

Thank you very very much!

jameszah commented 10 months ago

re: quality - the high-res photos are so big that the video element falls apart, and the switching resolution back and forth is time-consuming, You could set it at uxga resolution and just use the still photo feature.

The wifi switches to wifi-man when it cannot connect - might try harder to connect to you configured wifi before giving up and going to wifi-man. I'll have a look.

JackFrap commented 10 months ago

1- I think maybe I solved the first problem by eliminating 4 lines in the code: 1486-1487-1488-1489 … if (reset_request) { // wm.resetSettings(); // reset_request = false; // } …

2- Can you tell me which lines of code I have to modify to send photos to telegram in the highest possible quality, I'm not interested in videos, just photos Thank you 🙏

jameszah commented 10 months ago

https://github.com/jameszah/ESP32-CAM-Video-Telegram/blob/b9df4519c2aba9e8b74cc923e19858b832ec3b13/v9.6/ESP32-CAM-Video-Telegram_9.6/ESP32-CAM-Video-Telegram_9.6.ino#L159

159 and 162 I think. Set framesize to uxga assuming you have the standard 2640 camera. There might be problems with the buffers being to small. You would want to make the quality number as low as possible. It might be set to 10 or 12 in this code -- lowering the number will get you better resolution in the jpeg, but framesuze goes way up, which will slow down the transfer, and exceed the buffers.

jameszah commented 10 months ago

https://github.com/jameszah/ESP32-CAM-Video-Telegram/blob/b9df4519c2aba9e8b74cc923e19858b832ec3b13/v9.6/ESP32-CAM-Video-Telegram_9.6/ESP32-CAM-Video-Telegram_9.6.ino#L1337

The connection issue is in the wifimanager - I think it tries to connect to your wifi, but fails and then it runs the system to give you another opportunity to set your wifi.

A few lines of code to retry your wifi connection would help.

JackFrap commented 10 months ago

Thank you! After some testing these are the changes i made to set the quality to uxga:

159 framesize_t configframesize = FRAMESIZEUXGA; // FRAMESIZE + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA 160 int frame_interval = 0; // 0 = record at full speed, 100 = 100 ms delay between frames 161 float speed_up_factor = 1; // 1 = play at realtime, 0.5 = slow motion, 10 = speedup 10x 162 int framesize = FRAMESIZE_UXGA; //FRAMESIZE_HD; 163 int quality = 7; 164 int qualityconfig = 5;

1415 if (hdcam) { 1416 avi_buf_size = avail_psram - 1600 * 1200; //900 for hd, 500 for vga 1417 configframesize = FRAMESIZEUXGA; // FRAMESIZE + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA 1418 framesize = FRAMESIZE_UXGA; //FRAMESIZE_HD; 1419 Serial.println("Camera to UXGA ");