Example
Hello, can you give an usage example for the output filename?
Wich extension its compatible? h264? mp4? ffmpeg?
im trying to: python rdt.py -u <stream_cam> -f output.h264
without success
thanks in advance
The filename you choose shouldn't matter; the data is always what the server sends. I think it's usually MP4.
I changed the import from
from urlparse import urlsplit
to
import urllib.parse as u_split
If I dont change, an error No module named urlparse appears
The problem I have is:
2017-08-08 14:35:46-0300 [-] File "<path>/rtsp.py", line 353, in setURL
2017-08-08 14:35:46-0300 [-] parsed_url = u_split(url)
2017-08-08 14:35:46-0300 [-] TypeError: 'module' object is not callable
And the command line Im using as root is:
python3 rdt.py -u rtsp://<ip>/live.sdp?codectype=h264&h264_intraperiod=4000&h264_quant=99&h264_qvalue=40
And, the line 353 contains:
def setURL(self, url):
""" Parses given url into username, password, host, and port """
self.url = url
parsed_url = u_split(url)
self.scheme, self.netloc, self.path, self.query, self.fragment = parsed_url
self.host = parsed_url.hostname
if self.host is None:
self.host = self.netloc
The url parameter comes as a string, as it need to be
I dont know what im doing wrong here
EDIT:
I changed the import to from urllib.parse import urlparse and it looks to work
But now Im dowloading 0 bytes
2017-08-08 14:51:10-0300 [-] Log opened.
2017-08-08 14:51:10-0300 [-] PARSED: ParseResult(scheme='rtsp', netloc='<ip>', path='/live.sdp', params='', query='codectype=h264&h264_intraperiod=4000&h264_quant=99&h264_qvalue=40', fragment='')
2017-08-08 14:51:10-0300 [-] Starting factory <RTSPClientFactory: rtsp://<ip>/live.sdp?codectype=h264&h264_intraperiod=4000&h264_quant=99&h264_qvalue=40>
2017-08-08 14:51:10-0300 [-] Connected!
2017-08-08 14:51:10-0300 [Uninitialized] Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/posixbase.py", line 602, in _doReadOrWrite
why = selectable.doWrite()
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 586, in doConnect
self._connectDone()
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 615, in _connectDone
self.protocol.makeConnection(self)
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/protocol.py", line 494, in makeConnection
self.connectionMade()
File "<path>/rtsp.py", line 173, in connectionMade
self.sendNextMessage()
File "<path>/rdt.py", line 458, in sendNextMessage
self._sendOptions()
File "<path>/rdt.py", line 386, in _sendOptions
self.sendOptions(target, headers)
File "<path>/rtsp.py", line 305, in sendOptions
self.sendMethod('OPTIONS', target, headers)
File "<path>/rtsp.py", line 82, in sendMethod
self.sendCommand(method, target)
File "<path>/rtsp.py", line 65, in sendCommand
self.sendLine('%s %s RTSP/1.0' % (command, path))
File "/usr/local/lib/python3.5/dist-packages/twisted/protocols/basic.py", line 635, in sendLine
return self.transport.write(line + self.delimiter)
builtins.TypeError: Can't convert 'bytes' object to str implicitly
2017-08-08 14:51:10-0300 [-] Stopping factory <RTSPClientFactory: rtsp://<ip>/live.sdp?codectype=h264&h264_intraperiod=4000&h264_quant=99&h264_qvalue=40>
2017-08-08 14:51:11-0300 [-] Downloaded 0.0bytes
2017-08-08 14:51:12-0300 [-] Downloaded 0.0bytes