Blog

Do you have a large collection of physical or digital media you wish was smaller and more portable in size, while still keeping viewing quality?  Try Handbrake!

HandBrake is a tool for converting video from nearly any format to a selection of modern, widely supported codecs.

Reasons you’ll love HandBrake:

  • Convert video from nearly any format
  • Free and Open Source
  • Multi-Platform (Windows, Mac and Linux)

Official Site: https://handbrake.fr/

Handbrake is a way to convert/re-encode the dvd/bluray files/structure from a physical disc or a file to another smaller file - at the cost of some time, and quality (usually not noticeable)

Note: Handbrake does not decrypt encrypted dvd/bluray discs

Some video encoding background:

What is video encoding?

Video encoding is the process of converting digital video files from one format to another. Encoding is also known as “transcoding” or “video conversion.” At the time of recording, the device gives the video file a particular format and other specifications. If the video owner wants to publish the video, s/he must consider the various devices on which the video might play. All of the videos we watch on our computers, tablets, and mobile phones have gone through an encoding process that converts the original source video so that it is viewable on various output formats. This is because many device and browser types only support specific video formats. Often, the goal of the video publisher is to ensure compatibility with a variety of common formats.

Source: help.ecoding.com

The basics of compression and quality is, pick 2 (maybe just 1)

  • Encodes fast
    • The faster the encode, usually the less quality and larger file size
  • High quality
    • The higher the quality, usually the longer the encode and the large the file size
  • Smallest file size possible
    • The smaller the file, usually the longer the encode and less quality (relatively)

File sizes:

dvds are about 3gb to 5gb

blurays are about 15gb to 40gb .. depending on the movie, audio, etc

Encoding can usually reduce the files sizes to less than half while maintaining a decent quality.

Note: There is no such thing as a smaller file but the same quality!  See above and pick one.

Suggested Handbrake Configuration:

After installing and launching, Handbrake is ready to encode your videos.

But first, let’s configure it for a perhaps more optimal experience, and learn a little more about the software

Click Preferences

General Preferences

  • You can leave Check for Updates enabled, if you wish
  • Check Always clear completed queue items after an encode completes
    • This is like auto removing your todo encodes
  • Check Show the encode status in the application title bar, if you wish
  • Check Reset to ‘Do nothing’ when the app is re-launched
    • You can set actions when your video is done encoding, such as shutdown
  • You can also enable sounds on completion

Output Files Preferences

  • Handbrake can auto name your encoded files to simplify some file management.
  • To have the output file be the same as the input, change the File Format to {source}
  • Also you can set your default destination, which will save you some clicking for each encode.

Video Preferences

  • Encoding
    • You can encode video files using your video card, if supported
      • Generally, video cards will encode files faster than cpus, but the quality will be slightly less and the file size will be slightly larger
    • You can also encode video files using your cpu
      • Generally, cpus will encode files in higher quality and smaller file sizes
      • If you have a 6 core or 8 core cpu, cpu encoding time could be  comparable to encoding using a video card
    • Recommendation is to uncheck all video card options thus encode files using your cpu, but of course, try both and see which you prefer.
  • Decoding
    • Decoding options enable hardware support for specific devices, such as a specific cpu or video card; If you play back a encoded video on a unsupported device, the quality and performance may be less.
    • Recommendation is to uncheck all decoding options

Advance Preferences

  • Raise the Priority Level of the Handbrake process to Above Normal.  Video encoding is an intensive process and you should not use your pc for other tasks at the same time; but of course you can, but encoding will take longer.

Summary

  • After loading a file or disc, you can the adjust the encoding options
  • While all these options can be saved to a preset, I will go through the important ones first
  • Format
    • Choose the file extension; mkv and mp4 are file containers for the video and audio streams
    • mp4 is supported by more devices (often older hardware players), but allows only one subtitle
    • mkv allows unlimited audio, subtitles, is easily editable - preferred extension

Dimensions

  • Width and Height will default to the width and height of your file.  You can reduce the width/height if you are trying to achieve a small file size.  Keeping the same width/height is preferred for video archive and for optimal quality.
  • Cropping - Handbrake can auto crop top/bottom and left/right black bars, so the video will appear to fill more of the screen on playback.  Note however, that some movies will play subtitles, or foreign languages, or other information in the black bars. So it is safer to just leave the video size as is.  Choose custom and enter 0 for all dimensions.

Filters

  • Filters allow you to maybe enhance the quality of a poor quality video, such as a video from vhs, or an old camcorder, or a bad internet stream.  But often, if your source is a dvd/bluray, you will want to turn off all filters and just take the video as is.

Video (lots of options here)

Video Codec

  • x264 has been around for a while and is optimized for video archival to produce a good balance of file size and quality.  Choose x264
  • x265 is relatively newer, and is optimized to stream video at a decent quality for a small bandwidth (file size).  At some point, x265 may also be good for video archival.
  • The other codecs are older or less popular, but may be required depending on the device you need to playback the videos.  Your playback device (pc, tv streamer, phone, etc) needs to support the video codec you are using. While you can try searching the internet for your devices supported codecs, it’s usually easier to just encode a video file and try.  x264 has wide support on new and old devices while x265 has wide support on ‘newer’ devices (last few years)

Quality (everyone wants it!)

  • Constant Quality - Handbrake will try to keep a relatively constant quality throughout the video.  Simple scenes with little movement or variation will have a lower bitrate, but still look good since little is happening, while fast moving scenes or lots of variation will have a higher bitrate, averaging out to a optimal file size for a given quality.
    • Choose a Quality Rate Factor (RF) of 20
    • For testing other settings, such as subtitles or audio, choosing a much higher RF such as 40 will result in a blocky video, but it will encode much faster.
  • Average Bitrate - uses a fixed bitrate, independent of the scene, resulting in a larger file size for a relative quality.  Some older devices may require a fixed bitrate.

Handbrake documentation
https://handbrake.fr/docs/en/latest/workflow/adjust-quality.html

Recommended settings for x264 and x265 encoders:

  • RF 18-22 for 480p/576p Standard Definition1
  • RF 19-23 for 720p High Definition2
  • RF 20-24 for 1080p Full High Definition3
  • RF 22-28 for 2160p 4K Ultra High Definition4

Raising quality minus 1-2 RF may produce better results when encoding animated Sources (anime, cartoons). Lower quality settings may be used to produce smaller files. Drastically lower settings may show significant loss of detail.

Using higher than recommended quality settings can lead to extremely large files that may not be compatible with your devices. When in doubt, stick to the recommended range or use the default setting for the Preset you selected.

Framerate (FPS)

  • The framerate the encoded video will playback on.  Unless your playback device has a specific requirement, choose Same as source

Encoder Preset

  • Determines how much time Handbrake spends analyzing a scene to optimize quality and size.
  • Choose Slow, for a good compromise of time and quality
  • Choose Faster if just testing subtitles or audio tracks

Encoder Profile and Level

  • Choose the highest values for video archivals; Only choose lower values if your playback device requires it
  • Encoder Profile - Choose High
  • Encode Level - Choose 5.2 (or highest number)

Audio

  • You can add or remove multiple audio tracks that your source video file contains.
  • Choose Auto Passthru to keep the audio quality
    • You can choose other encodings to save space and the cost of quality

Audio Defaults

  • You can set defaults for all new video files (Click Selection Behavior)
  • Select the languages you want
  • Select the audio codes you want
    • AC3 is the most common and widely supported
    • HD often increases the file size and requires supporting hardware for playback

Subtitles (understand what they are saying!)

  • You can add or remove multiple subtitles that your source video file contains
    • Even if you do not like viewing subtitles yourself, they are still useful if you are trying to figure out what an actor is trying to say! Add all subtitles for you language.
  • Some video files or discs will have foreign subtitles as a special track which Handbrake can try to find

Subtitle Defaults

  • You can set defaults for all new video files  (Click Selection Behavior)
  • Select the languages you want
  • Subtitles can be turned on or off by most video players.
  • Burning in subtitles means the subtitle is part of the video and always plays.
  • If you use mkv, you do not have to burn in subtitles
  • If you use mp4, you can have only one subtitle

Add to Queue

  • Handbrake has a queue system, which allows you to configure multiple video encodes and then let them encode automatically one after another, such as overnight, or while you do other things.
  • Click Add to Queue when you are done configuring your encoding options

View Queue

  • When you are ready to process the queue, click Queue
  • You can mouse over a queued video to see a summary
  • You can choose an action to perform when the queue is finished, such as Suspend

Presets

  • Presets allow you to apply your encoding configuration for the current video to all new videos
  • Click Presets to show the preset bar
  • Click Add to create a preset, or Options Update Preset to update a selected preset
    • Enter a name
    • Dimensions - select Always use Source, unless you are targeting a specific size
    • Audio and Subtitles will use your defaults if you’ve set them up, else do so now

Note: In the past, Handbrake presets were a little flakey when it came to editing or viewing; it took some trial and error.  But with version 1.2.0 and on, presets seem to be more stable.

Note: While you can export presets, choose Options, presets from one version may not work with the next version, so it may be good to take a screenshot of the important options, or write them down.

Sally forth and encode!

Well, that’s a good overview of Handbrake’s configuration and you now have a good start on encoding your video files. But before encoding the world, it would be smart to encode one or two videos with different settings to get a feel of the end results. Then Sally forth and encode!

For more information, reference the official docs at
https://handbrake.fr/docs/en/latest/

Other related software which may be useful:

  • videolan- play any movie (aka vlc)
  • kodi- nice graphical interface to play movies
  • tinymediamanager- download poster,fanart,movie.nfo for library; video library browser
  • emdb- video library browser
  • mkvtoolnix- edit mkv file headers ie turn off/on subtitles, change audio labels/order/default, etc
  • filebot- rename copied/archived files (good for tv series)
  • aren- advanced file renamer
  • mediainfo lite - video file info
  • avidemux- edit video/audio
  • http://thetvdb.com/- movie/tv info/posters

-End of Document-
Thanks for reading

While ngrok can be used to expose your local development application to the internet for testing, 
the free version of ngrok does not support End-to-End TLS Tunnels aka https, but it does support forwarding of https to http

Note: Transport Layer Security (TLS) is the successor to SSL. TLS 1.0 was defined in RFC 2246 in January 1999.  Hypertext Transfer Protocol Secure (HTTPS), or “HTTP Secure,” is an application-specific implementation that is a combination of the Hypertext Transfer Protocol (HTTP) with the SSL/TLS.
reference: is-it-ssl-tls-or-https

For Single Sing On solutions, such as SAML, you application is required to be hosted over https

You might think you could just bind to the ssl port 443

> ngrok http myawesomeapp.local:443

Session Status                online
Session Expires               7 hours, 4 minutes
Version                       2.2.8
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://8316dcb8.ngrok.io -> myawesomeapp.local:443
Forwarding                    https://8316dcb8.ngrok.io -> myawesomeapp.local:443 

But, accessing https://8316dcb8.ngrok.io or http://8316dcb8.ngrok.io results in the browser showing

Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.

So that is why you need the paid version of ngrok for End-to-End TLS Tunnels.

One solution is to pay for the Pro version of ngrok, which also gets you access to more features such as Whitelabel domains, Reserved TCP addresses, End-to-End TLS Tunnels, and more resources.

However, if your using PHP Symfony or the PHP OneLogin SAML library,
another solution is to modify your application to indicate that the request is actually https.

Start up ngrok

> ngrok http myawesomeapp.local:80

Session Status                online
Session Expires               7 hours, 4 minutes
Version                       2.2.8
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://8316dcb8.ngrok.io -> myawesomeapp.local:80
Forwarding                    https://8316dcb8.ngrok.io -> myawesomeapp.local:80  

If you view https://8316dcb8.ngrok.io, you will see your app, but you app will think its running on port 80 and http

Note: While this is PHP focused, the concept should apply to other applications.

To make your app think it's on https, in the bootstrap or initialization of your application, add:

// If the host url has ngrok.io, and the header X-Forwarded-Proto set by ngrok is https, then also set https on and the port to 443

if (strpos($_SERVER['HTTP_HOST'], 'ngrok.io') !== false && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')

{

  $_SERVER['HTTPS'] = 'on';

  $_SERVER['SERVER_PORT'] = 443;

}

Note: For Symfony, you can place this code within the boostrap app_dev.php, above the creation of $request

> vi app_dev.php

// place here

$request = Request::createFromGlobals();
$response = $kernel->handle($request);

This will allow any following code which checks for https 

such as OneLogins Utils::isHTTPS()
or Symfony Request->isSecure()

to return true when accessing the ngrok url over https

Note: This does not test or affect your applications ssl certs, as the browser thinks the request is from 8316dcb8.ngrok.io,  And if you are using ngrok daily for development or testing, it is fairly inexpensive to upgrade to the tls version which is a  simpler and better solution

Hopefully this helps you test Single Sing On solutions, such as SAML.

-End of Document-
Thanks for reading

streamWriter is a free application for windows that plays and records music broadcasted by internet radio stations.  The internet radio stations listed in streamWriter may stream songs you know, definitely songs you don’t know, or interesting re-mixes of your favorites.  The internet radio stations are free in the sense that FM/AM is free.

Note some radio stations may contain commercials, or be in other languages than your own.

streamWriter features

  • Record as many streams as you want at the same time (MP3/AAC)
  • Automatically record a wishlist's song when it's playing on a stream
  • Player for streams and recorded files
  • Track splitting with silence detection
  • Function for manual cutting of saved titles
  • Tracks are named by a given pattern
  • Short songs (ads) can be skipped
  • Writing of tags to recorded files
  • Script-based postprocessing
  • Applying of effects to recorded songs (SoX)
  • Integration of different audio encoders
  • Scheduled recordings
  • Stream browser
  • Multilingual
  • Can be installed or used in portable mode
  • ...and much more!

streamWriter  Website Help Donate


This post will cover the installation, recommended settings, and general usage of streamWriter.

Installation

1) Downloading and installing the executable or portable version

Run streamWriter
You will be greeted with some info and a settings wizard.  
You can change all settings later.


2) About, License, Thank you dialog


It’s unusual but kinda nice that you see the about dialog first.
Click Close


3) Choose your language


Click Next


4) Save settings location


Choose either option.  
The second option to Save data to application path is recommended to make the app portable.
Click Next


5) Choose to search for updates


Leave enabled is fine.
You will have to download and install new versions, which is safer than auto upgrades.
Click Next


6) Select recording folder


Choose the folder (directory) where you want streamed recordings to be saved.  
The default under Music is fine.
Click Next


7) Some miscellaneous settings


The defaults are fine.
Click Finish


8) Introduction


Some nice info, but you will probably forget all the words,
so continue on for more screenshots and info
Click Close


9) You now see the full app


Choose a radio stream

1) Filter your desired music by

  • Genre - Categorizes the type of music i.e. Country, Rock, etc.  
There are lots of Genres, and many overlap.
It’s more of a guideline than a rule.  

So some trial and error will be required to find what you like.

  • Kbps - Determines the quality of the songs being streamed. The higher the better quality, and bigger file size. Note, some music players may not play mp3s with high Kbps (also known as Bitrate).

Choose >= 192 should be a good mix of quality, size, and compatibility

  • Type - The file format of the radio stream.  

Choose MP3 for greater compatibility.


2) Choose a radio stream


Double click on a radio stream, listed on the bottom right side.  
The radio stream will start.  
By default, you will not hear anything as the radio stream will only record.


3) Listen to the radio stream

Click the Play button to listen while recording.


Recommended Settings

1) Go to settings...

Click File -> Settings..


2) General Settings

Enable

  • Remember streams that were recording on exit
  • Remember stream that was playing on exit

So when you restart the app, it continues playing the same radio stream.


3) Recordings

Enable

  • Only save whole songs
  • Remove saved titles from wishlist (you can add songs to wishlists, ignore lists)
  • Overwrite existing file if newer file is larger
  • Discard new file if existing one is larger

The last two options should increase the odds of recording a better quality song


4) Filenames

You can change the location where songs are recorded too ie saved too
For greater organization, change the Patterns for filenames of recorded tracks to include the artist as a folder

  • Original:
    • %streamname%\%artist% - %title%
  • Recommend folders by artist:
    • %streamname%\%artist%\%artist% - %title%

The defaults on Filenames Advanced and Cut songs are fine.

Note some radio streams do have commercials, of course.  
The defaults on Filenames Advanced and Cut songs seem to be ok, but you can always try changing them if needed.


5) Addons

Click and download the addons for

  • Support encoding of MP3 using LAME (an encoder)
  • Support reading/writing of tags using AudioGenie (a tag writer)

Writing tags to your MP3s allows audio players to display more information about the song, such as Artist, Title, Album, if known.


6) Postprocessing


Post processing is what happens to the song recording after being saved to a file.

  • Select MP3 as the format to convert recorded files to,

Which ensures you are only dealing with MP3s, for greater compatibility with audio players.

  • Enabled Write tags to recorded songs.

Writing tags to your MP3s allows audio players to display more information about the song, such as Artist, Title, Album, if known.

Note that these settings will only apply to new radio streams.  So you will want to remove any of your current radio streams and re-add them.  Or choose and set the same settings by right clicking on the radio stream and selecting Settings..

The defaults on the rest of the Settings: Bandwidth, Community, Hotkeys, Advanced, and General are fine.


Manage radio stream

1) While a radio stream is in the play list, and selected, you can use the toolbar button, or right click and apply some options.


If there is a song currently playing which you really do not like,  

  • Choose Add title to global ignorelist and you will not hear it again.

Each stream can have it’s own recording settings, under Settings..


2) Saved songs

Provides a basic music player.

You may find the music player foobar or the video/audio player videolan useful, but the default windows player is fine too.


3) Title search

Searching for a know title can help you find a radio stream you may like.

You can also right click and add the title or artist to your wish list.


4) Play or Record or Both or Neither




Well, that’s it.
Hopefully you a good start on listening and recording internet radio streams.

streamWriter  Website Help Donate

-End of Document-
Thanks for reading

ngrok provides introspected tunnels to localhost.
ngrok is a reverse proxy that creates a secure tunnel from a public endpoint to a locally running web service.

Which translates to 
"I want to expose a local server to the internet"
http://anyonecanaccess -> http://localhost 

  • Why would you want to use ngrok?

ngrok can be necessary for development and testing external services, such as Single Sign On, SAML, external APIs, Cloud solutions, etc

While you could pay for a domain and forward that to your development environment, that tends to be cost prohibitive and not overly practical given the nature of development and testing vms, containers, services, etc.  Especially in a company environment where you do not have access to the routers/firewalls.

You can also use ngrok to quickly demo a local feature before deploying.

  • How to use ngrok

To use ngrok, download and extract it to a directory
https://ngrok.com/download

C:/dev/ngrok

From a command prompt, 
such as microsofts cmd or a more feature rich ConsoleZ

> ngrok http 80

Session Status         online
Session Expires        7 hours, 4 minutes
Version                2.2.8
Region                 United States (us)
Web Interface          http://127.0.0.1:4040
Forwarding             http://24f98db7.ngrok.io -> localhost:80
Forwarding             https://24f98db7.ngrok.io -> localhost:80  

Assuming you already have a web based application running on port 80 ie 
http://localhost
you can access your local development environment via 
http://24f98db7.ngrok.io
The '24f98db7' part is randomly generated every time you start an ngrok instance.

The free version doesn't require an account and allows for basic http/tcp tunnels, which tends to be sufficient for development.  But the publicly exposed url is limited to 8 hours.  You can also create a free account for more resources if needed.

The paid versions of ngrok allow for End-to-End TLS Tunnels, Reserved domains, Reserved TCP addresses, more connections / minute, more tunnels/ngrok process, etc.

If your local development application runs on a custom local domain name such as myawesomeapp.local, you can use that with ngrok instead of localhost

> ngrok http myawesomeapp.local:80

Session Status                online
Session Expires               7 hours, 4 minutes
Version                       2.2.8  
Region                        United States (us)    
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://8316dcb8.ngrok.io -> myawesomeapp.local:80
Forwarding                    https://8316dcb8.ngrok.io -> myawesomeapp.local:80      

Note: Unlike .local, .test, and .example, .dev is not on a list of specially protected names.
in 2017, Chrome forces connections to all domains ending in .dev (as well as .foo) to use HTTPS
reference: theregister goole dev network

You can also add basic password protection to your exposed application

> ngrok http -auth "user:password" myawesomeapp.local:80

To stop ngrok just press ctrl + c

ngrok away

-End of Document-
Thanks for reading