Created
December 28, 2023 03:58
-
-
Save genevera/ea9330873f5a9855cc81153d37a9e67f to your computer and use it in GitHub Desktop.
Revisions
-
genevera created this gist
Dec 28, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ #!/usr/bin/env python3 ############################################################################### # you'll need to install pyzmq via `pip install pyzmq` ############################################################################### import cmd import sys import zmq class LavfiCmd(cmd.Cmd): prompt = "lavfi> " def __init__(self, bind_address): context = zmq.Context() self.requester = context.socket(zmq.REQ) self.requester.connect(bind_address) cmd.Cmd.__init__(self) def onecmd(self, cmd): if cmd == "EOF": sys.exit(0) print(f"Sending command: {cmd}") self.requester.send_string(cmd) message = self.requester.recv() print(f"Received reply: {message}") try: bind_address = sys.argv[1] if len(sys.argv) > 1 else "tcp://localhost:5555" LavfiCmd(bind_address).cmdloop("FFmpeg libavfilter interactive shell") except KeyboardInterrupt: pass