Open L3KKQKYM opened 4 years ago
I'm having this same issue after updating to the latest version of Octoprint 1.4.1 and 1.4.2. I'm hopeful the developers sees this and pushes an update for telegram to work with the latest version of octoprint.
Hi did you Flip the camera directly in Octoprint webcam options? if yes you have to do the same configuration again in the Telegram plugin. We just ask to Octoprint to send us the image and after that we rotate if configured. The image is showed as octoprint send it and with the configuration you have done in the plugin.
I 'm still at 1.4.0 so I don't know if this has change in the most recent release.
Okay, but where do I have to make these settings in telegram plugin ? I cannot see any option for that in the settings.
Von meinem iPhone gesendet
Am 07.08.2020 um 20:24 schrieb giloser notifications@github.com:
Hi did you Flip the camera directly in Octoprint webcam options? if yes you have to do the same configuration again in the Telegram plugin. We just ask to Octoprint to send us the image and after that we rotate if configured. The image is showed as octoprint send it and with the configuration you have done in the plugin.
I 'm still at 1.4.0 so I don't know if this has change in the most recent release.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Okay I check again and we should take back the config from octoprint.
I'll try again when I get
Sorry my bad you are right we use the global settings. I have seen that someone event propose a fix for that I'll add this for the next release that I hope will be quicker that the last one.
Whish I could Phyton so that I could help you .. only php, Perl and others i am used to
Von meinem iPhone gesendet
Am 07.08.2020 um 21:32 schrieb giloser notifications@github.com:
Sorry my bad you are right we use the global settings. I have seen that someone event propose a fix for that I'll add this for the next release that I hope will be quicker that the last one.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Well, I actually notice this strange behavior:
enabling "horizontal flip" flips the picture horizontally in telegram bot. enabling "vertical flip" ALSO flips picture horizontally in telegram bot.
I use Octoprint-Telegram 1.5.1 and can't seem to find any "flip" button in it's config
cad435
as a workaround, on your raspberry open the file init.py located under /oprint/lib/python2.7/site-packages/octoprint_telegram id did it with sudo nano -c init.py scoll down to line 1402
if flipH or flipV or rotate: image = Image.open(StringIO.StringIO(data)) if flipH: image = image.transpose(Image.FLIP_LEFT_RIGHT) if flipV: image = image.transpose(Image.FLIP_TOP_BOTTOM) if rotate: image = image.transpose(Image.ROTATE_270) output = StringIO.StringIO() image.save(output, format="JPEG") data = output.getvalue() output.close() return data
change the if flipH and/or the if flipV to if not flipH or if not flipV save this with ctrl + s and exit with ctrl + x reboot the pi
This is simply ridiculous: we have changed this code no less than 5 times to accommodate this: there is something obvious we are missing here
I know this, maybe a simple chekbox in the frontend to flipV flipH manualy can solve the questions
Hey there, just to throw in my two cents... Thanks @Sekisback for pointing out the code part for the quick fix.
In my case it was already negated and did not do what it should ;) so I had to remove the not
image = Image.open(StringIO.StringIO(data))
#if not flipH: -> previous
if flipH:
image = image.transpose(Image.FLIP_LEFT_RIGHT)
#if not flipV: -> previous
if flipV:
image = image.transpose(Image.FLIP_TOP_BOTTOM)~~~
Just for my understanding:
In these Lines of Code the Flags flipH, filpV and rotate get initialized: flipH = self._settings.global_get(["webcam", "flipH"]) flipV = self._settings.global_get(["webcam", "flipV"]) rotate= self._settings.global_get(["webcam", "rotate90"])
They may contain true or false;
In the original coding it is asked if one of these is true.
if flipH or flipV or rotate: image = Image.open(StringIO.StringIO(data)) if not flipH: image = image.transpose(Image.FLIP_LEFT_RIGHT) if not flipV: image = image.transpose(Image.FLIP_TOP_BOTTOM) if rotate: image = image.transpose(Image.ROTATE_270) output = StringIO.StringIO() image.save(output, format="JPEG") data = output.getvalue() output.close()
What kind if sense does it make, that I do a flip or a rotate only, if its NOT flipped ? Rotate should work.
It should be like this, right ?
if flipH or flipV or rotate: image = Image.open(StringIO.StringIO(data))
if flipH:
image = image.transpose(Image.FLIP_LEFT_RIGHT)
#if not flipV:
if flipV:
image = image.transpose(Image.FLIP_TOP_BOTTOM)
if rotate:
image = image.transpose(Image.ROTATE_270)
output = StringIO.StringIO()
image.save(output, format="JPEG")
data = output.getvalue()
output.close()
Best regards
Am 23.08.2020 um 08:34 schrieb Sekisback notifications@github.com:
as a workaround, on your raspberry open the file init.py located under /oprint/lib/python2.7/site-packages/octoprint_telegram id did it with sudo nano -c init.py scoll down to line 1402
if flipH or flipV or rotate: image = Image.open(StringIO.StringIO(data)) if flipH: image = image.transpose(Image.FLIP_LEFT_RIGHT) if flipV: image = image.transpose(Image.FLIP_TOP_BOTTOM) if rotate: image = image.transpose(Image.ROTATE_270) output = StringIO.StringIO() image.save(output, format="JPEG") data = output.getvalue() output.close() return data
change the if flipH and/or the if flipV to if not flipH or if not flipV save this with ctrl + s and exit with ctrl + x reboot the pi
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fabianonline/OctoPrint-Telegram/issues/278#issuecomment-678735973, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQFUBAA6RTMKT4N7L26OQLSCCZ6VANCNFSM4PVFZQ5Q.
Adding this here because I am seeing a similar issue. Pictures are working fine for me with both horizontal and vertical flip enabled, but gifs do not get flipped as they should. Images look fine for me, gifs are still upside down
Adding this here because I am seeing a similar issue. Pictures are working fine for me with both horizontal and vertical flip enabled, but gifs do not get flipped as they should. Images look fine for me, gifs are still upside down
I fixed this issue quick an dirty: connect to pi via ssh. cd /oprint/lib/python2.7/site-packages/octoprint_telegram sudo vi init.py type ESC and then type :1500 to go to line 1500. Scroll down until you find this code: params.append('cpulimit') params.append( '-l') params.append( '65') params.append( '-f') params.append( '-z') params.append( '--') params.append( 'ffmpeg') params.append( '-y' ) params.append( '-threads') params.append( '1') params.append( '-i') params.append( stream_url) params.append( '-t') params.append( timeSec) params.append( '-c:v') params.append( 'mpeg4') params.append( '-c:a' ) params.append( 'mpeg4')
at the end append the following lines:
params.append( '-vf')
params.append( 'transpose=2,transpose=2' )
# End Rotation
Save and restart the system. This worked for me, but is quick an dirty and does not check the CheckBoxes for Flip.
Best regards
That worked! It just flips everything so now my images are upside down and gifs are correct, but this is a good workaround for now. Thanks!
As I said, we have changed this code so many times it’s ridiculous. I would not consider this or any other snippet like that as a fix of any sort: we need to get to root or just leave it as broken...
It is just a workaround and no fix :) I am sure the developer will find a solution. Maybe foosel may help 😊
Von meinem iPhone gesendet
Am 27.08.2020 um 22:28 schrieb Roberto Lo Giacco notifications@github.com:
As I said, we have changed this code so many times it’s ridiculous. I would not consider this or any other snippet like that as a fix of any sort: we need to get to root or just leave it as broken...
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
please could you check if you can now make things work as expected on the latest version #352
@giloser the webcam (photos) seem to be OK now, the GIFs are still rotated tho.
that strange I just check and the modification is there. same config as for the image? not multi cam? Could you check the log and send me the params of the gif creation? Should start with "will now create the video "
thanks
2022-01-06 15:05:12,763 - octoprint.plugins.telegram.TCMD - INFO - Will try to create a gif 2022-01-06 15:05:13,006 - octoprint.plugins.telegram - ERROR - Caught an exception trying clean previous images : [Errno 2] No such file or directory: '/home/pi/.octoprint/data/telegram/tmpgif/gif.mp4' 2022-01-06 15:05:13,007 - octoprint.plugins.telegram - INFO - test if nice exist 2022-01-06 15:05:13,007 - octoprint.plugins.telegram - INFO - test exist program 'nice', '--version' 2022-01-06 15:05:13,034 - octoprint.plugins.telegram - INFO - ret = 0 2022-01-06 15:05:13,035 - octoprint.plugins.telegram - INFO - test if cpulimit exist 2022-01-06 15:05:13,035 - octoprint.plugins.telegram - INFO - test exist program 'cpulimit', '--help' 2022-01-06 15:05:13,064 - octoprint.plugins.telegram - INFO - ret = 1 2022-01-06 15:05:13,066 - octoprint.plugins.telegram - INFO - test if ffmpeg exist 2022-01-06 15:05:13,066 - octoprint.plugins.telegram - INFO - test exist program 'ffmpeg', '-h' 2022-01-06 15:05:14,178 - octoprint.plugins.telegram - INFO - ret = 0 2022-01-06 15:05:14,430 - octoprint.plugins.telegram - INFO - sec=5 2022-01-06 15:05:14,431 - octoprint.plugins.telegram - INFO - timeSec=11:11:05 2022-01-06 15:05:14,432 - octoprint.plugins.telegram - INFO - limit_cpu=130.0 | used_cpu=2.0 | because nb_cpu=4 2022-01-06 15:05:14,432 - octoprint.plugins.telegram - INFO - Image transformations [H:False, V:False, R:True] 2022-01-06 15:05:14,432 - octoprint.plugins.telegram - INFO - Need to rotate 90deg counter clockwise 2022-01-06 15:05:14,433 - octoprint.plugins.telegram - INFO - will now create the video 'nice', '-n', '20', 'cpulimit', '-l', '130.0', '-f', '-z', '--', 'ffmpeg', '-y', '-threads', '2.0', '-i', 'http://localhost/webcam/?action=stream', '-t', '11:11:05', '-pix_fmt', 'yuv420p', '-vf', 'transpose=1', '/home/pi/.octoprint/data/telegram/tmpgif/gif.mp4' 2022-01-06 15:05:31,175 - octoprint.plugins.telegram - INFO - Finish the video
Does this help?
This still does not appear to work. I have tried the fixes suggested throughout the comments, but the telegram images still appear to ignore octoprint flip settings in all cases.
Same here: I have my webcam installed facedown. In classic webcam plugin I have checked: Flip webcam horizontally and Flip webcam vertically and the live stream looks good inside octoprint and octoapp, but these options don't affect the image sent via Telegram that continues being facedown.
In Webcam-Settings of Octoprint the Options are checked, horizontal flip and vertical flip. The images that get send with telegram are not flipped.