Transcode Videos with VLC

Pick up a video, any video and run it on VLC.

Go to Tools->Codec information and check the video and audio codecs.

If you want to change containers, for eaxmple from PS/VOD to TS, you will only need to demux and mux into a new container. But if there’s a weird audio codec for example, you might need to transcode the audio and can actually copy the video.

So Open VLC and then

  1. Multimedia->Convert/save
  2. Open the File you want to convert
  3. Click Convert/Save for next
  4. Select a TS profile
  5. Edit that profile
  6. Go to video and select “Keep the original video” to keep the original video content.
    • Beware that video codec needs to be compatible with TS containers in order to copy, instead of transcode
  7.  Go to audio and check if its configured for transcoding
  8. Save
  9. Select output file
  10. Press begin

And that’s all. VLC will start “Streaming” meaning, its remuxing, transcoding your file into the destination file.

Running Kernel 3.19 in Matrix TBS2910

Here we go again.

After successfully installing u-boot we can now move to the real deal, that is, building a minimum working system. Bare in mind that these are manual learning procedures and nothing more. I’m learning as I go, so keep in mind that many things might be done a different, yet better way(e.g. YOCTO). This was done purely for learning purposes.

TBS_Matrix_Board

Requisites:

  • Matrix TBS2910 (mine V2.1)
  • Mini USB cable for the OTG
  • TTL-232R-3V3 for the UART
  • Recent Linux Debian based environment (e.g Ubuntu 14.04)
  • Git/Compilation skills
  • Ethernet Cable
  • TFTP Server (e.g. tftp-hpa)

Again no need for a TFTP server.

Buildroot

Buildroot lets you create a complete Linux system to put on top of our kernel. The buildroot actually installs a ARM TOOLCHAIN that you can use later.

wget http://buildroot.uclibc.org/downloads/buildroot-2014.11.tar.gz
tar -zxvf buildroot-2014.11.tar.gz
cd buildroot-2014.11

make menuconfig

Now Select the following options

  • Target ARM (Little-Endian)
  • Target Cortex A-9
  • Under toolchain: enable large file support and WCHAR
  • Under System Configuration, chose ttymxc1 as the “Port to run a getty (login prompt) on”
  • Under Package Selection:Hardware, enabled dosfstools and e2fsprogs
  • Under Filesystem Images, selected Output cpio – gzipped
make busybox-menuconfig
# Exit without doing nothing. Just to save

export ARCH=arm
make V=1 2>&1|tee make.out
ls output/images/
export PATH=$PATH:/path/to/u-boot/tools

There is no need to wrap buildroot for u-boot, because instead we can add it to our uImage itself.

GCC toolchain will be created under ./output/host/opt/ext-toolchain/bin/.
ROOTFS image will be created under ./output/images/rootfs.cpio.gz


Kernel 3.19

wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.19.tar.xz
tar -zxvf linux-3.19.tar.xz
export ARCH=arm
# You can point to recently created buildroot toochain
export CROSS_COMPILE=arm-linux-gnueabi-
make distclean
make imx_v6_v7_defconfig
make

Before we create the uImage, we need to edit .config and add the following lines.


CONFIG_INITRAMFS_SOURCE="/path/to/buildroot/output/images/rootfs.cpio.gz"
CONFIG_INITRAMFS_ROOT_UID=0
CONFIG_INITRAMFS_ROOT_GID=0

After that:

# Export u-boot tools path in order to get mkImage
export PATH=$PATH:/path/to/u-boot/tools
make uImage LOADADDR=0x10800000

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
  Image arch/arm/boot/uImage is ready

#Finally compile Device Tree Binary
make dtbs imx6q-tbs2910.dtb

U-Boot Fix

In order to get u-boot to accept a uImage larger than 8MB you need to add a smal detail to tbs2910.h in the u-boot source.

+#define CONFIG_SYS_BOOTM_LEN (16 << 20)

Don’t forget to compile and install u-boot again. You can check my patch in order to get a update_uboot command in order to get somethings done automatically.

Now place all your files in the TFTP server.

Loading Kernel in RAM

How to change Matrix TBS2910 U-Boot

This tutorial exposes all the underlying work needed to flash a new u-boot into a Matrix TBS2910. You can use this knowledge and compile your own u-boot.imx with all these included, just in case.

TBS_Matrix_Board

Requisites:

  • Matrix TBS2910
  • Mini USB cable for the OTG
  • TTL-232R-3V3 for the UART
  • Recent Linux Debian based environment (e.g Ubuntu 14.04)
  • Git/Compilation skills
  • Ethernet Cable
  • TFTP Server (e.g. tftp-hpa)

In this case you won’t need a DHCP server because you can choose to program your own IP addr.

Install iMX USB loader

git clone https://github.com/boundarydevices/imx_usb_loader.git
cd imx_usb_loader
make
sudo make install

Compile U-boot

git clone git://git.denx.de/u-boot-imx.git
cd u-boot-imx
make distclean
make tbs2910_config

Before compiling, you need a cross compiling GCC version. Look for the ones available to you.

apt-cache search arm-linux-gnuabi-gcc

Makefile will be looking for the arm-linux-gnueabi-gcc compiler.

export CROSS_COMPILE=arm-linux-gnueabi-
export ARCH=arm
make

If everything goes well you should have a u-boot.imx file now available. All you need now is to load that file into the Matrix.

  • Turn off the device
  • move switch to Update/Burn mode
  • plug USB and UART cables
  • turn on the device

Now run the following command:

sudo imx_usb --configdir=/usr/etc/imx-loader.d/ ../u-boot-imx/u-boot.imx

Output should look like this:

Matrix will start boot and you will be able to see through the Serial connection.

Where you go from here is up to you. You can type help just to check all the commands. But this is a tutorial on how to change u-boot so just type the following commands.

setenv serverip "your tftp server"
setenv ipaddr "any unused ip server in your tftp server subnet"
setenv loadaddr 0x10800000

tftp u-boot.imx
mmc dev 2 1
setexpr fw_sz ${filesize} / 0x200
setexpr fw_sz ${fw_sz} + 1
mmc erase 0x0 0x2000
mmc write ${loadaddr} 0x2 ${fw_sz}

This is merely a learning exercise I did, as I’ve never done this before. You can easily integrate these kind of things into the tbs2910.h itself, in the u-boot source code under include/configs.

This is were I took most of my info. Kudos for l3iggs for his work. U-Boot source

How to use DiSEqC with DVBlast the right way

If you are here you probably know what DiSEqC. If you don’t lets take an overview.

What is DiSEqC? The word stands for Digital Satellite Equipment Control and with it you are able to select which satellite to lock when selecting a frequency. Using DVBlast and boards like TBS, you are able to expand your control through at least 8 satellites using the right equipment.

I normally use the EMP – Centauri brand, which are cheap and have a lot of options. Always go for the Professional line, they have support for both QUAD and QUATTRO LNBS. The options can go from DiSEqC 1.0 (4 satellites) and (DiSEqC 1.1) for 16 satellites, although I don’t know any brand that makes Multiswitches >8.

For example, this product enables 8 tuners, DTV, and 3 LNBs.

EMP Centauri 13/8

Now all you need to look for in DVBlast is the following:

~$ dvblast -h
 -S --diseqc satellite number for diseqc (0: no diseqc, 1-4, A or B) 
-k --uncommitted port number for uncommitted diseqc (0: no uncommitted diseqc, 1-4) 

By using these options you can work out which satellite you want to use.

Examples:

dvblast ... -S 1 -k 1 (select 1st LNB/SAT)
dvblast ... -S 2 -k 2 (select 6th LNB/SAT)
dvblast ... -S 4 -k 2 (select 8th LNB/SAT)
...
dvblast .... -S 4 -k 4 (select 16th LNB/SAT)

You will see logs like this:

 debug: configuring LNB to v=13 p=0 satnum=4 uncommitted=2

Hope it helps.

How to create a AllShare DLNA Server for a Samsung Smart TV

If you really want to stream all those torrents you download from the Internet and watch them on your TV set then you’re in the right place.

For this you will need at least a linux machine. A Raspberry PI using using a 4GB SD should be more than enough to have a few episodes. If not you can use any debian/redhat based linux system. Including the one and only Ubuntu.

So let’s start. First of all check that your distro has minidlna. A Raspberry will output the following.

pi@raspberrypi ~ $ apt-get update
pi@raspberrypi ~ $ apt-cache search minidlna
minidlna - lightweight DLNA/UPnP-AV server targeted at embedded systems

Well if you are lucky to have the following output on your OS then you are in for a treat. Just install it then

pi@raspberrypi ~ $ sudo apt-get -y install minidlna

Now you need to check an important detail regarding the placement of your videos. Edit /etc/minidlna.conf (vim /etc/minidlna.conf) and edit the following line to point to the place you want your files in.

media_dir=V,/var/lib/transmission-daemon/downloads

And that’s all you need for now. After editing the config file make sure you restart the minidlna server.

pi@raspberrypi ~ $ sudo service minidlna force-reload
[ ok ] Restarting DLNA/UPnP-AV media server: minidlna.
Samsung AllShare

Samsung AllShare

How to add a command to the Makefile

This tutorial is a quick way to understand how to add a script or something else to the Makefile installation process. This is solely for those who are building rpm/deb packages and want to add extra stuff in the installation package.

So inside your Makefile directory add the file you would like to see in the final installation:

For example:

[root@softether vpnserver_package]# ls script*
script_i_want_to_add.sh

Now edit Makefile to properly add the script to the final package.

[root@softether vpnserver_package]# vim Makefile

Look for the install and uninstall part and add the lines you need.

And that’s it. This script will then be accessible in the final stage of the installation, under /usr/bin/ folder which is the PATH folder.

How to compile Softether and create RPM package

This tutorial will explain how to compile and create a softether RPM package. This rpm package will have a small step to include a preset configuration.

First go to Softether and copy the source link.

First install all the dependencies you will need

yum -y install readline-devel ncurses-devel openssl-devel gcc vim wget

Then download the package, extract it, configure the system and compile it.

[root@softether ~]# cd /usr/src
[root@softether src]# wget http://www.softether-download.com/files/softether/v4.05-9423-beta-2014.02.18-tree/Source%20Code/softether-src-v4.05-9423-beta.tar.gz

[root@softether src]# tar -zxvf softether-src-v4.05-9423-beta.tar.gz
[root@softether src]# cd v4*
[root@softether v4.05-9423]# ./configure

…
Select your operating system below:
1: Linux
2: FreeBSD
3: Solaris
4: Mac OS X
5: OpenBSD

Which is your operating system (1 – 5) ? : 1

Select your CPU bits below:
1: 32-bit
2: 64-bit

Which is the type of your CPU (1 – 2) ? : 2
…

[root@softether v4.05-9423]# make

And that’s it. Now all we need to do is to add two files. One for the configuration and the other for the auto start.

Softether Package preparation

[root@softether v4.05-9423]# cd /usr/src
[root@softether src]# mkdir vpnserver_package
[root@softether src]# cd vpnserver_package
[root@softether vpnserver_package]# cp -r ../v4.05-9423/bin/vpnserver .
[root@softether vpnserver_package]# cp -r ../v4.05-9423/bin/vpncmd .

AutoStart
[root@softether vpnserver_package]# vim vpnserver.init

#!/bin/sh
# chkconfig: 2345 99 01
# description: SoftEther VPN Server
DAEMON=/usr/local/vpnserver/vpnserver
LOCK=/var/lock/subsys/vpnserver
test -x $DAEMON || exit 0
case &amp;quot;$1&amp;quot; in
start)
$DAEMON start
touch $LOCK
;;
stop)
$DAEMON stop
rm $LOCK
;;
restart)
$DAEMON stop
sleep 3
$DAEMON start
;;
*)
echo &amp;quot;Usage: $0 {start|stop|restart}&amp;quot;
exit 1
esac
exit 0

Get the vpnserver configuration and put it in the same folder.

[root@softether vpnserver_package]# ls *vpn
vpn_server.config

Create Makefile

[root@softether vpnserver_package]# wget https://dl.dropboxusercontent.com/u/1227943/ali/Makefile

Now all you need to do is follow this instructions and run checkinstall inside the softether compiled source directory.

Connect a Git/Bitbucket project with a Koding workspace

First create a ssh-key rsa public key.


nrmmota@vm-0:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/nrmmota/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/nrmmota/.ssh/id_rsa.
Your public key has been saved in /home/nrmmota/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xxx..... nrmmota@vm-0.nrmmota.koding.kd.io
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . |
| . o . |
| . S .= |
| . . = = |
| E . = oo . |
| . . =..o.+. |
| oo....+= |
+-----------------+

Now cat the public id and copy all of it.

nrmmota@vm-0:~$ cat .ssh/id_rsa.pub
ssh-rsa XXXXXXXXXXXXXXXXXXXXXXXXXX… nrmmota@vm-0.nrmmota.koding.kd.io

In Bitbucket go to “Manage account” -> SSH Keys. Create a new one and paste the key you just copied.

Warning: All its left is to create new Bitbucket project from scratch. Now the manual Git commands come into action. I haven’t found any versioning stuff besides clone project. This only refers to Bitbucket new projects.

nrmmota@vm-0:~$ ls
Applications Backup Documents Web
nrmmota@vm-0:~$ cd Documents/
nrmmota@vm-0:~/Documents$ ls
nrmmota@vm-0:~/Documents$ mkdir OTT
nrmmota@vm-0:~/Documents$ cd OTT/
nrmmota@vm-0:~/Documents/OTT$ git init
Initialized empty Git repository in /home/nrmmota/Documents/OTT/.git/
nrmmota@vm-0:~/Documents/OTT$ git remote add origin git@bitbucket.org:mundumelga/ott.git
nrmmota@vm-0:~/Documents/OTT$ ls
nrmmota@vm-0:~/Documents/OTT$ echo "OTT Project" >> README.md
nrmmota@vm-0:~/Documents/OTT$ git add README.md
nrmmota@vm-0:~/Documents/OTT$ git commit -m "First commit. Adding a README."
[master (root-commit) 995f512] First commit. Adding a README.
Committer: nrmmota
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

git config --global user.name "Your Name"
git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

git commit --amend --reset-author

1 file changed, 1 insertion(+)
create mode 100644 README.md

nrmmota@vm-0:~/Documents/OTT$ git push -u origin master
The authenticity of host 'bitbucket.org (XXX)' can't be established.
RSA key fingerprint is XXXXXXXX
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bitbucket.org,XXX' (RSA) to the list of known hosts.

Counting objects: 3, done.
Writing objects: 100% (3/3), 242 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@bitbucket.org:mundumelga/ott.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.