Tips and Tricks

How can I download a FB video to my computer 



download facebook videos with direct link here: 
www.video-fb.com
                                                                                                                                                                   

How do I prevent Netbeans from not being able to start Tomcat because the port is already used?


Starting of Tomcat failed, the server port 8084 is already in use.

ANS:

Use a different port for the Tomcat. You can easily change the port number in net-beans by simply moving on to servers>tomcat and right click .. properties. and change the port to say 8083 etc...

                                                                                                                                                                   

Broadcast audio with Icecast2


1. Install Icecast2 Install icecast2


2. Edit Icecast2 configuration

Open the file /etc/icecast2/icecast.xml as root in an editor. For security reasons you should setup passwords in the <authentication> section:
<admin-user>admin</admin-user>
<admin-password>hackme</admin-password> 
If you changed the <source-password> or <relay-password> you need to do so on the source or relay side as well. That means leave it default or change it in the ices2.xml file (see below) as well. The same will need to be done in the Ices or Darkice configuration files.
You also need to define the hostname where your stream can be reached:
<hostname>localhost</hostname>
Leave it as localhost (no need to give a resolved IP there) when you only want to stream in your local network. The default port to listen to is 8000. Change it only when needed.

3. Edit defaults

Open the /etc/default/icecast2 file as root in an editor. The last line needs to be changed to
ENABLE=true
That's all for Icecast2. Of course there are many more settings you can play with. In the configurations files there are explanatory notes on parameters.

4. Start/Stop Icecast

The server is started and stopped by the following commands:
/etc/init.d/icecast2 start
/etc/init.d/icecast2 stop
While running the Icecast server can be administrated from any browser at http://localhost:8000/admin/ after entering your administrator credentials defined in step 1. Further documentation is available from Icecast.org.
Stream2ip is a graphical frontend to quickly start and stop streams where a basic setup for Ices2, Ices or Darkice has already been done.

Ices2 Install ices2 for streaming OGG Vorbis audio from a local soundcard

To set up of pulseaudio to enable recording from the soundcard see note for Darkice below.

Make directories for Ices2

mkdir /var/log/ices   # in case you need logfiles.  
mkdir /etc/ices2      # for putting ices stuff in.  

Edit the Ices2 configuration .xml

Ices2 will run using an .xml file for settings. Verbous examples of configurations can be found in /usr/share/doc/ices2/examples/. These files need to be edited to meet your needs and can be copied anywhere, best in your home directory. Depending on the configuration file Ices2 uses a playlist in Ogg Vorbis format (ices-playlist.xml) or the output from your soundcard (ices-alsa.xml) as streaming source for Icecast2.
In the section <input> you may need to replace the device if you have setup your sound system to PulseAudio. To do this edit the corresponding line to:
<param name="device">pulse</param>
The name of the stream for the receiving client is defined in the following section.
<mount>/example1.ogg</mount>

Start Streaming

Streams from your soundcard will be started by first running the Icecast2 server, and then running Ices2 using the following commands:
/etc/init.d/icecast2 start
ices2 /home/user/somewhere/ices-pulse.xml # or any other name from .xml file

Setup Receiver

On the receiver side your radio "station" tunes on: <serverIP>:8000/example1.ogg where <serverIP> is the IP of your streaming server followed by the port you defined in the icecast.xml file (default 8000).

Terminate Streaming

Streams are terminated by killing Ices2 and/or stop running the Icecast2 server:
killall ices2
/etc/init.d/icecast2 stop

Ices for broadcasting mp3 playlists

Broadcasting a playlist containing mp3 files can not be done with Ices2. We need to install IceS, which is also available from the Medibuntu repository.
After having set up the configuration file with server address, password and streaming properties (well documented example will be found in /usr/share/doc/ices/examples) we can stream mp3 audio files from playlists (e.g. in .m3u format) over an Icecast2 server by:
/etc/init.d/icecast2 start
ices -c <path_to_config_file> -F <path_to_playlist>
For further options read the documentation in the quite elaborate man page from man ices.

Darkice Install darkice for live streaming

We can stream the output of the local sound card as OGG Vorbis or as mp3 stream using Darkice. To enable streaming of the local soundcard we may need to define the recording device for Darkice in pulseaudio first. This can be done with pavucontrol Install pavucontrol. In the Recording tab choose Monitor of <your soundcard> for the "ALSA plug-in [darkice]".
The configuration file (well documented example given in /usr/share/doc/darkice/examples) needs to be adapted to the Icecast server and the local sound environment:
[general]
duration        = 0      # duration in s, 0 forever
bufferSecs      = 1      # buffer, in seconds
reconnect       = yes    # reconnect if disconnected

[input]
device          = default # or `pulse' for Pulseaudio
sampleRate      = 44100   # sample rate 11025, 22050 or 44100
bitsPerSample   = 16      # bits
channel         = 2       # 2 = stereo

[icecast2-0]
bitrateMode     = vbr       # variable bit rate (`cbr' constant, `abr' average)
quality         = 1.0       # 1.0 is best quality
format          = mp3       # format. Choose `vorbis' for OGG Vorbis
bitrate         = 256       # bitrate
server          = localhost # or IP
port            = 8000      # port for IceCast2 access
password        = hackme    # source password to the IceCast2 server
mountPoint      = mystream.mp3  # mount point on the IceCast2 server .mp3 or .ogg
name            = mystream
After saving this configuration (e.g. in ~/music/darkice.cfg) we first run the Icecast server and are then able to stream pulseaudio output from the local sound card by invoking:
/etc/init.d/icecast2 start
darkice -c ~/music/darkice.cfg
On the receiver we tune to http://<localhost>:8000/mystream.mp3 for listening. <localhost> is the IP of the Icecast server.

Courtesy:  http://askubuntu.com/questions/28496/how-do-i-setup-an-icecast-server-for-broadcasting-audio-in-my-network.
references:https://www.howtoforge.com/linux_webradio_with_icecast2_ices2
                                                                                                                                                                        


Create your own video streaming server with Linux

Set up a basic live streaming server on a Linux or BSD operating system.




Live video streaming is incredibly popular—and it's still growing. Platforms like Amazon's Twitch and Google's YouTube boast millions of users that stream and consume countless hours of live and recorded media. These services are often free to use but require you to have an account and generally hold your content behind advertisements. Some people don't need their videos to be available to the masses or just want more control over their content. Thankfully, with the power of open source software, anyone can set up a live streaming server.

Getting started

In this tutorial, I'll explain how to set up a basic live streaming server with a Linux or BSD operating system.
This leads to the inevitable question of system requirements. These can vary, as there are a lot of variables involved with live streaming, such as:
  • Stream quality: Do you want to stream in high definition or will standard definition fit your needs?
  • Viewership: How many viewers are you expecting for your videos?
  • Storage: Do you plan on keeping saved copies of your video stream?
  • Access: Will your stream be private or open to the world?


There are no set rules when it comes to system requirements, so I recommend you experiment and find what works best for your needs. I installed my server on a virtual machine with 4GB RAM, a 20GB hard drive, and a single Intel i7 processor core.

This project uses the Real-Time Messaging Protocol (RTMP) to handle audio and video streaming. There are other protocols available, but I chose RTMP because it has broad support. As open standards like WebRTC become more compatible, I would recommend that route.







It's also very important to know that "live" doesn't always mean instant. A video stream must be encoded, transferred, buffered, and displayed, which often adds delays. The delay can be shortened or lengthened depending on the type of stream you're creating and its attributes.

Setting up a Linux server

You can use many different distributions of Linux, but I prefer Ubuntu, so I downloaded the Ubuntu Server edition for my operating system. If you prefer your server to have a graphical user interface (GUI), feel free to use Ubuntu Desktop or one of its many flavors. Then, I fired up the Ubuntu installer on my computer or virtual machine and chose the settings that best matched my environment. Below are the steps I took.
Note: Because this is a server, you'll probably want to set some static network settings.
After the installer finishes and your system reboots, you'll be greeted with a lovely new Ubuntu system. As with any newly installed operating system, install any updates that are available:
sudo apt update sudo apt upgrade
This streaming server will use the very powerful and versatile Nginx web server, so you'll need to install it:
sudo apt install nginx
Then you'll need to get the RTMP module so Nginx can handle your media stream:
sudo add-apt-repository universe sudo apt install libnginx-mod-rtmp
Adjust your web server's configuration so it can accept and deliver your media stream.
sudo nano /etc/nginx/nginx.conf
Scroll to the bottom of the configuration file and add the following code:
rtmp {         server {                 listen 1935;                 chunk_size 4096;                 application live {                         live on;                         record off;                 }         } }
Save the config. Because I'm a heretic, I use Nano for editing configuration files. In Nano, you can save your config by pressing Ctrl+X, Y, and then Enter.
This is a very minimal config that will create a working streaming server. You'll add to this config later, but this is a great starting point.
However, before you can begin your first stream, you'll need to restart Nginx with its new configuration:
sudo systemctl restart nginx

Setting up a BSD server

If you're of the "beastie" persuasion, getting a streaming server up and running is also devilishly easy.
Head on over to the FreeBSD website and download the latest release. Fire up the FreeBSD installer on your computer or virtual machine and go through the initial steps and choose settings that best match your environment. Since this is a server, you'll likely want to set some static network settings.
After the installer finishes and your system reboots, you should have a shiny new FreeBSD system. Like any other freshly installed system, you'll likely want to get everything updated (from this step forward, make sure you're logged in as root):
pkg update pkg upgrade
I install Nano for editing configuration files:
pkg install nano
This streaming server will use the very powerful and versatile Nginx web server. You can build Nginx using the excellent ports system that FreeBSD boasts.
First, update your ports tree:
portsnap fetch portsnap extract
Browse to the Nginx ports directory:
cd /usr/ports/www/nginx
And begin building Nginx by running:
make install
You'll see a screen asking what modules to include in your Nginx build. For this project, you'll need to add the RTMP module. Scroll down until the RTMP module is selected and press Space. Then Press Enter to proceed with the rest of the build and installation.
Once Nginx has finished installing, it's time to configure it for streaming purposes.
First, add an entry into /etc/rc.conf to ensure the Nginx server starts when your system boots:
nano /etc/rc.conf
Add this text to the file:
nginx_enable="YES"
Next, create a webroot directory from where Nginx will serve its content. I call mine stream:
cd /usr/local/www/ mkdir stream chmod -R 755 stream/
Now that you have created your stream directory, configure Nginx by editing its configuration file:
nano /usr/local/etc/nginx/nginx.conf
Load your streaming modules at the top of the file:
load_module /usr/local/libexec/nginx/ngx_stream_module.so; load_module /usr/local/libexec/nginx/ngx_rtmp_module.so;
Under the Server section, change the webroot location to match the one you created earlier:
Location / { root /usr/local/www/stream }
And finally, add your RTMP settings so Nginx will know how to handle your media streams:
rtmp {         server {                 listen 1935;                 chunk_size 4096;                 application live {                         live on;                         record off;                 }         } }
Save the config. In Nano, you can do this by pressing Ctrl+X, Y, and then Enter.
As you can see, this is a very minimal config that will create a working streaming server. Later, you'll add to this config, but this will provide you with a great starting point.
However, before you can begin your first stream, you'll need to restart Nginx with its new config:
service nginx restart

Set up your streaming software

Broadcasting with OBS

Now that your server is ready to accept your video streams, it's time to set up your streaming software. This tutorial uses the powerful and open source Open Broadcast Studio (OBS).
Head over to the OBS website and find the build for your operating system and install it. Once OBS launches, you should see a first-time-run wizard that will help you configure OBS with the settings that best fit your hardware.
OBS isn't capturing anything because you haven't supplied it with a source. For this tutorial, you'll just capture your desktop for the stream. Simply click the + button under Source, choose Screen Capture, and select which desktop you want to capture.
Click OK, and you should see OBS mirroring your desktop.
Now it's time to send your newly configured video stream to your server. In OBS, click File > Settings. Click on the Stream section, and set Stream Type to Custom Streaming Server.
In the URL box, enter the prefix rtmp:// followed the IP address of your streaming server followed by /live. For example, rtmp://IP-ADDRESS/live.
Next, you'll probably want to enter a Stream key—a special identifier required to view your stream. Enter whatever key you want (and can remember) in the Stream key box.
Click Apply and then OK.
Now that OBS is configured to send your stream to your server, you can start your first stream. Click Start Streaming.
If everything worked, you should see the button change to Stop Streaming and some bandwidth metrics will appear at the bottom of OBS.
If you receive an error, double-check Stream Settings in OBS for misspellings. If everything looks good, there could be another issue preventing it from working.

Viewing your stream

A live video isn't much good if no one is watching it, so be your first viewer!
There are a multitude of open source media players that support RTMP, but the most well-known is probably VLC media player.
After you install and launch VLC, open your stream by clicking on Media > Open Network Stream. Enter the path to your stream, adding the Stream Key you set up in OBS, then click Play. For example, rtmp://IP-ADDRESS/live/SECRET-KEY.
You should now be viewing your very own live video stream!

Where to go next?

This is a very simple setup that will get you off the ground. Here are two other features you likely will want to use.
  • Limit access: The next step you might want to take is to limit access to your server, as the default setup allows anyone to stream to and from the server. There are a variety of ways to set this up, such as an operating system firewall, .htaccess file, or even using the built-in access controls in the STMP module.
  • Record streams: This simple Nginx configuration will only stream and won't save your videos, but this is easy to add. In the Nginx config, under the RTMP section, set up the recording options and the location where you want to save your videos. Make sure the path you set exists and Nginx is able to write to it.
application live {              live on;              record all;              record_path /var/www/html/recordings;              record_unique on; }
The world of live streaming is constantly evolving, and if you're interested in more advanced uses, there are lots of other great resources you can find floating around the internet. Good luck and happy streaming!


Courtesy:https://opensource.com/article/19/1/basic-live-video-streaming-server

Comments

Popular posts from this blog