almost live, but horrible hack for stream capture, and not live ffmpeg, just live save of images
This commit is contained in:
		
							parent
							
								
									17c7d0e555
								
							
						
					
					
						commit
						fccc2ba2e5
					
				
							
								
								
									
										25
									
								
								decode.py
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								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') | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user