在 Python 中通过 Popen 调用 cvlc 时出错
Error when calling cvlc through Popen in Python
我正在尝试将 h264 传输到 python 中的 vlc。我在 Popen 中调用 cvlc 程序时遇到问题。这是代码。
self.vlc = subprocess.Popen([
"cvlc", "-vvv", "stream:///dev/stdin", "--sout \'#rtp{sdp=rtsp://:8554/}\' :demux=h264"
], stdin=subprocess.PIPE)
这是 vlc 错误
vlc: unknown option or missing mandatory argument `--sout '#rtp{sdp=rtsp://:8554/}' :demux=h264'
几个小时以来,我一直在尝试使用不同类型的字符串格式来解决这个问题。
Question: I'm having trouble opening the cvlc program while calling it in Popen.
使用shlex.quote(..
。获取参数的 shell 转义版本。
Python 3.6 Documentation:shlex.quote
shlex.quote(s)
Return a shell-escaped version of the string s. The returned value is a string that can safely be used as one token in a shell command line, for cases where you cannot use a list
我正在尝试将 h264 传输到 python 中的 vlc。我在 Popen 中调用 cvlc 程序时遇到问题。这是代码。
self.vlc = subprocess.Popen([
"cvlc", "-vvv", "stream:///dev/stdin", "--sout \'#rtp{sdp=rtsp://:8554/}\' :demux=h264"
], stdin=subprocess.PIPE)
这是 vlc 错误
vlc: unknown option or missing mandatory argument `--sout '#rtp{sdp=rtsp://:8554/}' :demux=h264'
几个小时以来,我一直在尝试使用不同类型的字符串格式来解决这个问题。
Question: I'm having trouble opening the cvlc program while calling it in Popen.
使用shlex.quote(..
。获取参数的 shell 转义版本。
Python 3.6 Documentation:shlex.quote
shlex.quote(s)
Return a shell-escaped version of the string s. The returned value is a string that can safely be used as one token in a shell command line, for cases where you cannot use a list