2015年6月5日 星期五

audio filter path of ffmpeg

To use ffmpeg to calculate the audio power,
including "volumedetect" and "replaygain" filter,
there is some trick to apply the filter path.

The target is to calculate the audio power for
the left/right audio channels in the mpeg I stream.
The audio filter path will be composed of 3 parts :
1. select channel by "pan" filter, [0:a] for the input audio stream,
    c0=c0 to select left channel, and c0=c1 for right channel
2. specify the audio channel number by "aformat"
    which is necessary for volumedetect filter afterwards
3. "volumedetect" or "replaygain" filter

For example :

ffmpeg -i vcd.mpg -filter_complex "[0:a]pan=1c|c0=c0[middle];[middle]aformat=channel_layouts=mono[final];[final]volumedetect" -f null NUL

 replacing "c0=c0" by "c0=c1" for right channel(mono),
or "volumedetect" by "replaygain" for RMS or replaygain statistics.

2014年1月3日 星期五

Realtek 8168b under Ubuntu

之前遇到 Ubuntu 機器上, Realtek 8168b 網卡不能上 Gigabit 速度,因為 r8169 driver 不適用,所以用底下的方法,改編 r8168 driver 就好了. 只是這個 driver 本身沒辦法驅動 r8169.

sudo apt-get install --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms
wget http://media.cdn.ubuntu-de.org/forum/attachments/14/31/3005217-r8168-dkms-8.036.00.tar.gz
sudo tar xvf 3005217-r8168-dkms-8.036.00.tar.gz -C /usr/src
sudo dkms add -m r8168-dkms -v 8.036.00
sudo dkms build -m r8168-dkms -v 8.036.00
sudo dkms install -m r8168-dkms -v 8.036.00 
echo "blacklist r8169" | sudo tee -a /etc/modprobe.d/blacklist.conf
做完之後,還要再 update 一下
~$ update-initramfs -u

2013年11月12日 星期二

mount a HDD image under Linux

(1). determine the offset of the partition

# fdisk -l 3.4.61.img

Disk linaro-quantal-developer-20130422-342-A20-3.4.61.img: 944 MB, 944766976 bytes
58 heads, 20 sectors/track, 1590 cylinders, total 1845248 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device      Boot      Start         End      Blocks   Id  System
3.4.61.img  1          2048     1845247      921600   83  Linux

From the example, the offset of the only partition is
2048*512=1048576

(2). setup the loopback device

# losetup -o 1048576 /dev/loop0 3.4.61.img

(3). mount the partition

# mount /dev/loop0 /mnt/temp

(4). umount the partition and detach the loopback device

# umount /mnt/temp
# losetup -d /dev/loop0

2013年11月6日 星期三

Android build system trace

整個 Android build 的主體,都放在
build 底下, 開始的第一個指令

source build/envsetup.sh

會"建立"幾個 shell 的 function,
在 shell 底下下 set 指令就會印出來,
之後就可以下 lunch, cgrep, godir 等"指令".


2013年10月23日 星期三

Beagle board uboot compilation


  • 先在 /opt/toolchains 底下安裝 linaro 的 toolchain
  • uboot source code 中, edit Makefile, 修改底下的 CROSS_COMPILE 變數,反映實際toolchain路徑
ifeq ($(ARCH),arm)
CROSS_COMPILE = /opt/toolchains/gcc-linaro-arm-linux-gnueabihf-4.8-2013.07-1_linux/bin/arm-linux-gnueabihf-

  • make ARCH=arm omap3_beagle_config


  • make ARCH=arm all -j 8

2013年7月5日 星期五

adding account/password to SAMBA server


  using command

  smbpasswd -a username

  and then enter the password the same as your PC,
  then your PC can connect to the SAMBA directory
  smoothly.

2013年7月2日 星期二

Freeware tools


  7-zip : 壓縮/解壓縮 tools
  Notepad ++ : editor, 用來編寫 C 語言方便閱讀, 支援 unicode
  HxD : hex editor
  audacity : free audio editor