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