Sunday, 17 January 2016

Ever Wanted to Make Your Photos Look More Professional? My favorite android image editors

My friend recently asked me for a recommendation on on an image editor for android. He wanted to primarily use for improving the looks of some of his photos.

I quickly tried several editors based on other reviews. And here is my conclusion.

  1. First off I tried Bonfire.

Pros
  • It has lots of great features and has nice sliders (friendly user interface) for adjusting lots of the filters
  • In my opinion has all you need for improving the look of your photos
  • Lots of effects
Cons
  • Once it came to saving photos I was disappointed. It doesn't save the image in the original resolution, but saves them based on your settings which you can set up to 6144x6144, but who wants to save there photos in higher resolution than the original.
 You can get it from playstore here: https://play.google.com/store/apps/details?id=com.gogoinv.bonfire.android


  2. Next I tried Fotor

Pros
  • Like bonfire it has lots of filters and effects
  • All you need for improving your photos
Cons
  • The user interface isn't as friendly as bonfire's. It doesn't have sliders to adjust the filters.
Get it from Google play here: https://play.google.com/store/apps/details?id=com.everimaging.photoeffectstudio


  3. Finally I tried Snapseed. My favorite of them all

Pros
  • The best user interface in my opinion (No clutter at all).
  • Has all the filters you need to improve your photos
  • Plenty of effects
  • Can edit raw photos
Cons
  • May not have as many filters and effects as some other editors 
Get it form Google play here: https://play.google.com/store/apps/details?id=com.niksoftware.snapseed 


  4. An editor that I've used a lot before I tried new/different editors is the one called Image Editor

Pros
  • Supports layers
  • Multiple tabs/projects
  • Plenty of filters
  • Can do the usual canvas or free layer manipulation
Cons
  • For adjusting the filters it doesn't have the best interface (no sliders)
Get it from Google play here: https://play.google.com/store/apps/details?id=com.pcvirt.ImageEditor


Thanks for reading this short review.

Leave a comment if you have any suggestions or for other reasons.

Need a Good Free Video Editor? Shotcut video editor review

Note: This is not necessarily the best open source video editor, but it's definitely my favorite.

I have been looking around for a good video editor for quite some time before I ended up with shotcut. I won't be going into the details of shotcut as the features can be found on it's website. I'll just be describing what I think are the pros and cons of the video editor.

Pros
  • Supports lots of audio, video, and image formats thanks to ffmpeg
  • It's being actively developed and keeps on getting new features (see the roadmap)
  • Has many video filters
  • The filters are easy to use (In my opinion much easier than openshot or kdenlive's filters)
  • Cross-platform (Linux, Windows, OS X)
  • No need to import media - Native editing
  • Very flexible UI using QT. Can be customized to your liking
  • It's faster (less lag) than some other editors I've tried
Cons
  • It may still crash at times although in my opinion it's fairly stable already (Just make sure you save your project frequently)
  • No keyframe-able video filters although it's planned for a future release

I ended up with shotcut since the chroma key filter is really easy to use and powerful (much easier than kdenlive's chroma key filter). Another thing I like about it is the speed control of a video changes the speed of the audio as well whereas in kdenlive it'll remove the audio when modifying video speed.

The color grading feature is also really simple to use and powerful and is a must have in any video editor. I use it in about every project. It can really make your video look a lot more professional.

Here is an example of before and after applying color grading:



And a screenshot of shotcut with the color grading filter settings open:




That's it for now. I know this is a really short review, but this is my first video editor review and I'm still learning.

Feel free to leave a comment.

Friday, 4 December 2015

All You Need to Compress Videos on Android

Warning: Compressing videos on android devices can take a long time.

Download and install the FFmpeg Media Encoder from Google Play

Here's an example screenshot:



It's pretty straight forward to use. Select an input file then an output file and format. Next you'll want to select a template or create your own.
My templates:
240p veryfast (mp4):
-vf scale='-2:240' -preset veryfast -strict -2
360p veryfast (mp4):
-vf scale='-2:360' -preset veryfast -strict -2
480p veryfast (mp4):
-vf scale='-2:480' -preset veryfast -strict -2
720p veryfast (mp4):
-vf scale='-2:720' -preset veryfast -strict -2
1080p veryfast (mp4):
-vf scale='-2:1080' -preset veryfast -strict -2
veryfast (mp4):
-preset veryfast -strict -2
Explanation of the options I used.

-vf scale='-2:240' -vf stands for video filter and the video filter we are applying is scale='-2:240'. The -2 automatically calculates the width based on the height to an even number. If we used -1 instead of -2 it would calculate it to the exact whole number but this could result in an error because the codec (we didn't specify a codec, but the default for mp4 is H.264) we are using has to have even numbers for width and height. The 240 is pretty straight forward; it sets the height of the video to 240 pixels.

-preset veryfast -preset option is to set a preset for H.264 encoding. The general guideline is to use the slowest preset that you have patience for which will lead to a smaller file size. Current presets in descending order of speed are: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow. The default preset is medium.

-strict -2 -strict experimental or -strict -2 option is needed to encode audio to aac.

Thursday, 4 December 2014

Configuring Theme for GTK applications on Archlinux with Plasma 5

There are two packages available to configure gtk applications to have oxygen theme: kde-gtk-config and kde-gtk-config-frameworks from aur.
You will also want to install oxygen-gtk2 and oxygen-gtk3 themes available in the arch repositories.
To configure the themes for gtk applications run the following command for kde-gtk-config:
kcmshell4 kde-gtk-config
For kde-gtk-config-frameworks
kcmshell5 kde-gtk-config
Basically kde-gtk-config-frameworks is built for kf5 and kde-gtk-config is for kde4. I use kde-gtk-config on plasma5 since it is in the arch repositories.
Note: to configure the theme of root gtk applications run the previous commands with kdesu.
Another thing to note is that the configuration files don't get created automatically so even if kde-gtk-config shows that it's configured gtk applications to use oxygen-gtk theme it might not be. Therefore change the themes for gtk2 and gtk3 applications to something else and apply then change it back oxygen-gtk if you wish.

Saturday, 22 November 2014

Archlinux with Plasma 5 installation

last updated: Feb. 23, 2015

First Connect to the internet
Next is partitioning and mounting
After that installing
Note: in partitioning and mounting step you should have mounted the partition you want to have as root on /mnt for the following commands to be right:
Install the basic packages you want to the new root. In my case its the following which installs archlinux and plasma 5 with sddm desktop display manager:
# pacstrap -i /mnt base base-devel sddm plasma
Generate an fstab
# genfstab -U -p /mnt >> /mnt/etc/fstab
Make sure fstab looks right
# nano /mnt/etc/fstab

Chroot and configure the base system

# arch-chroot /mnt /bin/bash
Locale
Edit locale.gen and uncomment en_US.UTF-8 UTF-8
nano /etc/locale.gen
Generate the locale(s) specified in /etc/locale.gen:
# locale-gen
Create the /etc/locale.conf file substituting your chosen locale:
# echo LANG=en_US.UTF-8 > /etc/locale.conf
Export substituting your chosen locale:
# export LANG=en_US.UTF-8
Create a symbolic link /etc/localtime to your subzone file /usr/share/zoneinfo/Zone/SubZone using this command:
# ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime
I use:
# ln -s /usr/share/zoneinfo/America/Belize /etc/localtime
Hardware clock
Use either UTC (recommended):
# hwclock --systohc --utc
localtime (discouraged; used by default in Windows):
# hwclock --systohc --localtime
Hostname
# echo myhostname > /etc/hostname
Add the same hostname to /etc/hosts:
# nano /etc/hosts

---------------------------------------------------
#
# /etc/hosts: static lookup table for host names
#

#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost myhostname
::1  localhost.localdomain localhost

# End of file
Set the root password
Set the root password with:
# passwd
Install and configure a bootloader
I use either syslinux or grub.
See syslinux or grub for details or check the beginners guide

Users and groups Add a user. examples:
# useradd -m -G wheel -s /bin/bash archie
# useradd -m -g users -G wheel -s /bin/bash archie
Give the user a password:
passwd archie
Add user info
# chfn archie
Read more about users and groups here.
To be able to run commands with sudo uncomment %wheel ALL=(ALL) ALL from the /etc/sudoers file:
# nano /etc/sudoers
-----------------------------------------------------------------------
## Uncomment to allow members of group wheel to execute any command
 %wheel ALL=(ALL) ALL
Display server
Install xorg-server:
# pacman -S xorg-server
Display Driver
First, identify your card:
$ lspci | grep VGA
Note: if you don't get any output, try looking for a 3D controller instead:
# lspci | grep 3D
Then install an appropriate driver. You can search the package database for a complete list of open-source video drivers:
# pacman -Ss xf86-video
Or check this page.
You might also want to install touchpad drivers if you have laptop.
# pacman -S xf86-input-synaptics 
Finishing Up the Installation
Some things you'll probably want to install before you reboot into your new installation is a browser, terminal, and also kmix (sound aplet in system tray). I chose firefox for browser and konsole for a terminal.
# pacman -S firefox kdemultimedia-kmix konsole
Enable SDDM and NetworkManager with:
# systemctl enable sddm; systemctl enable NetworkManager
Exit out of chroot:
# exit
Unmount partitions:
# umount -R /mnt
Reboot:
# reboot
Additional Packages
You might want to install additional packages example:
$ sudo pacman -S kdebase-dolphin kdemultimedia-ffmpegthumbs kdegraphics-thumbnailers exfat-utils fuse-exfat ntfs-3g kio-mtp dosfstools gparted thunderbird firefox ktorrent smplayer amarok gstreamer0.10-plugins kate gimp kdegraphics-okular gwenview digikam blender kdenlive p7zip unrar unzip zip cups cups-pdf gutenprint system-config-printer flashplugin networkmanager-openvpn openssh libreoffice hunspell hunspell-en k3b cdrdao dvd+rw-tools oxygen-gtk3 oxygen-gtk2 wget ntp firefox-adblock-plus
For the thumbnailers to be used you need to configure it in dolphin
Cups and ssh you need to enable yet with:
$ sudo systemctl enable org.cups.cupsd; sudo systemctl enable sshd
Then reboot or run the following command for it to work:
$ sudo systemctl start cups; sudo systemctl start sshd
You might want to install additional printer drivers:
$ sudo pacman -S gutenprint foomatic-db foomatic-db-engine foomatic-db-nonfree hplip splix foo2zjs
Speed Up applications startup in kde
User Rob wrote on his blog this "magic trick" to improve application start-up time by 50-150ms. To enable it, create this folder in your home:
$ mkdir -p ~/.compose-cache/
Install extra fonts
$ sudo pacman -S ttf-bitstream-vera ttf-dejavu ttf-freefont ttf-linux-libertine ttf-oxygen ttf-droid ttf-liberation ttf-ubuntu-font-family


My combined bash history of installing Arch Linux and Plasma 5 with additional applications:
Note: do not copy/paste the following commands unless you know what you're doing.
ping google.com
lsblk
fdisk /dev/sda
mkswap /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
swapon /dev/sda1
mount /dev/sda2 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
pacstrap -i /mnt base base-devel sddm plasma-next
genfstab -U -p /mnt >> /mnt/etc/fstab
nano /mnt/etc/fstab
arch-chroot /mnt /bin/bash
nano /etc/locale.gen
locale-gen 
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8
ln -s /usr/share/zoneinfo/America/Belize /etc/localtime
hwclock --systohc --utc
echo jeromy-lenovo > /etc/hostname
nano /etc/hosts
passwd
pacman -S gptfdisk syslinux
syslinux-install_update -iam
nano /boot/syslinux/syslinux.cfg
useradd -m -G wheel -s /bin/bash jeromy
passwd jeromy
chfn jeromy
nano /etc/sudoers
pacman -S xorg-server xf86-video-intel
nano /etc/sddm.conf
systemctl enable sddm; systemctl enable NetworkManager
pacman -S konsole firefox kdemultimedia-kmix
pacman -S pulseaudio-alsa libcanberra-pulse
exit
umount -R /mnt
reboot
sudo pacman -S kdebase-dolphin kdemultimedia-ffmpegthumbs kdegraphics-thumbnailers exfat-utils fuse-exfat ntfs-3g kio-mtp dosfstools gparted thunderbird firefox ktorrent smplayer amarok gstreamer0.10-plugins kate gimp kdegraphics-okular gwenview digikam p7zip unrar unzip zip cups cups-pdf gutenprint system-config-printer flashplugin networkmanager-openvpn openssh libreoffice hunspell hunspell-en k3b cdrdao dvd+rw-tools oxygen-gtk3 oxygen-gtk2 wget ntp firefox-adblock-plus
sudo systemctl enable org.cups.cupsd; sudo systemctl enable sshd
sudo systemctl start org.cups.cupsd; sudo systemctl start sshd
sudo pacman -S ttf-bitstream-vera ttf-dejavu ttf-freefont ttf-linux-libertine ttf-oxygen ttf-droid ttf-liberation ttf-ubuntu-font-family
cd /tmp
curl -O https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz
tar zxvf package-query.tar.gz
cd package-query
makepkg -si
cd ..
curl -O https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz
tar zxvf yaourt.tar.gz
cd yaourt
makepkg -si
yaourt -S dropbox
reboot

Tuesday, 19 August 2014

Downloading with curl showing zenity GUI progress bar

Below is a simple command to show a GUI progress bar while downloading with curl command:
curl -o "big.iso" "http://domain.com/big.iso" 2>&1 | stdbuf -oL tr '\r' '\n' | sed -u 's/^ *\([0-9][0-9]*\).*\( [0-9].*$\)/\1\n#Download Speed\:\2/' | zenity --progress --title "Downloading"
Here is an example of how it might look:

Friday, 15 August 2014

Ubuntu Open VPN Server setup behind NAT using tun

This may not necessarily  be a better guide than from where I got this information but I was having a hard time with including multiple machines on the server side when using a routed VPN server (dev tun) behind a NAT so I created this guide. Fore most other cases the official docs are a better sources for information.

Information gathered from https://help.ubuntu.com/12.04/serverguide/openvpn.html
and from https://openvpn.net/index.php/open-source/documentation/howto.html

First install openvpn:
sudo apt-get install openvpn

Public Key Infrastructure Setup

The first step in building an OpenVPN configuration is to establish a PKI (public key infrastructure). The PKI consists of:
  • a separate certificate (also known as a public key) and private key for the server and each client, and
  • a master Certificate Authority (CA) certificate and key which is used to sign each of the server and client certificates.
Certificate Authority (CA) Setup:
first change to root:
sudo su
Now make the folder where we'll do the server configuration:
mkdir /etc/openvpn/easy-rsa/
Now copy the openvpn example configuration and setup scripts:
cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0/* /etc/openvpn/easy-rsa/
Next, edit /etc/openvpn/easy-rsa/vars adjusting the following to your environment:
export KEY_COUNTRY="US"
export KEY_PROVINCE="NC"
export KEY_CITY="Winston-Salem"
export KEY_ORG="Example Company"
export KEY_EMAIL="steve@example.com"
Run the following commands to generate the master Certificate Authority (CA) certificate and key:
cd /etc/openvpn/easy-rsa/
source vars
./clean-all
./build-ca
Server Certificates:
Next, we will generate a certificate and private key for the server:
./build-key-server myservername
You will get two queries: "Sign the certificate? [y/n]" and "1 out of 1 certificate requests certified, commit? [y/n]" answer both with y.

Diffie Hellman parameters must be generated for the OpenVPN server:
./build-dh
The keys have been generated to a subdirectory of "keys/". A common practice is to copy them to /etc/openvpn/ folder:
cd keys/
cp myservername.crt myservername.key ca.crt dh2048.pem /etc/openvpn/
Note: the dh2048.pem file name might be dh1024.pem depending what the default is or what bit keys you generated.

Client Certificates:

The client will also need certificates to authenticate itself to the server.
to create the certificate and key for client1 run the follow commands as root:
cd /etc/openvpn/easy-rsa/
source vars
./build-key client1
Copy the following files to the client using a secure method:
  • /etc/openvpn/ca.crt
  • /etc/openvpn/easy-rsa/keys/client1.crt
  • /etc/openvpn/easy-rsa/keys/client1.key
Since the client certificates and keys are only required by the client it might be a good idea to remove them from the server.

Simple Server Configuration
Copy the example server configuration file and unpack it from /usr/share/doc/openvpn/examples/sample-config-files/:
sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/
sudo gzip -d /etc/openvpn/server.conf.gz
Edit /etc/openvpn/server.conf to make sure the following lines are pointing to the certificates and keys you created in the section above.
ca ca.crt
cert myservername.crt
key myservername.key 
dh dh2048.pem #Note this might be dh1024.pem
Now start the server. You will find logging and error messages in your syslog.
root@server:/etc/openvpn# service openvpn start
 * Starting virtual private network daemon(s)...
   *   Autostarting VPN 'server'                     [ OK ]
Now check if OpenVPN created a tun0 interface:
root@server:/etc/openvpn# ifconfig tun0
tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.8.0.1  P-t-P:10.8.0.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
[...]
Simple Client Configuration
Copy the example client configuration file to the same location on the client computer as you did the previous client files (ca.crt client1.crt client1.key). The example configuration file is at /usr/share/doc/openvpn/examples/sample-config-files/client.conf. For windows you'll probably want to rename the file to client1.ovpn instead of client1.conf.

The openvpn gui program on windows looks for the configuration files in C:\Program Files\OpenVPN\config by default so that's probably where you want to place them once you've done editing the configuration file.

On Ubuntu you'll probably want to create a hidden .vpn folder in your home directory and place all the client files into the directory. Also if you're using network manager on Ubuntu install the openvpn network manager plugin to be able to use openvpn configuration files with networkmanager.
sudo apt-get install network-manager-openvpn
Other distros will have similar packages for network manager that you can install.

For more client implementations check the following article:
https://help.ubuntu.com/12.04/serverguide/openvpn.html#openvpn-client-implementations

The minimal  changes you need to make in the example configuration are as follows. Make sure they keyword client is in the configuration file and that the file has the correct OpenVPN server name or address:
client
remote vpnserver.example.com 1194
And also make sure your client.conf or client.ovpn (if you renamed it already) has the following pointing to your client certificates and keys.
ca ca.crt
cert client1.crt
key client1.key
Now import your vpn configuration file from network manager gui and try connecting or if you're using another OS or a different client implementation it will be different. For different implementations check here. If you're behind a NAT you'll be unable to connect as well so continue to the next step.

Behind NAT Configurations

Basically all that you need to do in the gateway (The gateway may be your router) is forward port 1194 or whatever port you chose in the configuration files to your OpenVPN server. You will want a static IP address for your server. Next allow the port through your firewall on both the gateway and OpenVPN server.

Including multiple machines on the server side when using a routed VPN (dev tun)
First, you must advertise your subnet to VPN clients as being accessible through the VPN. In this case we will assume that your subnet is 10.66.0.0/24 and the VPN IP address pool uses 10.8.0.0/24. This can easily be done with the following server-side config file directive:
push "route 10.66.0.0 255.255.255.0"
Note: if your IP address is 192.168.1.10 your subnet is probably 192.168.1.0/24. Another thing if this is you subnet on server you should probably change it since it's a common subnet therefore there might be routing conflicts with client.
On linux you can check you subnet with ip command:
$ ip route
default via 192.168.1.1 dev br0
192.168.1.0/24 dev br0  proto kernel  scope link  src 192.168.1.10
Next you need to set up a static route on the gateway to route the client subnet (10.8.0.0/24) to your OpenVPN server.
Note: there might might be separate field to enter netmask for example
192.168.0.0/24 would be written as 192.168.0.0, netmask 255.255.255.0
See more information here. http://en.wikipedia.org/wiki/Subnetwork

The last step is to enable IP and TUN/TAP forwarding on the OpenVPN server.

On the server run the following command to enable IP forwarding:
echo 1 > /proc/sys/net/ipv4/ip_forward
And the following commands to allow TUN forwarding on iptables (firewall).
Allow TUN interface connections to OpenVPN server:
iptables -A INPUT -i tun+ -j ACCEPT
Allow TUN interface connections to be forwarded through other interfaces
iptables -A FORWARD -i tun+ -j ACCEPT
Also make sure that your network interface is in promiscuous mode.
$ netstat -i
Kernel Interface table
Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500 0    651606      0      9 0        430319      0      0      0 BMRU
lo        65536 0     73440      0      0 0         73440      0      0      0 LRU
tun0       1500 0         0      0      0 0             0      0      0      0 MOPRU
The P flag is for promiscuous mode.