Sunday 21 October 2012

How To Batch Convert/Transcode Videos Using VLC Media Player

بسم الله الرحمن الرحيم
In the Name of Allah. The Most gracious, The Most Merciful

Synopsis:


This is a tutorial on how to Transcode and Convert Video Files into MP4 (MPEG-4) format with 1024kbps bitrate using the H.264 Video Codec and the MP3 Audio Codec.

Assumptions and Prerequisites:


  • OS: Microsoft Windows 7
  • VLC Media Player (Version: 2.0.2) is already installed. 
  • Type of Videos: Home Movies.
  • User Level: Administrator
  • Scripting Language: Visual Basic Script (VBS)
  • Working Folder: D:\VLC
  • Script File Path and Name: D:\VLC\vlc.batch.transcode.videos.to.mp4.vbs
  • Source Folder: D:\VLC\Source
  • Target Folder: D:\VLC\Target
  • VLC Program Path:  C:\Program Files (x86)\VideoLAN\VLC 
  • Video Bitrate: 1024kbps
  • Video Container: MP4
  • Video Codec: H.264
  • Audio Codec: MP3
  • Audio Bitrate: 128kbps
  • Audio Channels: 2 (Stereo)
  • Audio Sample Rate: 44100Hz (CD Quality)

Instructions:


1. Download the VLC Script Directory from here and save it on your Computer.

2. Extract the "VLC.rar" file to any Directory of your choice. eg. "D:"

3. Copy the Videos you want to transcode/convert into the "D:\VLC\Source" Folder.

4. Right-Click on  "D:\VLC\vlc.batch.transcode.videos.to.mp4.vbs" file and select "Run with Command Prompt".

5. The new transcoded files will be saved in the Target Folder.

Conclusion:


When the Transcoding is in progress, the VLC Media player window will stay open but no video output will be available and then close after the video has been transcoded. And this will repeat for each video transcoding.

When the Transcoding has been completed, you should see all the video files converted in the Target Folder. Any non-video files (eg. *.JPG) available in the Source Folder will be copied to the Target Folder without any change. When you have verified the files in the Target Folder, you can then go on and delete everything underneath the Source Folder.

If you aspire for  a better video quality, then increase the Video Bitrate(strBitrate) in the D:\VLC\vlc.batch.transcode.videos.to.mp4.vbs file before Transcoding. If you increase the Video Bitrate more than 1024kbps, then you would end up with a larger file size with no significant increase in Video quality and that would defeat the purpose of Transcoding these video files. For home movies recorded with a typical Sony Cybershot or a Canon DSLR camera, the 1024kbps bitrate strikes the perfect balance between quality and smaller file size for the video.

If this Post made your life a lot easier, then please leave a small donation as a token of your appreciation. :-)

Links:

  1. http://episteme.arstechnica.com/eve/forums/a/tpc/f/12009443/m/516001349831
  2. http://wiki.videolan.org/How_to_Batch_Encode 
  3. http://wiki.videolan.org/Transcode
  4. http://taylor.veltrop.com/software/transcode%201.1%20release.vbs
  5. http://www.jaleeltech.com.au/download/VLC.rar


Thursday 11 October 2012

How To Configure Network Setting on CentOS 6.3


بسم الله الرحمن الرحيم
In the Name of Allah. The Most gracious, The Most Merciful

Synopsis:


A short tutorial on how to configure network settings on CentOS 6.3 machine.

Assumptions and Prerequisites:



  • OS: CentOS 6.3 x64
  • Server Name: mujahid
  • Subnet: 192.168.1.0/24
  • Server IP: 192.168.1.20
  • Subnet Mask: 255.255.255.0
  • DNS IP: 192.168.1.15
  • Gateway IP: 192.168.1.1
  • Domain: houseofjaleel.com.au
  • Network Device/Interface: eth0 
  • Text Editor: vi
  • Firewall (IPTables) is disabled.
  • SELinux is disabled.
  • '#' - Script Comment.
  • This machine is a Server; therefore has a fixed IP settings. It is not assigned any network settings from any DHCP or BOOTP service.

Step-by-Step Instructions:


1. Create the network configuration file /etc/sysconfig/network-scripts/ifcfg-eth0 with the following configurations and save it.

DEVICE="eth0"       # Device name
HWADDR="00:0C:29:7D:A0:62"    # eth0's MAC address. This may be different on your machine.  
NM_CONTROLLED="no"   # Settings are not controlled by the Network Manager service. 
BOOTPROTO="none"   # This device does not receive network settings from any dhcp service on the network.
ONBOOT="yes"            # Service starts at boot time.
TYPE="Ethernet"    # Device type is of Ethernet.
IPADDR="192.168.1.20"               # IP Address of this Network device.
NETMASK="255.255.255.0"     # Subnet Mask
GATEWAY="192.168.1.1"         # IP Address to access the Internet (usually it's a Router).
DNS1="192.168.1.15"       # IP Address of the machine hosting the DNS on the LAN.
DOMAIN="houseofjaleel.com.au"     # Name of the Domain this server belongs to. Omit if no domain configured on Network.
IPV6INIT="no"    # ipv6 is not enabled on this server machine.
USERCTL="no"   # Except for root user, users can't alter network setting for this device.


Clean (without comments) version of the file /etc/sysconfig/network-scripts/ifcfg-eth0


DEVICE="eth0"
HWADDR="00:0C:29:7D:A0:62"  
NM_CONTROLLED="no"  
BOOTPROTO="none"  
ONBOOT="yes" 
TYPE="Ethernet"
IPADDR="192.168.1.20" 
NETMASK="255.255.255.0" 
GATEWAY="192.168.1.1" 
DNS1="192.168.1.15" 
DOMAIN="houseofjaleel.com.au" 
IPV6INIT="no" 
USERCTL="no"


2. Restart Network service.
# /etc/rc.d/init.d/network restart

3. Enable Network Service to start at boot time.
# chkconfig network on

4. Check to see if network settings have been loaded from the configuration file for 'eth0'.
# ifconfig

5. Disable ipv6 device driver on this server machine from loading at boot time.
# echo "install ipv6 /bin/true" > /etc/modprobe.d/disable-ipv6.conf 

6. Restart server.
# reboot

 7. Login as root and check network settings. It should show that there is no "inet6" setting anymore.
# ifconfig

Conclusion:


Change the "DNS1" configuration to "127.0.0.1" or "192.168.1.20", if DNS is configured on the local machine.

Use 'DNS2' to add a secondary DNS host (eg. DNS2="192.168.1.16").

IPV6 is outside of the scope of this tutorial.

Tuesday 9 October 2012

How To Install Webmin and Usermin Via The YUM Package Manager On CentOS 6.3

Synopsis:


How To Install Webmin and Usermin via the YUM Package Manager On CentOS 6.3 x64.

Assumptions and Prerequisites:



  • Server IP Address: 192.168.1.11.
  • OS: CentOS 6.3 x64
  • Server Name: tyrion
  • Firewall (IPTables) is disabled.
  • YUM Repository EPEL has already been added. 
  • SELinux is disabled.
  • Text Editor: Nano


Step-by-Step Instructions:


1. Create the Webmin YUM Repo File: /etc/yum.repos.d/webmin.repo with the following configurations and save it.

[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1

2. Import GPG Key from the webmin website.
# rpm --import http://www.webmin.com/jcameron-key.asc

Webmin:


1. Install the required perl module.
# yum -y install perl-Net-SSLeay

2. Install Webmin via YUM.
# yum -y install webmin

3. Edit /etc/webmin/miniserv.conf and add the following line at the end of the file to allow users only from the LAN to be able to login to Webmin.

allow=127.0.0.1 192.168.1.0/24

4. Restart the Webmin service.
# /etc/rc.d/init.d/webmin restart


Usermin:


1. Install the required perl module.
# yum --enablerepo=epel -y install perl-Net-SSLeay perl-Authen-PAM

2. Install Usermin via YUM.
# yum -y install usermin

3. Edit /etc/usermin/miniserv.conf and add the following lines at the end of the file to allow users only from the LAN to be able to login to Webmin.

allow=127.0.0.1 192.168.1.0/24
denyusers=root


4. Restart the Usermin service.
# /etc/rc.d/init.d/usermin restart


Conclusion:


Webmin:

Open browser and go to https://192.168.1.11:10000 and login as 'root'.

If you have DNS configured, then https://tyrion:10000 will also work in the browser. And if you are on the same machine, then https://localhost:10000 will also work in the browser.


Usermin: 

Open browser and go to https://192.168.1.11:20000 and login as any user except root because root user has been disabled for usermin.


If you have DNS configured, then https://tyrion:20000 will also work in the browser. And if you are on the same machine, then https://localhost:20000 will also work in the browser.

How To Add Additional YUM Repositories In CentOS 6.3

Synopsis:


This is a tutorial on how to add 2 additional YUM repositories, RPMForge and EPEL on CentOS 6.3 x64.

Assumptions and Prerequisites: 





Step-by-Step Instructions:


RPMForge:

1. Import GPG Key for the RPMForge package.
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

2. Verify RPM package with GPG Key.
# rpm -K http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

3. Install RPM package for RPMForge YUM repository.
# rpm -i http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

EPEL:


1. Import GPG Key for the EPEL package.
# rpm --import  http://mirror.optus.net/epel/RPM-GPG-KEY-EPEL-6

2. Verify RPM package with GPG Key.
# rpm -K http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm

3. Install RPM package for EPEL YUM repository.
# rpm -i http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm

Conclusion:


After adding the RPMForge and EPEL YUM Repositories, you can install packages such as "htop" and "nano" via the YUM Package manager.

In order to add the EPEL and RPMForge Repositories for the x86(32 bit), you have to locate and install the 32 bit version from their respective mirrors.

How To Install and Configure DHCP Server on CentOS 6.3

Synopsis:


A short tutorial on how to Install and Configure a DHCP Server on CentOS 6.3 x64, listening on the "eth0" Interface only.

Assumptions and Prerequisites:


  • OS: CentOS 6.3 x64.
  • Server Name: mujahid
  • DNS IP: 192.168.1.10
  • IPv6 is disabled.
  • SELinux is disabled.
  • Firewall (IPTables) is disabled.
  • Subnet: 192.168.1.0/24
  • Domain: houseofjaleel.com.au
  • Gateway (Router IP Address): 192.168.1.1
  • Text Editor: Nano
  • Dynamic DNS (DDNS) is not enabled.

Step-by-Step Instructions:


1. Install the DHCP Package via a terminal.
# yum -y install dhcp

2. Edit file /etc/dhcp/dhcpd.conf with "nano" editor and write the following configuration:


# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#


# This DHCP server to be declared valid
authoritative;

# Subnet 192.168.1.0/24
subnet 192.168.1.0 netmask 255.255.255.0 {

# default gateway
option routers 192.168.1.1;

# domain name
option domain-name "houseofjaleel.com.au";

# DNS's hostname or IP address
option domain-name-servers 192.168.1.10;

# range of lease IP address
range dynamic-bootp 192.168.1.2 192.168.1.254;

# default lease time
default-lease-time 600;

# max lease time
max-lease-time 7200;

# broadcast address
option broadcast-address 192.168.1.255;

##### Reserved Hosts #####

# Router
host router {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.1;
}

# Farooq
host farooq {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.10;
}

# Tariq
host tariq {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.11
}

# Humaira
host humaira {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.12;
}

# Khalid
host khalid {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.13;
}

# Asim
host asim{
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.14;
}

# Mujahid
host mujahid{
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.15;
}

# Amir
host amir{
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.16;
}

# Muneera
host muneera{
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.17;
}

# Atif
host atif{
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.18;
}

} # end of Subnet 192.168.1.0/24

3. edit file /etc/sysconfig/dhcp to make sure the DHCP service is listening on the relevant Interface (eth0).
# nano /etc/sysconfig/dhcp
eg.
DHCPDARGS="eth0"  

4. Start DHCP at boot.
# chkconfig dhcpd on

5. Start the DHCP service.
# /etc/rc.d/init.d/dhcpd start

How To Install and Configure DNS (Bind) on CentOS 6.3

Synopsis:


A short tutorial on how to Install and Configure a DNS service on CentOS 6.3 x64 using Webmin.

Assumptions and Prerequisites:


  • OS: CentOS 6.3 x64.
  • Server Name: tyrion
  • The Server [tyrion] hosts all services on the same machine (e.g. DHCP, Postfix, HTTP, and FTP).
  • Webmin is already installed and the DNS configuration will be done via Webmin.
  • The DNS for both internal (LAN) and external (WAN) IPs will be hosted on the same Server Machine.
  • There are no DNS Slaves.
  • IPv6 is disabled.
  • Firewall (IPTables) is disabled.
  • SELinux is disabled.
  • Subnet: 192.168.1.0/24
  • Domain: kingslanding.com.au
  • WAN IP: 110.92.81.14
  • Gateway (Router IP Address): 192.168.1.1
  • Local ISP (TPG) DNS are used as forwarders. (203.12.160.35 and 203.12.160.36) 
  • DHCP is installed and a couple of IP addresses are reserved.
  • Dynamic DNS is not enabled for the DHCP Server.
  • Text Editor: Nano
  • Server Location: Melbourne, Australia.

Step-by-Step Instructions:


1. Install DNS packages. Run the following command in terminal.
# yum -y install bind bind-utils

2. Disable IPV6 for the named deamon
# echo 'OPTIONS="-4"' >>  /etc/sysconfig/named

3. Configure Bind (named) via Webmin

4. Create views "lan" and "wan". "lan" is for internal clients i.e. Private Machines. "wan" is for external clients that reside outside the router i.e. Internet.

5. Move all the zones to "lan" i.e. "Root Zone", "0", "127.0.0.1", "localhost", "localhost.localdomain". 
 a. Set "allow queries" to "localhost" and "192.168.1.0/24" under "Zone Defaults".
 b. Add 203.12.160.35 and 203.12.160.36 to "Forwarders and Transfers".
 c. Comment out "Listen on port 53 {127.0.0.1;}" because we want the 'named" service to listen on all interfaces.
 d. Set "listen-on-v6 port 53" to 'none' because we are not using IPv6.
 e. Set "recursion" to 'yes' because we want all devices on the LAN to be able to list all the devices listed on the DNS service.

 f. Set "recursion" to 'no' only for the "wan" view because we don't want users from the Internet to find out the IP addresses of our local machines on the LAN.   

6. Create Master Zone "kingslanding.com.au" of Forward type in the "lan" view with the following details:
 a. Domain = kingslanding.com.au
 b. Master server = tyrion.kingslanding.com.au
 c. Tick "Add NS record for Master Server".
 d. Enter Email address "root@kingslanding.com.au"
 e. Select "Use zone template".

7. Add "Address (A)" record "kingslanding.com.au." -> 192.168.1.11

8. Add "Mail (MX)" record "kingslanding.com.au." -> "tyrion.kingslanding.com.au." with 10 priority.

9. Add "Address (A)" record "tyrion" -> 192.168.1.11

10. Add "Alias (CNAME)" record "mail" -> "kingslanding.com.au."

11. Add "Alias (CNAME)" record "www" -> "kingslanding.com.au." 

12. Add "Alias (CNAME)" record "ftp" -> "kingslanding.com.au." 

13. Add "Address (A)" record "jamie" -> 192.168.1.12

14. Add "Address (A)" record "tywin" -> 192.168.1.10

15. Add "Address (A)" record "cersei" -> 192.168.1.13

16. Add "Address (A)" record "joffery" -> 192.168.1.14

17. Create Master Zone "192.168.1" of Reverse type in the "lan" view with the following details:
 a. Domain name / network = 192.168.1
 b. Master Server = tyrion.kingslanding.com.au
 c. Tick "Add NS record for Master Server".
 d. Enter Email address "root@kingslanding.com.au"
 e. Select "Use zone template".

18. Add "Reverse Address (PTR)" record "192.168.1.11" -> "tyrion.kingslanding.com.au."

19. Add "Reverse Address (PTR)" record "192.168.1.10" -> "tywin.kingslanding.com.au."

20. Add "Reverse Address (PTR)" record "192.168.1.12" -> "jamie.kingslanding.com.au."

21. Add "Reverse Address (PTR)" record "192.168.1.13" -> "cersei.kingslanding.com.au."

22. Add "Reverse Address (PTR)" record "192.168.1.14" -> "joffery.kingslanding.com.au."

23. Create Master Zone "kingslanding.com.au" of Forward type in the "wan" view with the following details:
 a. Domain = kingslanding.com.au
 b. Master server = tyrion.kingslanding.com.au
 c. Tick "Add NS record for Master Server".
 d. Enter Email address "root@kingslanding.com.au"
 e. Select "Use zone template".

24. Add "Address (A)" record "kingslanding.com.au." -> "110.92.81.14"

25. Add "Address (A)" record "tyrion.kingslanding.com.au." -> "110.92.81.14"

26. Add "Mail (MX)" record "kingslanding.com.au." -> "kingslanding.com.au." with 10 priority.

27. Add "Alias (CNAME)" record "www" -> "kingslanding.com.au."

28. Add "Alias (CNAME)" record "ftp" -> "kingslanding.com.au."

29. Add "Alias (CNAME)" record "mail" -> "kingslanding.com.au."

30. Add "Alias (CNAME)" record "ns1" -> "kingslanding.com.au."

31. Add "Alias (CNAME)" record "ns2" -> "kingslanding.com.au."

32. Add "Alias (CNAME)" record "vpn" -> "kingslanding.com.au."

33. Create Master Zone "110.92.81.14" of Reverse type in the "wan" view with the following details:
 a. Domain name / network = 110.92.81.14
 b. Master Server = tyrion.kingslanding.com.au
 c. Tick "Add NS record for Master Server".
 d. Enter Email address "root@kingslanding.com.au"
 e. Select "Use zone template".

34. Install DNS (Bind) as CHROOT
# yum -y install bind-chroot

35. Enable named (DNS) service to start at boot.
# chkconfig named on

36. Start named service
# /etc/rc.d/init.d/named start

37. Edit /etc/resolv.conf file to have the local machine use the local DNS service to resolve host names.
eg:
search kingslanding.com.au
nameserver 127.0.0.1

38. Also edit your network startup scripts, usually that's where the network configuration is written to in /etc/resolv.conf
eg. File: /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
BOOTPROTO="none"
HWADDR="00:2B:34:01:FB:82"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR="192.168.1.11"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
DOMAIN="kingslanding.com.au"
DNS1="127.0.0.1"
IPV6INIT="no"
USERCTL="no"


39. Switch off DNS and DHCP on your Router. On your router, forward port 53 to 192.168.1.11 so that your DNS host provider has access to your DNS server to update it's records.

40. Restart your Network service.
# /etc/rc.d/init.d/network restart


Conclusion:


Use the "dig" tool to test the DNS service on your server.

In order to have the users from the Internet to be able to access kingslanding.com.au, you will have to have your DNS server linked to a Web and DNS hosting service provider. Personally, I use Zone Edit as my DNS hosting provider and Digital Pacific as my Web Domain Service Provider.

It takes up to 2 - 24 hours for the DNS Root servers to update their records to sync your DNS server records. So, be patient.