I've been playing around with the python examples on github (dji-sdk/Tello-Python) , but one thing I can't seem to figure out, is how to store the video stream to a file and play back later. I have no issues watching the stream live using the provided h264decoder library, but how can I store the stream?
I tried to add a binary write call in the video socket loop like, e.g. :
def _receive_video_thread(self):
"""
Listens for video streaming (raw h264) from the Tello.
Runs as a thread, sets self.frame to the most recent frame Tello captured.
"""
packet_data = ""
while True:
try:
res_string, ip = self.socket_video.recvfrom(2048)
packet_data += res_string
write to a file here
# end of frame
if len(res_string) != 1460:
for frame in self._h264_decode(packet_data):
self.frame = frame
packet_data = ""
My understanding is that it is already a h264 stream so I would have expected that it could just go into a file and then be piped back into ffmpeg or similar too for post processing?
Any help would be much appreciated!
Fly Safe - NoDecaf
I tried to add a binary write call in the video socket loop like, e.g. :
def _receive_video_thread(self):
"""
Listens for video streaming (raw h264) from the Tello.
Runs as a thread, sets self.frame to the most recent frame Tello captured.
"""
packet_data = ""
while True:
try:
res_string, ip = self.socket_video.recvfrom(2048)
packet_data += res_string
write to a file here
# end of frame
if len(res_string) != 1460:
for frame in self._h264_decode(packet_data):
self.frame = frame
packet_data = ""
My understanding is that it is already a h264 stream so I would have expected that it could just go into a file and then be piped back into ffmpeg or similar too for post processing?
Any help would be much appreciated!
Fly Safe - NoDecaf