Is it possible to issue a redirect to a rtmp request - similar to a http 302 redirect?
It is not possible for me to fix all of the rtmp urls that exist in my content, so I would like to put some sort of a basic redirector in place that will send requests to my new server.
Thanks!
I haven't understood you completely but I think I can help you a little bit and go on clarifying with comments. For example, I don't know if you have different entry points or just distribute 1->N.
Your proposal, if I didn't misunderstand, is that you have an RTMP
traffic as input of a basic redirector, and wants to send the same
content to a list of RTMP addresses placed for example in a text file.
Your question is how to implement this basic redirector, isn't it?
In that case, you could do it with FFmpeg application, in the same way streaming systems send data to multi-publishing points (CDN for distribution)
File: rtmp_output_list.txt
rtmp://001.entrypoint.your_cloud.com/live/your_name?user=your_user&pass=your_pass
rtmp://002.entrypoint.your_cloud.com/live/your_name?user=your_user&pass=your_pass
rtmp://003.entrypoint.your_cloud.com/live/another_name?user=another_user&pass=another_pass
...
Bash script calling ffmpeg: basic_redirector.sh
#!/bin/bash for RTMP_OUTPUT in `cat rtmp_output_list.txt`
RTMP_INPUT="rtmp://192.168.0.101/test"
METADATA="-metadata width=XXX -metadata height=XXX ... [rest of metadata]"
do
ffmpeg -i $RTMP_INPUT -async 1 -vcodec copy -acodec copy $METADATA -f megts -f flv $RTMP_OUTPUT
done
If I didn't understand you correctly, please, comment and I'll help you.
Good luck.
There is no such concept in RTMP. You will need the client to connect to an endpoint to query what URL to broadcast to.
Related
Hi I'm trying to realize a Tornado server with the goal to receive very big binary files (~1GB) into POST body. The following code works for small files, but does not answer if I try to send big files (~100MB).
class ReceiveLogs(tornado.web.RequestHandler):
def post(self):
file1 = self.request.body
output_file = open('./output.zip', 'wb')
output_file.write(file1)
output_file.close()
self.finish("file is uploaded")
Do you know any solutions?
I don't have a real implementation as an answer but one or two remarks that hopefully point to the right direction.
First of all there is a 100MB Upload limit which can be increased setting the
self.request.connection.set_max_body_size(size)
in the initalization of the Request handler. (taken from this answer)
The Problem is that tornado handles all file uploads in memory (and that HTTP is not a very reliable Protocol for handling large file uploads.)
This is quote from a member of the tornadoweb team from 2014 (see github issue here)
... You can adjust this limit with the max_buffer_size argument to the
HTTPServer constructor, although I don't think it would be a good idea
to set this larger than say 100MB.
Tornado does not currently support very large file uploads. Better
support is coming (#1021) and the nginx upload module is a popular
workaround in the meantime. However, I would advise against doing 1GB+
uploads in a single HTTP POST in any case, because HTTP alone does not
have good support for resuming a partially-completed upload (in
addition to the aforementioned error problem). Consider a multi-step
upload process like Dropbox's chunked_upload and commit_chunked_upload
(https://www.dropbox.com/developers/core/docs#chunked-upload)
As stated I would recommend to do one of the following:
if NGNIX is possible to handle and route requests to tornado=> look
at the NGNIX upload module (see ngnix wiki here)
If it must be a plain tornado solution use the
tornado.web.stream_request_body which came with tornado 4. This
streams the uploaded files to disk instead of trying to first get
them all in mem. (see tornado 4 release notes and this solution on stackoverflow)
I am creating a Samsung TV app for a radio station and they provide the "Now Playing" info within the Icecast stream. Is it possible to (and how do I) extract this information?
Shoutcast supports "Icy-MetaData" - an additional field in the request header. When set, its a request to the shoutcast server to embed metadata about the stream at periodic intervals(once every "icy-metaint" bytes) in the encoded audio stream itself. The value of "icy-metaint" is decided by the shoutcast server configuration and is sent to the client as part of the initial reply.
Check out this post on Shoutcast Internet Radio Protocol for details on icy:metadata and sample code in C.
A somewhat more technical discussion is also available at
http://forums.radiotoolbox.com/viewtopic.php?t=74
Yes, this is possible. The metadata is interleaved into the stream data at a specified interval. Basically, you read 8192 bytes (or whatever is specified by the Icy-MetaInt response header), and then you read the metadata block.
The first byte of that metadata block tells you the length of the data. A length of 0 means there is no updated metadata.
Once you read the meta block, then you go back to reading stream data.
I have all of this in more detail on my answer here: https://stackoverflow.com/a/4914538/362536 While I know you're not writing PHP, the principal is identical no matter what language.
From native player there is no option to get this meta.
You could probably use jQuery.stream plugin to fetch the meta directly - but you need to setup Access-Control-Allow-Origin on you icecast server - but I have no idea if it will work.
The best solution here will be to use this script:
http://code.google.com/p/icecast-now-playing-script/
So you install this script on your web server and from the SmartTV application you will AJAX it once for a while, while your stream is playing.
I just created a radio player for icecast and centova, it uses lastFM api to extract the song meta data. https://github.com/johndavedecano/Icecast-Centova-LastFM-API
If you are doing this for a radio station, then they can provide this data through the XSLT feature of Icecast. Some random old XSLT examples for offering stream metadata that I did at some point.
The other option is to run Icecast 2.4.1 or add the two files (xml2json.xsl status-json.xsl) to an old version.
Note that only Icecast 2.4.1 or newer supports adding CORS/ACAO headers that might be necessary to access data from a web app / web site.
If you are not directly cooperating with the radio station and can't ask them to do this, then disregard this answer. Someone else might find it useful though.
The application is simple, an HTML form that posts to a Perl script. The problem is we sometimes have our customers upload very large files (gt 500mb) and their internet connections can be unreliable at times.
Is there any way to resume a failed transfer like in WinSCP or is this something that can't be done without support for it in the client?
AFAIK, it must be supported by the client. Basically, the client and the server need to negotiate which parts of the file (likely defined as parts in "multipart/form-data" POST) have already been uploaded, and then the server code needs to be able to merge newly uploaded data with existing one.
The best solution is to have custom uploader code, usually implemented in Java though I think this may be possible in Flash as well. You might be even able to do this via JavaScript - see 2 sections with examples below
Here's an example of how Google did it with YouTube: http://code.google.com/apis/youtube/2.0/developers_guide_protocol_resumable_uploads.html
It uses "308 Resume Incomplete" HTTP response which sends range: bytes=0-408 header from the server to indicate what was already uploaded.
For additional ideas on the topic:
http://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal
Someone implemented this using Google Gears on calient side and PHP on server side (the latter you can easily port to Perl)
http://michaelshadle.com/2008/11/26/updates-on-the-http-file-upload-front/
http://michaelshadle.com/2008/12/03/updates-on-the-http-file-upload-front-part-2/
It's a shame that your clients can't use ftp uploading, since this already includes abilities like that. There is also "chunked transfer encoding" in HTTP. I don't know what Perl modules might support it already.
Is it possible to get Flash Media Interactive Server working in conjunction with MogileFS? What it boils down to is that I need FMIS to fetch the FLV files from MogileFS over HTTP. As far as I can tell, however, the FMIS can only fetch and stream files from a local store :/
Anyone have experience with this or other ideas?
Thanks!
You can use a psuedo streaming setup using the PHP xmoov script, then fetch the needed bytes of the files from MogileFS using PHP, and then push them to the client one chuck at the time.
I'm new with Red5. I would like to know how can I take a stream from a port (something like this rr.tt.yy.uu:1234) and publish it using Red5. I was looking the oflaDemo and the Simple Broadcaster included in Red5, but this only takes the camera and I need to take the stream. Can you help me please?, may be with an example or a guideline.
Thanks in advance
If its a flash stream you can use the RTMPClient, which is part of red5. If this is an RTSP stream or output from something like an Axis camera then you will need to consume it with something like Xuggler and probably transcode it before trying to access it with red5.
You cant publish a stream with Red5 with that kind of information i.e IP address and port number.
Useful link for trancoding with red5: Xuggler & ffmpeg
Please notice option -re (output in 'near real time' mode) must be in front of the input file, not after.
well, basically it's netStream.Publish("someName")