almost live, but horrible hack for stream capture, and not live ffmpeg, just live save of images

This commit is contained in:
devdesk 2024-02-15 00:27:48 +02:00
parent 17c7d0e555
commit fccc2ba2e5

View File

@ -165,13 +165,18 @@ if not args.live:
print("to play: ffplay thermal.mp4") print("to play: ffplay thermal.mp4")
else: else:
output = 'to_ffmpeg' # TODO: to video via ffmpeg; right now just a single png
# live: write to named pipe # of the last frame
if not Path(output).exists(): def todo_live_ffmpeg():
print(f'making fifo at {output}') output = 'to_ffmpeg'
os.mkfifo(output) # live: write to named pipe
fd = open(output, 'wb') if not Path(output).exists():
for i, frame in enumerate(frames): print(f'making fifo at {output}')
print(f'frame {i:3}') os.mkfifo(output)
Image.fromarray(np.frombuffer(frame, dtype='>H').reshape(WIDTH, HEIGHT)).save(f'test_{i:04}.png') fd = open(output, 'wb')
fd.write(frame) for frame in frames:
fd.write(frame)
for frame in frames:
print('.')
Image.fromarray(np.frombuffer(frame, dtype='>H').reshape(WIDTH, HEIGHT)).save(f'live.png')