Streaming an IP Camera to a Web Browser using FFmpeg

In this video I stream an IP Camera to a web browser using ffmpeg. The video is served using nginx web browser set up on Ubuntu linux.

Amcrest IP Cameras: https://amzn.to/2FPzuXv (Amazon affiliate)

hls.js site:https://github.com/video-dev/hls.js/blob/master/docs/API.md

shell.sh
#!/bin/bash
VIDSOURCE="rtsp://username:password@ip-address-of-camera:554/cam/realmonitor?channel=1&subtype=0"
AUDIO_OPTS="-c:a aac -b:a 160000 -ac 2"
VIDEO_OPTS="-s 854x480 -c:v libx264 -b:v 800000"
OUTPUT_HLS="-hls_time 10 -hls_list_size 10 -start_number 1"
ffmpeg -i "$VIDSOURCE" -y $AUDIO_OPTS $VIDEO_OPTS $OUTPUT_HLS mystream.m3u8
index.html
<!DOCTYPE html>
<html><head><title>Live Cam</title></head>

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>

<body>
<!-- Use this if you only support Safari!!
    <div id="player">
        <video id="video" autoplay="true" controls="controls">
            <source src="http://ip-address-of-web-server/live/mystream.m3u8" />
            Your browser does not support HTML5 streaming!
        </video>
    </div>
-->
<video id="video" autoplay="true" controls="controls"></video>
  <script>
    if (Hls.isSupported()) {
      var video = document.getElementById('video');
      var hls = new Hls();
      // bind them together
      hls.attachMedia(video);
      hls.on(Hls.Events.MEDIA_ATTACHED, function () {
        console.log("video and hls.js are now bound together !");
        hls.loadSource("http://<ip-address-of-web-server>/live/mystream.m3u8");
        hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
          console.log("manifest loaded, found " + data.levels.length + " quality level");
        });
      });
    }
  </script>

</body>
</html>

Two Ways to do Text to Speech on a Mac

Speak Text
say "This is a test"
Speak Text in the Clipboard
pbpaste | say
Speak Text in the Clipboard using Voice “Samantha”
pbpaste | say -v Samantha
List All Voices
say -v ?
Highlight Text while Speaking
pbpaste | say -v Samantha -i
Slow Down Speech Rate
say -i -r 60 "This is a text"
Speed Up Speech Rate
say -i -r 360 "This is a text"
Speak Text in File
say -i -r 360 -f Declaration.txt
Save Spoken Audio to File
say -r 360 -f Declaration.txt -o declaration.aiff

The Basics of Using Command Line Compression Utilities (gzip, bzip2, xz and 7zip)

In this video I go over the basics of using command line compression utilities like gzip, bzip2, xz and 7zip. I use these on a Mac but they are also standand on most Linux distributions.

Installing Macports: https://youtu.be/N22Ic6ZRPXI

List Files
ls -lh
View Gzip Help
gzip -h
Compress tar Archive with Gzip
gzip -9 data.tar
Uncompress tar Archive with Gzip
gzip -d data.tar
Compress tar Archive with Gzip (keep original file)
gzip -9c data.tar > data.tar.gz
Compress tar Archive using 7zip
7z a data.tar.7z data.tar

The Basics of using the Command Line tar Utility

In this video I go over the basics of using the tar (tape archive) utility on a Mac. This utility is also standard on most Linux distributions.

List Files in Directory
ls -lh
List Files Recursively
ls -R
Create tar Archive
tar -cvf data.tar data
Create tar Archive and gzip
tar -cvzf data.tar.gz data
Create tar Archive and bzip
tar -cvjf data.tar.bz2 data
Extract from tar Archive
tar -xvf data.tar