How to serve DASH video (MPEG-DASH and HLS) over a web sever - apache

I am doing a small research project to test DASH streaming on very low bandwidth mobile connections in India.
I have an AWS machine where I can upload video and package it for MPEG-DASH and HLS streaming and create the MPD and m3u8 files.
But I am unable to serve the video.
I have tried with Apache and node.js. I was told that by just placing the folder that contains the mpd nad m3u8 files with the video chunks I should be able to stream the video.
I am not sure what I am doing wrong. Is there any special configuration I need to do to server MPEG-DASH video ? If there a tutorial/blog/github project someone could point me towards, that would be brilliant.
TIA.

Setting up a DASH Media streaming, is fairly involved. You can get all paid services from Bitmovin, Wowza and many others but don't give up yet. There are a lot of open-source stuff out there as well that works. I have been working on DASH for a while now.
Here's my setup,
OS: Ubuntu 16.04
Server: Apache2 (easy to setup): Few edits I had to do: CORS and an alias setting.
Client: Dash.js: Literally just get the dash.js-master branch from github. Don't get stuck with the dash.js-development branch, if you don't wanna end up editing stuff.
Content Generation: ffmpeg and MP4Box
All you have to do for initial setup is make 2 directories in your apache's root directory, (i.e. inside the folder that contains index.html). Your first directory will be the compiled dash.js client and the second will be your content directory.
Point a link on your server to the dash.js reference client, then all you have to do is play your mpd on the client. (Make sure it confirms to the mpd validation norms though)
Now, this might just work only on a computer and not a cell phone, but hey I think you disable all the connections (wireless and wired) on your computer and use one of those wireless dongles provided by Airtel/Reliance/any network provider!
Shall be here to answer more insightful questions, hath need be!

You do not need any server side application. If you are using AWS a simple S3 bucket behind Cloudfront will do the trick nicely, without any EC2 needed at all. Just ensure you have CORS and crossdomain.xml in place.
Stefen Lederer posted a blog about just this set up.
Also, use your browsers developer mode to catch failed requests and console errors which might give pointers as to why it is not working for you.

Related

how to monitor image requests for a react-native app to verify if images are loaded from cache or not (using Charles)

I am trying to monitor the requests for images to verify whether the images are loaded from the ios/android cache or they are still being requested from the backend firebase storage. I am using React Native Debugger by enabling Network Inspect but can't seem to observe the requests for images (URIs) of react-native "image" components. How can I monitor the requests for images or how can I check whether the images are loaded from the cache or not?
Thanks!
According to the React Native Debugger documentation here: https://github.com/jhen0409/react-native-debugger/blob/master/docs/network-inspect-of-chrome-devtools.md
It can't inspect request like Images loaded from urls for src, so if
your Image source has a set session, the session can't apply to fetch
and XMLHttpRequest.
The same document refers to Charles & stetho for monitoring these kinds of requests.
If you want to inspect deeper network requests (like requests made
with Image), use tools like Charles or Stetho.
I installed Charles on my mac, installed the certificate on my iOS device, and enabled it using the information contained on the below links. Now I am able to monitor the requests for images.
1- https://www.charlesproxy.com/documentation/getting-started/
2- https://www.donnywals.com/debugging-network-traffic-with-charles/
3- https://www.charlesproxy.com/documentation/using-charles/ssl-certificates/
4- https://stackoverflow.com/a/49129286/1680793
(You may need to visit other linked pages on the links I listed above as needed)
Install Charles on you Mac, launch this help action as described in the documentation I listed:
Charles will guide you about how to install and trust the required certificate on your device:
Some important points:
When you install Charles on your Mac/PC, if it asks for making the
required configurations automatically, allow it.
To install the certificate on your ios device browse to
chls.pro/ssl URL using the SAFARI browser, not Chrome. Then
follow the instructions your device displays to install the
certificate. (I was especially interested in monitoring my iOS device
since android seems to cache the images by default)
If you are using firebase storage as your image store (as I do) and can't see the requests/responses being recorded by Charles, lookout for a message like this: SSL Proxying not enabled for this host. Enable in the Proxy Menu, SSL Proxying Settings
You need to enable SSL proxying for https://firebasestorage.googleapis.com. Add firebasestorage to SSL proxying configuration like so (or whatever URL you are interested in monitoring the communication with):
Charles will be recording everything going on with your mac, to
observe just the "firestore" requests from your app for your images,
use the "filter" box at the bottom of the structure tree on the left
pane (see the first image above).
Don't forget to disable your WIFI proxy after you are done with
Charles or you will not be able to connect to the internet.
Make sure you follow the documentation carefully and pay attention to my list here.
Charles is a paid tool. You can use the trial version for 30 days.
And each launch will terminate itself after 30 mins, so you will need
to restart Charles.

How to bypass red5 demo page on start up?

At present, I start up red5 in linux command line ./red5.sh and it runs the script. Then I go to http://localhost:5080 demos page to set up my camera and audio input and all works fine in testing the stream both on demo page and in swf of my webpage.
Question is, do I need to include some java and/or action script for the swf player to
bypass the red5 demo page so I can directly connect my input and stream in the code of the page? Also so only logged in webpage viewers can connect?
Overall wondering if there is a way of hiding the server stream from anyone not logged in to view it on my site? I understand in webapps folder somewhere there is the hosts list of IP but it would be impossible to know the IP of the viewers as opposed to unwanted viewers or bandwidth stealers.
I am trying to set up a site for poetry readings and make it so readers can record live to my server and then logged in viewers can view from my website. I am trying to figure out whether I must have that red5 page open and if that doesn't pose some kind of risk.
Found my own way of doing this just by removing and renaming files and folders.
If you go to usr/local/red5/webapps here lies all the directories for viewing when you go to default port 5080 so I simply installed the applications I needed and then took everything out of there except those applications I wanted and needed to run. I took out all and placed it in a folder in /var directory named it red5_movedstuff in case I want access to further applications later on.Then I renamed the applications I am using in webapps folder and kept admin folder to access them but I renamed my applications and had to importantly rename also in WEB-INF for each application name change.
Now if someone goes to myip:5080 they get a blank page and by changing names of applications I've hidden my directories beyond that including list of streams.

how to upload .flv to remote red5 server LIVE in real time?

I want to do live webcast of some ceremonies. I can record .flv files using my webcam and ffmpeg software. Now, if I hire a red5 media server from some hosting company so that visitors can download from that website. Now my problem is how can I upload .flv files LIVE ( when video shooting is still in progress )
Please help how to achieve this
I assume by recording them you mean you are saving them to disk and are not streaming the video? If this is the case you simply need to use an upload form or have ftp / scp access to the hosted server. Pick one of the apps installed and place your flv files in the applications "streams" directory. Once the files are in-place you'll need a way to play them back, which will require a player (plenty of free ones out there like jwplayer). Hopefully this is what you were looking for.

Embedding SWFs via SSL issue. (Sound, but no video on certain players)

I have a problem with embedding SWFs via SSL.
I know that the common misconception with embedding SWFs on secure pages is that people always try to embed it using a non-secure link. This isn't the case, as I am trying to host the SWF and swfobject.js locally using relative paths to account for the use of SSL.
It appears that the first of these players (under ssl) will play the audio playback, but won't display the video, while the second one will render the entire SWF fine.
Here are 2 examples that are EXTREMELY similiar. Unfortunately I can only post 2 hyperlinks, so you'll have to swap the http: protocol with https: to see how each player renders under SSL.
These 2 players are using 2 different SWF's, so I'm lead to believe it's a Flash/ActionScript issue, but I have failed to isolate it.
Example 1
Non-secure working embed
Example 2
Non-secure working embed
First, Mixed http & https are different domains that run afoul of the Adobe Flash Player's same-domain security restriction. Using a cross-domain file on the root of your server will allow access.
Second, IE has some known problems with SWF and SSL.
Third, be sure to enable https and check to ensure you have a valid root certificate.
Without more information, this is the best I can do.
The best way is to test your work using the Debug Version of Flash Player. This works best in Firefox. Chances are there is something (dependency or resource) that the player is trying to get without SSL.

Newbie question on Flash video players, products/SDKs, and API

I'm a C programmer and a total newbie to Flash/video/web world. Don't know where/how to start, and so would greatly appreciate your initial help.
Question
If I need to host flash videos off of my website (instead of embedding YouTube links on my webpages),
AND
If I need to provide player API like YouTube's that can be used, say, for supporting chromeless player versions customizable via this custom API of mine...
THEN
What do I need to do essentially...?
Write a custom Flash video player?
If yes, how? I mean, using which Adobe products / tools / SDKs / language(s)?
Is there anything free/opensource available for doing this? Especially, for Linux platform?
Write a new browser (firefox) plugin for users visiting my site?
Not sure how my custom Flash video player will get to the user visiting my site for the first time?
Any books, resources that cover this problem well?
Does the Flash content need to hosted off of a Windows server only?
Currently lost. Thanks in advance,
/SD
Flash has video playback support built-in, so all you need to do is use the Flash authoring environment or Flex to compile a .SWF file that uses the video API, with some buttons to stop and start the stream, volume, seeking, anything else you want your player to do.
Many people have already done this for you, in a way you can easily use from simple HTML. See eg. OSFLV, Flowplayer, JW...
Write a new browser (firefox) plugin for users visiting my site? Does the Flash content need to hosted off of a Windows server only?
Lord no! Flash video would never have taken off if it was just another custom-server+custom-plugin piece of unpleasantness. Though special streaming servers are possible, for the most part it's just an FLV file sitting on a web server.
(FLV is the video format supported by the Flash video playing functions. There are many, many tools you can use to convert other formats to it; I use Avidemux.)
If you are planning to use a "Progressive Download" approach, then your FLV files can be hosted on a Windows or a Linux box. Be aware that:
it is no as efficient as true
streaming.
you may not use it for live events
nor only for stored video files.
it cannot automatically detect the
end user's connection speed.
it is not possible to jump ahead to
another part while it's downloaded.
the video file will be saved on the
end user's computer.
If you are planning to use a "Streaming" approach then you can either buy and use Adobe's solution (Flash Media Server, available on both Windows and Linux box) or sign up for a hosted solution. On this page you will find recommended providers by Adobe. I personally have been using Influxis's hosting with success for a couple of years already.
You can also write your own streaming server but that would be a lot of hard work. If you are interested in that, I would recommend you have a look a Red5 which is an open source Flash Server written in Java.