11/25/2020

Virtual Media File or Video Metadata

FAQs

  1. How can I embed chapters metadata into media file? Because sometimes I have a big media file and I want that whenever I want, I can go to specific segment of that media file.

    1. Yes! Using ffmpeg
  2. Is There any way to create a config file to play different segment of videos from multiple files? This can be useful when you have list of media files and you want to create playlist for a single topic without merging these media files together.

    1. Yes! Using EDL file.

 

What is EDL?

EDL files basically concatenate ranges of video/audio from multiple source files into a single continuous virtual file.

Each such range is called a segment, and consists of source file, source offset, and segment length.

 

Example File

# mpv EDL v0
001.mp4, 200, 20,title=First Chapter
002.mp4, 100, 30,title=Second Chapter
003.mp4, 220, 100,title=Third Chapter

Note that You should save this file with file line endings from the Windows default CRLF to *nix-like LF only,

 

Usage

  • You can play this edl file directly by mpv player

    • mpv demo.edl
  • You can also save your virtual media file to disk (by encoding)

    • mpv demo.edl -o demo.mp4

 

Useful Shortcuts

  • [ and ]

    • Decrease/increase current playback speed by 10%.
  • BACKSPACE

    • Reset playback speed to normal.
  • T (Shift + t)

    • Toggle stay-on-top (see also --ontop).
  • PGUP and PGDWN key

    • Seek to the beginning of the previous/next chapter.
  • Alt + and Alt -

    • Combining Alt with the + or - keys changes video zoom.

    • Alt+LEFT, Alt+RIGHT, Alt+UP, Alt+DOWN

      • Move the video rectangle (panning).
    • Alt+BACKSPACE

      • Reset the pan/zoom settings.
  • Ctrl + h

    • Toggle hardware video decoding on/off.

 

using ffmpeg to add Chapters

You can use ffmpeg command line tool to add chapters into media file.

Extract metadata from media file

ffmpeg -i 001.mp4 -f ffmetadata meta.txt

 

Format of FFMETADATA file

;FFMETADATA1
major_brand=isom
minor_version=512
compatible_brands=isomiso2avc1mp41
encoder=Lavf58.45.100

[CHAPTER]
TIMEBASE=1/1000
START=0
END=60000
title=chapter \#1

[CHAPTER]
TIMEBASE=1/1000
START=60000
END=120000
title=chapter \#2

[CHAPTER]
TIMEBASE=1/1000
START=120000
END=500000
title=chapter \#3

 

Inserting metadata into media file

ffmpeg -i 001.mp4 -f ffmetadata meta.txt -map_metadata 1 -codec copy 001_conv.mp4

 

 

 

Sources

https://github.com/mpv-player/mpv/blob/master/DOCS/edl-mpv.rst

https://github.com/mpv-player/mpv/issues/6479

https://mpv.io/manual/master/#interactive-control

https://sourceforge.net/projects/mpv-player-windows/files/

http://ffmpeg.org/ffmpeg-formats.html#Metadata-1

9/25/2020

[2020-09] Create Exam Sitting Plan using OCR


# Convert Image to editable list of roll numbers

  1. Scan or Capture a photo from your camera (List of students roll numbers should be in vertical column, so that OCR can easily read them) 
  2. If you want more accurate OCR result then you should crop the image and try to keep just the roll numbers, You can also erase other unwanted things from that photo. 
  3. Open Online OCR website https://ocr.space

# Convert list of roll numbers to HTML tables

1. You should have list of all roll numbers like this 
2021001
2021002
2021004
.
.

2. Open Chrome DevTools and Run this script to create HTML Tables, (You might want to tweak this JS code as per your requirements but this is basic code that I generally use)

This JS code depends upon lodash, so you will need lodash for this code to work

var a = `456539
456543
456548
...
462057
462073
462080
462090
462100
462120
462130`;

var b = a.split("\n");

b = b.map((v,k)=>{
    if ((k + 1) % 4 == 1)
        return 'A   ' + v;
    if ((k + 1) % 4 == 2)
        return 'B   ' + v;
    if ((k + 1) % 4 == 3)
        return 'C   ' + v;
    if ((k + 1) % 4 == 0)
        return 'D   ' + v;
}
);

var c = _(b).chunk(24).map((m)=>_.zip.apply(_, _.chunk(m, 6))).value();

function createTable(i, data) {
    var a = `<p>${i}</p><table border="1"><tbody>`;
    for (var t = 0; t < data.length; t++) {
        a += '<tr>';
        for (var r = 0; r < data[t].length; r++) {
            a += `<td>${data[t][r]}</td>`;
        }
        a += '</tr>';
    }
    a += '</tbody></table>';
    return a;
}

function createTables(tbls) {
    var b = '';
    for (var i = 0; i < tbls.length; i++) {
        b += createTable(i, tbls[i]);
    }
    return b;
}

createTables(c);

3. Copy generated HTML code to Excel


There you have it and now you can paste it into any exam sitting management excel template.


May! You have a nice day.

4/16/2017

How to use Mangal Font with `mPDF PHP` Library


Similar Questions

  • How to use Hindi with mPDF
  • How to use Custom Font with mPDF
  • How to use UTF-8 Font with mPDF
  • How to use UTF-8 Data with mPDF

Simple Project Structure

app
    assets
        css
        js
        img
    bin
    bower_components
    vendor
        mpdf
            mpdf

Steps

  1. First Copy and Paste Custom Font to ./vendor/mpdf/mpdf/ttfonts Directory
    So Full path to font will be ./vendor/mpdf/mpdf/ttfonts/MANGAL.TTF

  2. Update Fonts Config File of mPDF Library ./vendor/mpdf/mpdf/config_fonts.php

$this->fontdata = array(
    "mangal" => array(
        'R' => "MANGAL.TTF",
        'useOTL' => 0xFF,
    ),

    ....

);

  1. Update HTML-DOM/CSS property for font-family
    So find and replace font-family:{old_font} to font-family:mangal

  2. You can create basic CSS Rules for it

body {
    font-family: mangal;
}

// OR

.hindi {
    font-family: mangal;
}

First Install mPDF library using Composer

php /home/ssp/composer.phar require mpdf/mpdf

First Demo Normal Case

<?php 
// Using mPDF Library
$mpdf = new mPDF(''); 

// Normal Case
$test_case1 = '
<head>
<title>Document in Hindi</title>
</head>
<body>
<p>यह एक डेमो टेस्ट है |</p>
</body></html>';

// Set some flags for mPDF
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;

// Read and Parse HTML Content
$mpdf->WriteHTML($test_case1);
// Display PDF to Browser
$mpdf->Output();
exit;

Using Custom Style for any HTML Element

<?php 
$test_case2 = '
<head>
<title>Document in Hindi</title>
</head>
<body style="font-family: mangal; font-size: 20px;">
<p>यह एक डेमो टेस्ट है |</p>
</body></html>';

$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;

$mpdf->WriteHTML($test_case2);
$mpdf->Output();
exit;

Using Custom Stylesheet (CSS)

<?php 
$test_case3 = '
<head>
<title>Document in Hindi</title>
<style>
body {
    font-family: mangal;
    font-size: 15px;
    color: red;
}
</style>
</head>
<body style="font-family: mangal; font-size: 20px;">
<p>यह एक डेमो टेस्ट है |</p>
</body></html>';

$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;

$mpdf->WriteHTML($test_case3);
$mpdf->Output();
exit;

Download Fonts for Hindi India

  1. http://indiatyping.com/index.php/download/hindi-fonts
  2. http://indiatyping.com/index.php/download/mangal-font

How to Shrink RAW Disk Image to Actual Used Disk Space

Related Questions

  1. How to save disk space for raw disk images
  2. How to shrink raw disk image to actual space used
  3. How to compress raw disk image to actual space used

Note: This method is only for Linux Users

Step 1 (Clone or Download bash Script)

https://github.com/Drewsif/PiShrink Make your pi images smaller!
ssp@ssp-pc:~/Downloads$
=> git clone https://github.com/Drewsif/PiShrink.git
Cloning into 'PiShrink'...
remote: Counting objects: 72, done.
remote: Total 72 (delta 0), reused 0 (delta 0), pack-reused 72
Unpacking objects: 100% (72/72), done.
Checking connectivity... done.

Lets Check Syntax of Command pishrink.sh

ssp@ssp-pc:~/Downloads$
=> cd PiShrink/
ssp@ssp-pc:~/Downloads/PiShrink$
=> ls
LICENSE  pishrink.sh  README.md
ssp@ssp-pc:~/Downloads/PiShrink$
=> ./pishrink.sh 
Usage: ./pishrink.sh [-s] imagefile.img [newimagefile.img]

You need sudo permission to Use this Script

ssp@ssp-pc:~/Downloads/PiShrink$
=> ./pishrink.sh -s /media/ssp/Linux_DATA/raspberry-pi.img /media/ssp/Linux_DATA/raspberry-pi.min.img 
ERROR: You need to be running as root.

ssp@ssp-pc:~/Downloads/PiShrink$
=> sudo ./pishrink.sh -s /media/ssp/Linux_DATA/raspberry-pi.img /media/ssp/Linux_DATA/raspberry-pi.min.img 
Copying /media/ssp/Linux_DATA/raspberry-pi.img to /media/ssp/Linux_DATA/raspberry-pi.min.img...
Skipping autoexpanding process...
e2fsck 1.42.9 (4-Feb-2014)
/dev/loop0: recovering journal
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/loop0: 152923/480496 files (0.1% non-contiguous), 1059531/1924096 blocks
resize2fs 1.42.9 (4-Feb-2014)
resize2fs 1.42.9 (4-Feb-2014)
Resizing the filesystem on /dev/loop0 to 1066992 (4k) blocks.
Begin pass 2 (max = 98529)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 59)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 13514)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop0 is now 1066992 blocks long.

Shrunk /media/ssp/Linux_DATA/raspberry-pi.min.img from 7.5G to 4.2G

Result

As you can see that Actual Size of Disk Image was about 8 GB and now it is about 4 GB, So this script is really useful When you want to save disk space and now you can easily restore raw disk image fatster (in short time). After that You can expand file system to use all available disk space.

1/26/2017

How to Optimize/Compress and Beautifly SVG Graphics FIles

When you are creating Vector Graphics using tools such as Inkscape and Adobe Illustrator then you can see that Size of created SVG file is quite big, and when you look at Source Code of SVG file, You can see that there is lot of unwanted metadata and attributes, which are not required. That is Why,

When You want to Optimize SVG file for your Website, you want small file size.

How to Optimize SVG Files

There is great Node.js module, which you can install and use to optimize big SVG files, So, let me show you, How you can install it.

First, Download and install Node.js, You can Download it from https://nodejs.org/en/download/, Just download latest stable version of it and install it in such a manner that you can use node.exe from windows Command Prompt.

After installing node.js, lets check if we can access node.exe from Windows Terminal or Command Prompt.

where node
@rem -- N:\NodeJSPortable\App\NodeJS\node.exe

where npm
@rem -- N:\NodeJSPortable\Data\npm.cmd

Now, Lets install svgo module or package for node.js. Open Windows PowerShell or Command Prompt, and use command given below.

npm install -g --verbose svgo
@rem -- npm info it worked if it ends with ok
@rem -- npm verb cli [ 'N:\\NodeJSPortable\\App\\NodeJS\\node.exe',
@rem -- npm verb cli   @rem -- 'N:\\NodeJSPortable\\Data\\node_modules\\npm\\bin\\npm-cli.js',
@rem -- npm verb cli   'install',
@rem -- npm verb cli   '-g',
@rem -- npm verb cli   '--verbose',
@rem -- npm verb cli   'svgo' ]
@rem -- npm info using npm@3.5.3
@rem -- npm info using node@v5.7.0

after installing svgo package for node.js, now we can use this package from command prompt. To know more about svgo you can check these websites.
https://github.com/svg/svgo
https://github.com/svg/svgo-gui
https://jakearchibald.github.io/svgomg/

NOTE: When you are working with SVG files which has UTF-8 encoded data/string, then you should use PowerShell instead of Standard Windows Command Prompt, because in some cases command prompt does not work as expected.

How to use svgo

Copy Full Path of your SVG file to Windows Clipboard and Open PowerShell.

@rem -- Case 1 (When You wanna Overwrite Existing SVG File`
svgo.cmd -i "input_svg_file_path.svg"

@rem -- Case 2 (Write Optimized version of SVG into Different File)
svgo.cmd -i "input_svg_file_path.svg" "output_svg_file_path.svg"

So, now you have a pretty long text string.

How to Beautifly SVG Files

You can not easiliy edit Optimized SVG files using test editor, because it is not readable, so we want to make it readable or prettty.

NOTE: When you are using git as version control system for your project and want to commit optimized SVG files to git, then you should Beautifly it before commiting to git.

There is a good plugin gsvg (Git-Friendly SVG), which we can use to Beautifly SVG files. so lets download and install it for node.js.
https://www.npmjs.com/package/gsvg

npm install -g --verbose gsvg
@rem -- npm info it worked if it ends with ok
@rem -- npm verb cli [ 'N:\\NodeJSPortable\\App\\NodeJS\\node.exe',
@rem -- npm verb cli   'N:\\NodeJSPortable\\Data\\node_modules\\npm\\bin\\npm-cli.js',
@rem -- npm verb cli   'install',
@rem -- npm verb cli   '-g',
@rem -- npm verb cli   '--verbose',
@rem -- npm verb cli   'gsvg' ]
@rem -- npm info using npm@3.5.3
@rem -- npm info using node@v5.7.0

How to use gsvg

Copy Full Path of your Optimized SVG file to Windows Clipboard.

gsvg.cmd "output_svg_file_path.svg" "pretty_svg_file_path.svg"

1/12/2017

Must have Firewall Software for All Internet Users - GlassWire

Third-Party Firewall Software for Windows


So, You are looking for some Alternative for Windows Firewall, Because it is not that user Friendly, and you want something, which you can use without writing any line of code or command as well as you want to save your time, ok, you must take a look for GlassWire Software, don't worry, it is free with some cool features.

Why you should use it: GlassWire's firewall software reveals threats your antivirus missed, GlassWire is a free network monitor & security tool with a built in firewall.


GlassWire Features Overview

  • Internet Security
  • GlassWire has built-in Firewall, which is very easy to use, you can block network traffic for any application, you can see realtime speed for any application. GlassWire has different types of Pre-Configured Alerts, which are super useful to visualize your Network.

  • Built-in Firewall
  • GlassWire includes very simple Firewall Interface, So You can easiliy Allow/Block Network Traffic for any Application. You can also see real-time speed of Internet used by some running software. just click on fire icon, exists in very left side of app, you can block internet for that software, also you can easiliy turn ON/OFF Firewall.

  • Visual Network Monitoring
  • GlassWire has very sweet Graphs with some unique themes for it, If you are using Classic Theme, You can visualize download speed with Yellow color and Upload speed with Pink color. With the help of Network Timeline you can see which apps had used, How much of Bandwidth (Downloaded+Uploaded) Data, and Data Usage for Given Protocol, and more, like hosts with which these apps had shared data.


  • Network Time Machine
  • You can easily visualize Network Traffic used over a given timeline, that's why, they call it, Network Timeline, because as time-range changes, so does apps, traffic type data usage, alerts and list of accessed hosts.

  • Discreet Alerts
  • When you are doing some serious work and you don't want to be disturbed by any Alert generated by GlassWire, You can active `Snooze On` Mode, it will disable notifications for 24 hours, unless you turn off `Snooze On` Mode


  • Bandwidth Usage Monitor
  • For a given time-range, you can see Data/Bandwidth usage with list of apps, their individual usage, usage by traffic type and list of hosts/IPs those provide you that Data

  • Remote Server Monitoring
  • You can also manage and visualize real-time network traffic and more, because using GlassWire you can easily access it from Remote Machine, because each GlassWire software acts as local server for GlassWire, all you need is IP Address of remote Computer which has it installed and running.

  • Internet Privacy Protection
  • GlassWire has Incognito Mode, so that it won't record your network usage, but it will monitor real-time network traffic and network usage, but as soon as you turn off this Mode, it will delete that section from GlassWire History, and now you don't have to clear all history of GlassWire.

  • Ask to connect Mode
  • `Pro` - Within GlassWire Firewall, this mode is useful, when you want to be notify for every new connection, and you want to manually allow network connction for that application.

  • Lock down mode
  • `Pro` - You can block network traffic for all apps using this mode, all you need to do is, active this mode, using this button in GlassWire Firewall Tab.

  • Mini graph
  • GlassWire can show you Mini Graph, so that you can put this Widget on to your Desktop Screen. it is really useful.

  • Webcam/Mic detection
  • GlassWire can notify you when any software try to access you Webcam or Mic of your Laptop or Desktop.

  • Who's on your WiFi or Network?
  • `Pro` - If you want to know, who are connected to your Wifi Router or Wifi Access Point, Because, sometimes you are so confused about data usage and want to monitor, who is using Internet using your Wifi Router.

  • Multiple server monitoring
  • You can monitor and manage Remote GlassWire instance using your local GlassWire software, all you need to do is allow remote connections for your local GlassWire Server, configure some password and after that add remote GlassWire server details, like IP address. Now GlassWire software interface will change, and you can manage and visualize in real-time.

  • New connection? Get notified
  • GlassWire can notify you when some new Software try to access Internet or network traffic, this is very useful, because sometimes nasty Virus try to connect to their creator and give them control of your own computer and this is not cool at all.

  • What happened while you were away?
  • GlassWire can evaluate and generate simple report for you when it detect no user activity or your computer goes to sleep mode, for this you need to configure this Alert using GlassWire Settings.


Download Link: GlassWire


Short Animation

12/31/2016

Copy all Streams of Media using ffmpeg



FAQ

  • How to copy all streams of some media using ffmpeg
  • Preserve all streams of some media, while spliting media
  • Copy selected streams of media using ffmpeg

Generally media files has two streams, one for video and other one for audio, but when your media file has multiple streams, and you want to copy all those streams to some other media file when you trying to cut or split specific parts from media file.

Example 1

I have recorded some video using TechSmith CamTasia Studio, and it has more than two streams, and i wanna split this into multiple parts, so that i can easily edit in CamTasia Video Editor, and i am using ffmpeg for this.

Case 1 [ Let me show you details of this Media File ]

C:\Users\someone\Camtasia Studio )
=$ ffprobe.exe "Rec 12-30-16.trec"
ffprobe version N-82759-g1f5630a Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --ena
ble-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-
libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enab
le-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-li
bopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspe
ex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
 --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzi
mg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.109 / 57. 66.109
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Rec 12-30-16.trec':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2016-12-30T03:58:26.000000Z
  Duration: 00:21:29.64, start: 0.000000, bitrate: 3103 kb/s
    Stream #0:0(und): Video: tscc2 (tsc2 / 0x32637374), yuv444p, 1364x768, 2585 kb/s, 26.25 fps, 30 tbr, 30 tbn, 30 tbc
(default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z
    Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z

Case 2 [ Cut Marked portion from this Media File ]

C:\Users\someone\Camtasia Studio )
=$ ffmpeg.exe -i "Rec 12-30-16.trec" -ss 150 -t 200 -map 0 -codec copy "Rec 12-30-16
.trec.0.avi"
ffmpeg version N-82759-g1f5630a Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --ena
ble-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-
libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enab
le-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-li
bopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspe
ex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
 --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzi
mg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.109 / 57. 66.109
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Rec 12-30-16.trec':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2016-12-30T03:58:26.000000Z
  Duration: 00:21:29.64, start: 0.000000, bitrate: 3103 kb/s
    Stream #0:0(und): Video: tscc2 (tsc2 / 0x32637374), yuv444p, 1364x768, 2585 kb/s, 26.25 fps, 30 tbr, 30 tbn, 30 tbc
(default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z
    Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z
Output #0, avi, to 'Rec 12-30-16.trec.0.avi':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    ISFT            : Lavf57.58.101
    Stream #0:0(und): Video: tscc2 (tsc2 / 0x32637374), yuv444p, 1364x768, q=2-31, 2585 kb/s, 26.25 fps, 30 tbr, 30 tbn,
 30 tbc (default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z
    Stream #0:1(und): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z
    Stream #0:2(und): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp, 253 kb/s (default)
    Metadata:
      creation_time   : 2016-12-30T03:58:26.000000Z
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame= 5365 fps=1520 q=-1.0 Lsize=   58364kB time=00:03:20.00 bitrate=2390.6kbits/s speed=56.7x
video:45405kB audio:12387kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.989971%

Case 3 [ Take a look at streams inside Splited Media file ]

C:\Users\someone\Camtasia Studio )
=$ ffprobe.exe "Rec 12-30-16.trec.0.avi"
ffprobe version N-82759-g1f5630a Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --ena
ble-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-
libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enab
le-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-li
bopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspe
ex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
 --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzi
mg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 41.101 / 55. 41.101
  libavcodec     57. 66.109 / 57. 66.109
  libavformat    57. 58.101 / 57. 58.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, avi, from 'Rec 12-30-16.trec.0.avi':
  Metadata:
    encoder         : Lavf57.58.101
  Duration: 00:03:20.02, start: 0.000000, bitrate: 2390 kb/s
    Stream #0:0: Video: tscc2 (tsc2 / 0x32637374), yuv444p, 1364x768, 1860 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp, 253 kb/s
    Stream #0:2: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp, 253 kb/s

Result

  • Now I can use this splited media file in CamTasia Video Editor
  • ffmpeg is OpenSource and Free to use.
  • You can download ffmpeg for Windows from https://ffmpeg.zeranoe.com/builds/
  • -map 0 parameter force ffmpeg to select all streams inside media file
  • -codec copy parameter is used to copy selected streams from media file
  • -ss time parameter is used to specify, starting marker, its value can be either in seconds or hh:mm:ss.ssss format.
  • -t time parameter is used to specify, ending marked, its value type is same as -ss parameter value.

OK friends, If anything left unexplained, you can comment below in comment box, Thanks


11/22/2016

Say Hello to `Windows Firewall`

What is a firewall?

A firewall is a software program or piece of hardware (like, Network Router) that helps screen out hackers, viruses, and worms that try to reach your computer over the Internet, But How firewall can keep you away from Hackers or unwanted viruses,
It does this by capturing/filtering network traffic of this Computer, Categories traffic as Inbound traffic or OutBound traffic, Use pre-Defined Rules/Filters, and perform action such as, Allow/Block traffic.

Types of Firewall Rules

There can be only two types of Traffic, inbound traffic or outbound traffic, Therefore, There are two Rules for Windows Firewall.
  • Inbound Rule (Let Program receive traffic from *Other_Sources)

  • Outbound Rule (Let Program send traffic to *Other_Sources)
*Other_Sources such as, Programs, system services, computers, or users
  • Custom Windows Firewall Rules serve three purposes
    • Allow the connection
    • Allow a connection only if it is secured through the use of Internet Protocol security (IPsec)
    • Block the connection

Windows Firewall

Default Behavior for Inbound/Outbound traffic
  • Inbound traffic is blocked by Default on Windows, So If you wanna use any Application/Software, Which will share something over your Network, Windows Firewall will prompt you to create/allow Inbound Connection.
  • Outbound traffic is allowed by default, But (Generally) You wanna create Outbound Rule, to Block Connection for Any Application/Software.

Why Windows Firewall has Domain, Private and Public Profiles?

Windows Firewall can automatically detect, which type of network you wanna connect to, So it will prompt you to Choose Proper Network Profile for that Network Connection, For Example, If You want to connect to your Home Router, Dongle etc, Windows will Recommend You to Choose, Private network Profile for this Network Connection. And When You want to connect to Public Network such as Public Wifi, LAN etc, Windows will detect it as Public Network as Recommend you to Choose Public Network Profile, Basically Public Network Profile is Configured as Most Secure than other two network profiles.
Note: Windows Firewall has advanced settings for these profiles.

How to Check/Configure your Current/Active Network Profile

You can check/configure current/active network profile in Windows Network and Sharing Center

How to Disable Internet/OutBound Traffic for All Apps/Software

How to Create and Allow/Block Internet Traffic for Specific Application

  1. Create New Outbound Rule
  2. Browse for Application, to Filter its Traffic
  3. What you want to do, for Captured Traffic
    • Allow Connection
    • Allow Connection (Only if Secure)
    • Block Connection
  4. For Which Profile, You want to activate this Rule
  5. Unique Name and Optional Description for this NEW OutBound Rule
  6. Lets Verify Our Firewall Rule Properties

Create New InBound Rule

netsh advfirewall firewall add rule name="wget-me" profile=domain,private,public protocol=any enable=yes DIR=In program="%ProgramFiles%\Gnu-wget\wget.exe" Action=Allow

Create New OutBound Rule

netsh advfirewall firewall add rule name="wget-me" profile=domain,private,public protocol=any enable=yes DIR=Out program="%ProgramFiles%\Gnu-wget\wget.exe" Action=Allow

Change in Registry (Because of Command Above)

HKLM\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\{994CCCA0-9C02-44DD-AB5F-02E74AD3E935}: "v2.20|Action=Allow|Active=TRUE|Dir=Out|App=%ProgramFiles%\Gnu-wget\wget.exe|Name=wget-me|"
HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\{994CCCA0-9C02-44DD-AB5F-02E74AD3E935}: "v2.20|Action=Allow|Active=TRUE|Dir=Out|App=%ProgramFiles%\Gnu-wget\wget.exe|Name=wget-me|"

Remove Existing Rule

netsh advfirewall firewall delete rule profile=domain,private,public name="wget-me"
@C:\Windows\system32
=> netsh advfirewall /?

The following commands are available:

Commands in this context:
?              - Displays a list of commands.
consec         - Changes to the `netsh advfirewall consec' context.
dump           - Displays a configuration script.
export         - Exports the current policy to a file.
firewall       - Changes to the `netsh advfirewall firewall' context.
help           - Displays a list of commands.
import         - Imports a policy file into the current policy store.
mainmode       - Changes to the `netsh advfirewall mainmode' context.
monitor        - Changes to the `netsh advfirewall monitor' context.
reset          - Resets the policy to the default out-of-box policy.
set            - Sets the per-profile or global settings.
show           - Displays profile or global properties.

The following sub-contexts are available:
 consec firewall mainmode monitor

To view help for a command, type the command, followed by a space, and then
 type ?.


@C:\Windows\system32
=> netsh advfirewall firewall /?

The following commands are available:

Commands in this context:
?              - Displays a list of commands.
add            - Adds a new inbound or outbound firewall rule.
delete         - Deletes all matching firewall rules.
dump           - Displays a configuration script.
help           - Displays a list of commands.
set            - Sets new values for properties of a existing rule.
show           - Displays a specified firewall rule.

To view help for a command, type the command, followed by a space, and then
 type ?.


@C:\Windows\system32
=> netsh advfirewall firewall add rule /?

Usage: add rule name=<string>
      dir=in|out
      action=allow|block|bypass
      [program=<program path>]
      [service=<service short name>|any]
      [description=<string>]
      [enable=yes|no (default=yes)]
      [profile=public|private|domain|any[,...]]
      [localip=any|<IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>]
      [remoteip=any|localsubnet|dns|dhcp|wins|defaultgateway|
         <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>]
      [localport=0-65535|<port range>[,...]|RPC|RPC-EPMap|IPHTTPS|any (default=any)]
      [remoteport=0-65535|<port range>[,...]|any (default=any)]
      [protocol=0-255|icmpv4|icmpv6|icmpv4:type,code|icmpv6:type,code|
         tcp|udp|any (default=any)]
      [interfacetype=wireless|lan|ras|any]
      [rmtcomputergrp=<SDDL string>]
      [rmtusrgrp=<SDDL string>]
      [edge=yes|deferapp|deferuser|no (default=no)]
      [security=authenticate|authenc|authdynenc|authnoencap|notrequired 
         (default=notrequired)]

Remarks:

      - Add a new inbound or outbound rule to the firewall policy.
      - Rule name should be unique and cannot be "all".
      - If a remote computer or user group is specified, security must be
        authenticate, authenc, authdynenc, or authnoencap.
      - Setting security to authdynenc allows systems to dynamically
        negotiate the use of encryption for traffic that matches
        a given Windows Firewall rule. Encryption is negotiated based on
        existing connection security rule properties. This option
        enables the ability of a machine to accept the first TCP
        or UDP packet of an inbound IPsec connection as long as
        it is secured, but not encrypted, using IPsec.
        Once the first packet is processed, the server will
        re-negotiate the connection and upgrade it so that
        all subsequent communications are fully encrypted.
      - If action=bypass, the remote computer group must be specified when dir=in.
      - If service=any, the rule applies only to services.
      - ICMP type or code can be "any".
      - Edge can only be specified for inbound rules.
      - AuthEnc and authnoencap cannot be used together.
      - Authdynenc is valid only when dir=in.
      - When authnoencap is set, the security=authenticate option becomes an
        optional parameter.

Examples:

      Add an inbound rule with no encapsulation security for browser.exe:
      netsh advfirewall firewall add rule name="allow browser"
      dir=in program="c:\programfiles\browser\browser.exe"
      security=authnoencap action=allow

      Add an outbound rule for port 80:
      netsh advfirewall firewall add rule name="allow80"
      protocol=TCP dir=out localport=80 action=block

      Add an inbound rule requiring security and encryption
      for TCP port 80 traffic:
      netsh advfirewall firewall add rule
      name="Require Encryption for Inbound TCP/80"
      protocol=TCP dir=in localport=80 security=authdynenc
      action=allow

      Add an inbound rule for browser.exe and require security
      netsh advfirewall firewall add rule name="allow browser"
      dir=in program="c:\program files\browser\browser.exe"
      security=authenticate action=allow

      Add an authenticated firewall bypass rule for group
      acmedomain\scanners identified by a SDDL string:
      netsh advfirewall firewall add rule name="allow scanners"
      dir=in rmtcomputergrp=<SDDL string> action=bypass
      security=authenticate

      Add an outbound allow rule for local ports 5000-5010 for udp-
      Add rule name="Allow port range" dir=out protocol=udp localport=5000-5010 action=allow



@C:\Windows\system32
=> netsh advfirewall firewall delete rule /?

Usage: delete rule name=<string>
      [dir=in|out]
      [profile=public|private|domain|any[,...]]
      [program=<program path>]
      [service=<service short name>|any]
      [localip=any|<IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>]
      [remoteip=any|localsubnet|dns|dhcp|wins|defaultgateway|
         <IPv4 address>|<IPv6 address>|<subnet>|<range>|<list>]
      [localport=0-65535|<port range>[,...]|RPC|RPC-EPMap|any]
      [remoteport=0-65535|<port range>[,...]|any]
      [protocol=0-255|icmpv4|icmpv6|icmpv4:type,code|icmpv6:type,code|
         tcp|udp|any]

Remarks:

      - Deletes a rule identified by name and optionally by endpoints, ports,
        protocol, and type.
      - If multiple matches are found, all matching rules are deleted.
      - If name=all is specified all rules are deleted from the specified
        type and profile.

Examples:

      Delete all rules for local port 80:
      netsh advfirewall firewall delete rule name=all protocol=tcp localport=80

      Delete a rule called "allow80":
      netsh advfirewall firewall delete rule name="allow80"


Query Information about pre-defined Rules

@rem -- Display All OutBound Firewall Rules 
@C:\Users\ssp\Desktop
=> netsh advfirewall firewall show rule name=all dir=out 

Rule Name:                            wget-me
----------------------------------------------------------------------
Enabled:                              Yes
Direction:                            Out
Profiles:                             Domain,Private,Public
Grouping:                             
LocalIP:                              Any
RemoteIP:                             Any
Protocol:                             Any
Edge traversal:                       No
Action:                               Allow

Rule Name:                            @{Microsoft.ZuneVideo_2.6.446.0_x64__8wekyb3d8bbwe?ms-resource://Microsoft.ZuneVideo/resources/IDS_MANIFEST_VIDEO_APP_NAME}
----------------------------------------------------------------------
Enabled:                              Yes
Direction:                            Out
Profiles:                             Domain,Private,Public
Grouping:                             Video
LocalIP:                              Any
RemoteIP:                             Any
Protocol:                             Any
Edge traversal:                       No
Action:                               Allow

.
.
.

Rule Name:                            Windows Media Player x86 (UDP-Out)
----------------------------------------------------------------------
Enabled:                              No
Direction:                            Out
Profiles:                             Domain,Private,Public
Grouping:                             Windows Media Player
LocalIP:                              Any
RemoteIP:                             Any
Protocol:                             UDP
LocalPort:                            Any
RemotePort:                           Any
Edge traversal:                       No
Action:                               Allow
Ok.


8/25/2016

Getting Started with PHP Archives: PHAR

You can think of PHAR Archive as tar Archive or JAVA Archive (jar), but PHAR Archive serve specific purpose and more flexible.
  1. You can convert your PHP App into single Phar archive, So it saves space and easy to distribute
  2. If you want, you can compress it either using gz, bzip2 or zip compression Algorithms
  3. You can create executable Phar Archive which can have multiple endpoints, Endpoints server very different purpose, because, When you execute this Phar Archive from Command line, it will call, shell endpoint, But when you try to run that same archive using Browser, After putting it into web document Directory, it will look for (if Exists), web endpoint. That way you can create a single Phar archive which can we used as either command line utility, or when serve through web, it behaves like web app.
If You are facing any Error about, phar.readonly setting in php.ini file Then You need to Edit Your PHP Configuration File (In My case, php.ini) search for string phar.readonly and remove any Semi-colon before that line And set it to Off Example:- phar.readonly = Off

Example - Just create a simple Phar Archive for Given Directory

cd /tmp
mkdir first
cd first
# Create 10,000 Files for Testing purpose
php -r 'foreach(range(0,10000) as $i){ echo "$i\n"; $d=sprintf("%07d.txt", $i); file_put_contents($d, "Hello from $d\n"); }'


cd ..
# Now create a Phar Archive for all those generated Files
php -r "(new Phar('archive.phar', 0, 'archive.phar'))->buildFromDirectory('first');"
ls
# archive.phar


# Check Time taken by PHP Script to access individual File inside Phar Archive
time php -r 'echo file_get_contents("phar://archive.phar/0000693.txt");'
# Hello from 0000693.txt
#
# real  0m0.056s
# user  0m0.048s
# sys   0m0.000s


# Lets create a ZIP Archive for same Directory
zip -r first.zip first/

# Check out, How much size each archive is taking
du -h archive.phar first.zip first/
# 616K  archive.phar
# 1.8M  first.zip
# 40M   first/


# Lets read the same file inside ZIP File
time php -r 'echo file_get_contents("phar://first.zip/first/0000693.txt");'
# Hello from 0000693.txt
#
# real  0m0.198s
# user  0m0.120s
# sys   0m0.068s


Although phar:// wrapper supports reading zip, tar.gz, tar.bz2, phar Archives, i have checked all supported formats, and phar is taking less time to read individual file from archive.

Example - Lets me tell you structure of my app

/app
    /web
        assets/
            jquery
            bootstrap
        index.php
    /cli
        functions.php
        index.php
    /libs
    /vendors
    index.php

Example - Lets create Executable Phar Archive

<?php

# Case 1: When You want to include all Files from GIVEN Directory
// create with alias "project.phar"
$phar = new Phar('project.phar', 0, 'project.phar');
// add all files in the project
$phar->buildFromDirectory(dirname(__FILE__) . '/project');

# You can execute it from Command line or Just run it Using Your web Browser
# final public static string Phar::createDefaultStub ([ string $indexfile [, string $webindexfile ]] )
$phar->setStub($phar->createDefaultStub('cli/index.php', 'www/index.php'));

Example - Using Regex Filter to add matched files into Phar Archive

<?php
# Case 2: When You want to include all PHP (*.php) Files from GIVEN Directory
$phar2 = new Phar('project2.phar', 0, 'project2.phar');
// add all files in the project, only include php files
$phar2->buildFromDirectory(dirname(__FILE__) . '/project', '/\.php$/');
$phar2->setStub($phar->createDefaultStub('cli/index.php', 'www/index.php'));

Example - Create NEW Phar Archive for Given Directory

# Using Phar::buildFromDirectory API
php -r '(new Phar("users_arc.phar", 0, "users_arc.phar"))->buildFromDirectory("/home/ssp/www/app/users");'
# Using Phar::buildFromIterator API
php -r '(new Phar("app_arc.phar", 0, "app_arc.phar"))->buildFromIterator( new RecursiveIteratorIterator( new RecursiveDirectoryIterator("/home/ssp/www/app")), "/home/ssp/www/app");'

Example - How to convert TAR to Phar Archive

We will use PharData class to convert tar to phar Archive
<?php
try {
    $tarphar = new PharData('myphar.tar');
    // convert it to the phar file format
    $phar = $tarphar->convertToExecutable(Phar::PHAR); // creates myphar.phar
    $phar->setStub($phar->createDefaultStub('cli/index.php', 'web/index.php'));
    // Lets Create compressed Phar Archive
    $compressed = $tarphar->convertToExecutable(Phar::TAR, Phar::GZ, '.phar.tgz');
} catch (Exception $e) {
    // handle the error here
}

Example - Convert Phar to ZIP/Tar/TAR.GZ/TAR.BZ2 Archive

php -r '(new Phar("archive.phar"))->convertToData(Phar::ZIP);'
ls
// archive.phar  archive.zip
# To create tar.bz2 Archive
php -r '(new Phar("archive.phar"))->convertToData(Phar::TAR, Phar::BZ2, ".tbz");'

12/31/2015

New* FormGenLib - My JavaScript Library to dynamically Generate HTML Forms (Built-in Support for Bootstrap_v3)

Automatically Generate awesome looking HTML form using minimal JSON options (theme Bootstrap v3)

DEMO
https://shishtpal.github.io/formgenlib/
Released Development Version
contribute to project
Or Request some feature on github

Project is under Development, API may change

Input Types

general
checkbox
file
hidden
radio
select
textarea
text
password

Special Types

List (Allow You to send a list of values)
Set (Choose just one values for a given set of values)
Photo (Upload Photo Widget)
Clearfix
Date
Heading

Form Layouts

Because we are using Underscore Templating Engine, So, We can use Global Functions inside Templates. And some properties are not defined than you can check for them with the help of this special object reference Object.

Memorize Form State

Except Input Type file , Input Fileds can Memorize its State, And to Memorize form State, we are using data-value custom attribute with each input type. And when we render or load saved form from LocalStorage, formgenlib trigger load events, that we used to load value form data-value attribute and inject into that Input Fields.
There is one toolbar to save, clean and load form states.
  • clean - clear LocalStorage
  • save - Save Current Form State to LocalStorage
  • load - Load previously saved form State
    • You can save one state for one form
    • Because we are Using form_key attribute to save Form state into LocalStorage
    • If You want to load saved state from Server (Backend)
    • Then Each Component schema should have either value or values attribute according to their schema.

Example

  • This is sample Javascript code that Generate HTML form for First Time
    • And save to localStorage
  • Next, time Form will loaded from LocalStorage
  • If You want it to re-render HTML Form
    • Then set the value LocalStorage.isClean = "false"
## Example Code

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
var i = new GenerateForm("#form_container");
var form = {
 form_key: "thisForm",
    action: "/apis/testing",
    method: "POST",
    caption: "Testing Simple Html Form",
    id: "mygenform",
    style: "border:2px solid red;",
    schema: [
  {
      type: "heading",
      cont_grid: [12],
      label: "Simple Hello world",
      label_class: " text-center btn-warning btn-sm",
      style: "",
      control_id: "demoworld"
  },
  {
   cont_grid: [12, 6, 4, 3],
   type: "text",
   label: "Name",
   title: "Your Name?",
   name: "name",
   placeholder: "Your Name ?"
  },
  {
   cont_grid: [12, 6, 4, 3],
   type: "text",
   label: "Email",
   title: "Your Email?",
   name: "email",
   placeholder: "Your Email ?",
   autocomplete: true
  },
  {
   cont_grid: [12, 6, 4, 3],
   type: "text",
   label: "Mobile No.",
   title: "Your Mobile No?",
   name: "mobileno",
   placeholder: "Your Mobile no. ?"

  },
  {
            type: "date",
            cont_grid: [12, 6, 4, 3],
            cont_style: "",
            label: "Admission Date",
            title: "Admission Date?",
            name: "admdate",
            control_id: "admdateID",
            style: "",
            placeholder: "01/05/2014",
            value: "05/08/1992"
        },
     {
      type: "clearfix"
     },
     {
      cont_grid: [12, 6, 4],
      type: "select",
      label: "Gender",
      title: "Gender?",
      name: "gender",
      control_id: "genderID",
      items: ["00|Other", "01|Male", "02|Female"]
     },
  {
      cont_grid: [12, 6, 4],
      cont_class: "",
      cont_style: "",
      type: "photo",
      label: "Select Photo",
      title: "Your Photo",
      name: "mypic",
      control_id: "myPhoto",
      img_default: "/_assets/img/elect001.png",
      img_alt: "My Photo",
      img_style: "",
      img_id: "myphotoid",
  },
  {
      cont_grid: [12,6, 4],
      cont_class: "",
      cont_style: "",
      type: "list",
      label: "Likes ?",
      title: "What You likes?",
      name: "likes[]",
      control_id: "mylikes",
      items: ["01|Play", "02|Reading", "03|Game"],
  },
  {
   type: "clearfix"
  },
  {
   cont_grid: [12],
   type: "textarea",
   label: "About me?",
   name: "aboutme",
   control_id: "aboutmeID",
   style: "background:cyan;",
   title: "About me",
   value: "Hello World"
  },
     {
      name: "Click",
      value: "Submit",
      control_id: "formsubmit",
      control_class: "btn-primary btn-block",
      style: "",
      type: "submit"
     }
    ]
};
i.config(form);
i.injectFormCompAsNew();
i.listen();


Checkout Project on Github
Thank You.