TelloPy icon indicating copy to clipboard operation
TelloPy copied to clipboard

changing the directory for pictures and video

Open trooperisme opened this issue 4 years ago • 11 comments

Hi, This is a very very easy easy question, but I dont know how to work with '%s'. Let's say that my directory is: C:\Users\hi\Pictures\fly

trooperisme avatar Mar 19 '20 19:03 trooperisme

path = '%sUsers/hi/Pictures/Screenshots/tello-%s.jpeg' % ( 'C:/', datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')) with open(path, 'wb') as fd: fd.write(data) status_print('Saved photo to %s' % path)

I switch the os.getenv() method back to 'C:/'. Then I end up getting the message:

Tello: 13:25:14.920: Info: unknown packet: 0030 cc 60 00 27 b0 30 00 00 00 00 02 0d Tello: 13:25:14.921: Info: recv: file size: cc 90 00 be 88 62 00 2e 00 01 d8 d5 09 00 00 00 2b 5f Tello: 13:25:14.921: Info: file size: num=0 bytes=644568 ALT: 10 | SPD: 0 | BAT: 61 | WIFI: 90 | CAM: 0 | MODE: 6 Tello: 13:25:14.971: Info: recv: file size: cc 60 00 27 50 62 00 2e 00 00 db ff Tello: 13:25:14.972: Warn: file size: payload too small: 00.

##Then the camera screen starts to freezing. I am so confused now, also I cannot record video either (mostly due to the 'path') Thanks,

trooperisme avatar Mar 19 '20 21:03 trooperisme

Hello, I also changed the os.getenv() method back to 'C:/', but I received the file not found error. Have you solved this problem yet?

viet2411 avatar May 22 '20 02:05 viet2411

Hi Viet, I tried but it still doesn’t work out. I have been playing around with the path but I cant figure it out (i am stupid lol). I think you should keep it as default !!!

trooperisme avatar May 22 '20 03:05 trooperisme

Update: I switched the os.getenv() method to os.getcwd() and was able to capture a picture, but the camera screen freezed after that. Still don't understand why this happenned lol

viet2411 avatar May 22 '20 06:05 viet2411

Update: I switched the os.getenv() method to os.getcwd() and was able to capture a picture, but the camera screen freezed after that. Still don't understand why this happenned lol

that is exactly what I experienced (you still can have access to control via your device, it is just the camera doesn't get the images)

trooperisme avatar May 22 '20 14:05 trooperisme

@hanyazou please help if you feel free

trooperisme avatar May 22 '20 14:05 trooperisme

Hello! I just removed all the previous directory jazz and did "telloPic" + str(round(time.time())) + ".png" for the path. It'll save to the same folder as the python script.

gemSquared avatar May 22 '20 15:05 gemSquared

oh thats nice, it makes more sense to me tho

trooperisme avatar May 22 '20 16:05 trooperisme

Has anyone recorded the video yet?

viet2411 avatar Jul 07 '20 13:07 viet2411

@viet2411 I was able to do this through Windows :)

I had to do the following:

  1. Download Mplayer for Windows here: https://sourceforge.net/projects/mplayerwin/files/MPlayer-MEncoder/r38151/mplayer-svn-38151-x86_64.7z/download

  2. Unzip the file via 7zip

  3. Add the extracted folder to your PATH (I followed this guide)

    • I had to restart PyCharm after doing this, so restart your IDE to make sure it gets the new enviroment.
  4. Install the wheel (see README) and add the following packages into your Python environment via pip: av, opencv-python, image, pygame

  5. In keyboard_and_video.py, change the filename at line 57 to a Windows friendly directory

    • e.g. '%s\\Pictures\\tello-%s.mp4' % ('C:\\Users\\Buddy', datetime.datetime.now().strftime(date_fmt))
    • I would recommend doing this for jpegs at line 209
  6. Uncomment line 62 and 63 (may not be necessary, but I did it anyway)

  7. Run keyboard_and_video.py

  8. Hit R

  9. Fly Around a Little

  10. Hit R

  11. Land and gracefully terminate program

And now I have an MP4 that I have to open through Google Chrome to view :)

giphy

Walt-H avatar Jul 17 '20 16:07 Walt-H

@Walt-H Finally I can record video with this program. Thank you so much for your support!

viet2411 avatar Jul 18 '20 05:07 viet2411