Streaming audio from a Node.js server to HTML5 tag

Here’s a (slightly outdated) summary of the current status of HTML5 Audio and Icecast streams. As you can see, a MP3 source only seems to work in Safari (and possibly IE9). You might need to experiment with some server-side transcoding (with ffmpeg or mencoder) to OGG Vorbis. I’m pretty sure I was able to get … Read more

How to minimize the delay in a live streaming with ffmpeg

I found three commands that helped me reduce the delay of live streams. The first command its very basic and straight forward, the second one it’s been combined with other options which might work differently on each environment and the last command it is a hacky version that I found in the documentation It was … Read more

Streaming large file uploads to ASP.NET MVC

It turns out that my initial code was basically correct; the only change required was to change request.ContentLength = clientRequest.InputStream.Length; to request.ContentLength = clientRequest.ContentLength; The former streams in the entire request to determine the content length; the latter merely checks the Content-Length header, which only requires that the headers have been sent in full. This … Read more

Download image from the site in .NET/C#

There is no need to involve any image classes, you can simply call WebClient.DownloadFile: string localFilename = @”c:\localpath\tofile.jpg”; using(WebClient client = new WebClient()) { client.DownloadFile(“http://www.example.com/image.jpg”, localFilename); } Update Since you will want to check whether the file exists and download the file if it does, it’s better to do this within the same request. So … Read more

Is there a streaming API for JSON? [closed]

Some JSON parsers do offer incremental (“streaming”) parser; for Java, at least following parsers from json.org page offer such an interface: Jackson (pull interface) Json-simple (SAX-style push interface) (in addition to Software Monkey’s parser referred to by another answer) Actually, it is kind of odd that so many JSON parsers do NOT offer this simple … Read more

How to send image generated by PIL to browser?

Here’s a version without any temp files and the like (see here): def serve_pil_image(pil_img): img_io = StringIO() pil_img.save(img_io, ‘JPEG’, quality=70) img_io.seek(0) return send_file(img_io, mimetype=”image/jpeg”) To use in your code simply do @app.route(‘some/route/’) def serve_img(): img = Image.new(‘RGB’, …) return serve_pil_image(img)

Playing m3u8 Files with HTML Video Tag

Might be a little late with the answer but you need to supply the MIME type attribute in the video tag: type=”application/x-mpegURL”. The video tag I use for a 16:9 stream looks like this. <video width=”352″ height=”198″ controls> <source src=”https://stackoverflow.com/questions/19782389/playlist.m3u8″ type=”application/x-mpegURL”> </video>