Spaces:
Runtime error
Runtime error
Download streamVideo_fromPipe.py from SoccerQ/video-analysis: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/spaces/SoccerQ/video-analysis/resolve/main/streamVideo_fromPipe.py
- Command line
-
hf download hf://spaces/SoccerQ/video-analysis/streamVideo_fromPipe.py
-
curl -L -o streamVideo_fromPipe.py https://huggingface.co/spaces/SoccerQ/video-analysis/resolve/main/streamVideo_fromPipe.py
1.54 kB
| # import subprocess | |
| # from multiprocessing import Pipe, Process | |
| # from ipCameraBatchVideo_Stream import main | |
| # def stream_video_ffmpeg(pipe): | |
| # command = [ | |
| # 'ffmpeg', | |
| # '-re', | |
| # '-f', 'rawvideo', | |
| # '-pixel_format', 'bgr24', | |
| # '-video_size', '1280x720', ##1280x720 # Adjust the size according to your input frames | |
| # '-i', '-', | |
| # '-f', 'mpegts', | |
| # 'tcp://127.0.0.1:12345?listen' # Use TCP instead of UDP | |
| # ] | |
| # process = subprocess.Popen(command, stdin=subprocess.PIPE, stderr=subprocess.PIPE) | |
| # try: | |
| # while True: | |
| # frame = pipe.recv_bytes() | |
| # if not frame: | |
| # break | |
| # process.stdin.write(frame) | |
| # # print("Streaming frame...") # Confirm frames are being sent | |
| # except EOFError: | |
| # pass | |
| # except BrokenPipeError as e: | |
| # print(f"Broken pipe error: {e}") | |
| # except Exception as e: | |
| # print(f"Unexpected error: {e}") | |
| # finally: | |
| # process.stdin.close() | |
| # process.wait() | |
| # pipe.close() | |
| # stderr_output = process.stderr.read().decode('utf-8') | |
| # print(f"FFmpeg stderr: {stderr_output}") | |
| # if __name__ == '__main__': | |
| # parent_pipe, child_pipe = Pipe() | |
| # stream_process = Process(target=stream_video_ffmpeg, args=(parent_pipe,)) | |
| # stream_process.start() | |
| # main(child_pipe) # Call the main function from the capture and process script | |
| # stream_process.join() | |
| # child_pipe.close() |