Saturday, June 4

Project HB - 3. Convert, Crop, Silence



If you have not read Part 2, please read it here.




Running FFmpeg

Executing FFmpeg can be broken up into several distinct sections, though for this first run we will be doing the bare minimum required.


1. Convert Source Video to MP4


Parts of the command
    • ffmpeg
      • This tells your shell that you want to run the program "ffmpeg" and everything after the space is what you want to tell ffmpeg.
    • -i !SourceMovie!.MOV
      • -i tells ffmpeg that the next part is a filename, and to use that file as an input
      • ie: input file "!SourceMovie!.MOV"
    • out.1.mp4
      • The filename that is at the end of the line is what ffmpeg uses to save your newly created file.

Running FFmpeg


FFmpeg - Done


What this has done, is converted every frame of the source video, into a H264 encoded MP4 file. Now almost any media player capable of play H264 files can play this one. Also the output file has shrank from the original's 21,118,114 bytes to only 6,602,656 bytes. Less then 25% of the original's file size.
  • Video:
    • MPEG4 Video (H264)
    • 720x1280
    • 29.97fps
    • 3222kbps
  • Audio
    • AAC
    • 44100Hz
    • mono
    • 72kbps


2. Crop video

Parts of the command
  • ffmpeg
    • This tells your shell that you want to run the program "ffmpeg" and everything after the space is what you want to tell ffmpeg.
  • -i !SourceMovie!.MOV
    • -i tells ffmpeg that the next part is a filename, and to use that file as an input
    • ie: input file "!SourceMovie!.MOV"
  • -filter_complex "[0:v] crop=in_w:in_h-200"
    • -filter_complex
      • this tells FFmpeg that you want to make some changes to the input file
    • "      "
      • everything inside the quotation marks are the arguments for the filters
    • [0:v]
      • "0" declares we will be using input file 0, or the first input file
      • "v" declares we will be using the video portion of the input file
    • crop=in_w:in_h-200
      • crop=
        • is the filter we want to use
        • options
          • crop=width:height
          • crop=width:height:x:y
      • in_w
        • width of the input file
      • in_h-200
        • subtract 200px from the height of the input file
  • out.2a.mp4
    • The filename that is at the end of the line is what ffmpeg uses to save your newly created file.
<--- Original           Cropped ---> 

Interestingly enough, when I was filming this clip, I had my phone set on rotation lock, and accidentally recorded this video with the camera think it was in landscape mode. The reason why this becomes a little bit of an issue is: Most modern video players are smart enough to check the rotation of the video and try to play the video properly. Even FFmpeg does a good job of passing the rotation setting of the input through too the output video.

This means even though it appears that the source video is portrait mode, the data for the video is actually landscape mode. So when it comes time to crop the video you need to think that the width is actually the height, and the height is actually the width.

 Crop version 2.


We are cropping the input file. The output will be 400px shorter and 60px narrower then the source. We are going to be keeping the video data that starts at 60px from the left and 320px from the top. This will crop some unnecessary text, and some of the shadow from the original file.

Result

I am left with a dancing rodent, and the words "Happy Birthday". Exactly the part that I wanted from the source video.


3. Making a silent video

All you need to do to make the final output video have no sound: Is to add "-an" before the output filename.




Continue with ...

Part 2 - The SetupPart 4 - ???

Project HB - 2. The Setup


If you have not read Part 1, please read it here.

The Setup

I will be using Microsoft Windows for this project, though it should not be hard to follow along on Linux or Mac OSX.

I have created a directory specifically for working on this project. Mine is located at "d:\Projects\ffmpeg\HappyBirthday". Of course you can choose whatever name and location you wish.

For ease of typing, and to cut down on possible typo errors, I have also placed a copy of the downloaded "FFmpeg.exe" inside this directory as well. Now I can execute all commands calling FFmpeg without having to include it's absolute or relative path, that should save a fair bit of typing.

The video file "!SourceMovie!.MOV" is also placed in this folder. That way I also do not have to worry about dealing with absolute or relative paths with the video file.



Initial Directory Structure

  • D:
    • Projects
      • ffmpeg
        • HappyBirthday
          • !SourceMovie!.MOV
          • ffmpeg.exe

Test Setup

Launching Windows CMD.exe I proceed to the project directory and make sure the files are there. This is how it looks on my system.





Continue with ...

Project HB - 1. FFmpeg, and the Intro




FFmpeg

A complete, cross-platform solution to record, convert and stream audio and video. 

Geek Description
(modified from https://ffmpeg.org/about.html)

FFmpeg is a multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. FFmpeg runs across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc.



Layman Description (By myself)

A freeware set of utilities which allow you to convert, modify, and create your own videos. Now there is now graphical user interface in FFmpeg. All options and commands you wish FFmpeg to execute you will be providing via your operating system's shell. It sounds scary, the shell really is not scary, so we will experiment with it together.



The Project

Create a simple "Happy Birthday" video using a video I made myself of a humorous card. Now this would be a simple feat with any video editing software available locally, or online. The additional things we will be doing with this video, separates the simple video software from the complex.

I want to add a simple message before playing the video I recorded. Actually to be more correct, I wish to fade in a message, and then display the video over top of the message while the video plays. I am only providing the message as a single PNG image file.

I also want to have a image displayed after the video, which will be my basic "credits" placeholder. The image will display for a few seconds allowing the viewers to realize the video is over.

I want to set the resulting video to a royalty free music song of my choosing. Choosing royalty free music allows you to share the video on YouTube without having to worry about copyright infringement notices.



The Source Files

All the source files required for this project can be downloaded at https://drive.google.com/folderview?.  I will be using only these files, and a downloaded copy of FFmpeg to create my final results. The MP3 file was downloaded from http://freemusicarchive.org/, and is labeled "The_Blank_Tapes_-_03_-_Its_Your_Birthday.mp3".




Continue with ...

Friday, June 3

AliExpress #49 - Portable Mini Plier / Stripper



Portable Mini Plier / Stripper
Day 53

Now this order came in fast. Twelve days and it was in my mailbox. There is little I can say about this item. It works.

Actually I can say quite a bit more about this. These are selling for around $9.95 at any of my local hardware stores. Now for nearly $10 they come in a plastic blister pack, with manufacture names like Husky, and the such.

Lose the blister pack 
...
lose the brand name
...
magically it's $0.60 after shipping!

  • Order #49
    • Day 41    - Ordered
    • ** Never shown as shipped **
    • Day 53  - Arrived in Mailbox
    • 12 Days Shipping Time






Quick Linux Question: How do I create a symbolic link file?


Question:

How do I create a symbolic link file?





Answer:    use "ln -s"

The Linux file system has the possibility to create symbolic link files. Symbolic link files are a lot like Microsoft Window's shortcut files. That they create a file at a specific location which is actually located in a different location. The most common reason for creating a symbolic linked file is so you can have a binary file accessible from multiple locations without having to actually duplicate the binary file.



ln -s /usr/local/bin/node /usr/bin/node

This command creates a symbolic link file of the current user's locally installed Node.js, and puts that linked file in the global users bin folder. This way all the users on the system can have access to Node.js even though it is only installed once.




--help


AliExpress #1 - Digispark Dev Board - ATTINY85



Digispark Dev Board - ATTINY85
Day 52

I will start this by saying this order took a long time to get here. Fifty two days is the longest time any order so far has taken to arrive.

I did contact the seller when forty days had passed, and the seller reassured me that the order would arrive. The seller also increased the buyer protection time by another forty days at the same time. Even though I wish the order had arrived quicker I am quite pleased with how the seller handled this order.

Delivery Information
  • Order #1
    • Day 1    - Ordered
    • Day 15  - Shipped
    • Day 52  - Arrived in Mailbox
    • 52 Days Shipping Time


The Digispark is used in these projects:
Happy Fathers Day Sketch    2016.06.09



Support Information

Initially plugging one of the DigiSparks into a USB port promptly gave me this screen:

Most Microsoft Windows users will need to install drivers before they will be able to use these. Thankfully enough the drivers are very easy to find ( github.com/.../1.6.7/Digistump.Drivers.zip ). After installing these drivers you will receive the wonderful window bellow:

Setting up the DigiSpark in the Arduino IDE can be done easily by following the instructions at:




Quick Item of Note

There are two versions of these DigiSpark.
  • Model A has the LED pin located on pin 1
  • Model B has the LED pin located on pin 0



Packaging Video, Tracking, and Order Information






Thursday, June 2

AliExpress #41 - MB-102 Breadboard



MB-102 Breadboard
Day 49

Now this order came in fast. Sixteen days and it was in my mailbox. Same quality as the other MB-102 I purchased. Interesting side fact, though this MB-102 arrived wrapped in bubble wrap ... All the bubble wrap was popped. The breadboard works well, and I am quite happy with it.


  • Order #41
    • Day 33    - Ordered
    • ** Never shown as shipped **
    • Day 49  - Arrived in Mailbox
    • 16 Days Shipping Time











Quick Linux Question: Which file is the real file?


Question:

How can I tell which executable is the real binary file?





Answer:    use "ls -l"

The Linux file system has the possibility to create symbolic link files. Symbolic link files are a lot like Microsoft Window's shortcut files. That they create a file at a specific location which is actually located in a different location. The most common reason for creating a symbolic linked file is so you can have a binary file accessible from multiple locations without having to actually duplicate the binary file.

If you come across a time when you notice you have the same file located in multiple locations, it can be very handy to tell which of the files is the actual binary file, and which is the symbolic link file.

example:

which -a nano

This command shows that the file "nano" appears to be located in two separate locations. One of these is the actual binary file, and the other one is only a link to that file.




ls -l /usr/bin/nano

Using the "-l" option of ls we are able to display the link between the files. Notice that it shows that the file "/usr/bin/nano" is linked to the file actually located at "/bin/nano"




ls -l /bin/nano

Now if you use the same option on a file that is not a symbolic link file, ls is smart enough to just show you the file details, as displayed in the image bellow.


AliExpress #11 - Unique Tea Strainer (Man Resting)



Unique Tea Strainer (Man Resting)
Day 48

Novelty tea strainer collectors behold. Now a man can relax and make a cup of tea ;) It's cute, sturdy, and after a good wash, works great.


  • Order #11
    • Day 8    - Ordered
    • Day 9    - AliExpress reported shipped
    • Day 48  - Arrived in Mailbox
    • 40 Days Shipping Time










Wednesday, June 1

AliExpress #8 - SYB-170 Breadboards



SYB-170 Breadboards
Day 47

Only need a few rows of a breadboard, try these SYB-170 boards. Makes a nice addition to anybodies toolkit.



  • Order #8
    • Day 6    - Ordered
    • Day 7    - AliExpress reported shipped
    • Day 47  - Arrived in Mailbox
    • 41 Days Shipping Time





CodePen.io and the Javascript Playground


The Javascript Playground

There are many places online where you can test your HTML, CSS, and Javascript. Today I have setup an account with CodePen.io. I have also created my first "pen."



Bellow you will see, after you click "Run Pen", my first playground or "pen." After deciding that I would like to have the current monthly calendar displayed as my desktop background, I quickly setup the code bellow to test some ideas.

CodePen.io

Offers a fairly robust free account. All your "pens" are publicly available for viewing, and there is no asset hosting, or pair programming. Other then that, and the lack of theme options, you will find a free account is very useful.

The paid account, or "Pro Mode", allows you too host assets, pair program, and use custom themes when embedding pens. Depending on which "Pro" package you purchase can also decide if there are Ads displayed along side your pens.



My First Pen


See the Pen Monthly Calendar by Failed Sleep (@FailedSleep) on CodePen.


Month in Review (May 2016)


Sunday May 1, 2016 - Tuesday May 31, 2016

May

Here I am going to try to document all "projects" that I have started, continued, or ended in the previous week.

1. Aliexpress: Orders have now started arriving at relatively frequency. Many first impression posts and videos have been made, and I am looking forward to examining most of these products in better detail in further posts.

2. Julian Ilett: Continuing on following Julian Ilett's wonderful Postbag videos. This month Julian Ilett shows how even the most proficient can some times make a mistake.
Julian Ilett: Postbag Summary
2016
#63  May   3   $69.00
#64  May 19   $37.77
#65 May  31   $28.64
-----------------------------
$135.41

3. YouTube: I have finally started a YouTube channel, and have figured out how to edit and upload some, at the moment one, video. So you can follow the link and see the first video I have uploaded to YouTube.

It was a little rocky to get the first video done. After a little bit more effort I was able to upload the videos for the next few items I ordered from AliExpress.

AliExpress Deliveries - 3*40 Dupont Wires M-M, M-F, F-F


There is also a video I did showing how I was able to share my internet through my computer's USB port with my Raspberry Pi Zero.

4. Raspberry Pi: I finally completed a post on how I set up one of my Raspberry Pi Zero's which I
have connected to my desktop computer.



5. Quick Questions - Linux Edition: Using the Linux shell, or command line, can some times be daunting. These are the topics I highlighted in the month of May.




Month in Review (May 2016)

Quick Linux Question: How do I install the latest Node.js?


Question:

How do I install the latest Node.js in Rasbian?





Answer:

Two quick lines shell commands should get you up and running

wget http://node-arm.herokuapp.com/node_latest_armhf.deb

"wget" downloads the newest version of Node.js to the current directory. When the file is done downloading then you can use the next command to install it.




sudo dpkg -i node_latest_armhf.deb

You need to have administrator privileges in order to install software globally in Linux, which is why we use "sudo". Then we install the Node.js software package we just downloaded. This could take almost a minute if your using a Raspberry Pi Zero, or Raspberry Pi A/B.



node -v and npm -v

To verify that Node.js installed properly you can use "node -v" to check Node.js's version. You can also use "npm -v" to display the current version of npm.


Tuesday, May 31

Quick Linux Question: Where are the binary, source, and man pages for a executable?


Question:

How can I find where the binary file, source, and man page files are located?




Answer:       use the "whereis" command

whereis raspi-config

The whereis command will display where the binary file, source, and man page files are located for a particular execuat



whereis nano

Because the executable is located in more then one location: Using this command will show all the locations that the command is located, which you have access to.


Monday, May 30

Quick Linux Question: Where is the executable?


Question:

How can I find where the binary file for a program is located?





Answer:         use the "which" command

which raspi-config

The which command will search through your current user's PATH variable for a executable you specified.


which -a nano

Now it is possible that the executable may be found in multiple locations, or be linked in multiple locations. To find them use the "-a" option.