2015-11-14

使用 GRUB4DOS / RMPrepUSB 的注意事項

1. 可 mount 大部份 ISO 檔案的方法
A : 參考 www.rmprepusb.com
>>> 93 - Boot almost ANY linux ISO from a grub4dos USB drive (e.g. Tails, BackTrack or even Ophcrack)!
>>> 21 - GRUB4DOS GUIDE (with videos) - how to make a multi-boot drive (+examples)

2. Error 60: File for drive emulation must be in one contiguous disk area
A1 : RMprepUSB->Drive->Make all files on drive contiguous (Ctl+F2)
A2 : Run winimage
A3 : (最笨最有效的作法) Copy USB 內容到暫存目錄, delete USB 內容, 是 delete, 不是 format. Using the Ctrl-F2 hotkey in RMPrepUSB to make all the files on the E2B drive contiguous. 再將暫存木錄之內容, 回存到 USB.
A4 : (建議的作法): Comment from http://rmprepusb.blogspot.tw/.  A nice tool you can use to help you look at the files on the USB drive and understand what is happening is the free Piriform Windows utility Defraggler. 分析之後, 針對單一檔案進行處理, 不要中斷; 千萬不要全部重組.
defraggler
Defraggler also asks if you want to erase the Recycle Bin files when you Analyze or Defrag a drive.
As you can see from the screenshot above, you can select a drive, click Analyze and then immediately see the fragmented files (shown by the red squares). You can then select a red square and Defraggler will list what files are in that block. You can then tick the checkbox next to any of these files and defragment them separately by clicking the 'Defrag checked' button. Nice!
Defraggler is not a good tool to use on the whole USB drive however. It attempts to move all the files to the beginning of the drive as well as make them contiguous. This can take a longggg time and is also uneccessary. What is more, if you Stop Defraggler during a defrag operation, it can prevent the drive from being defragged again and prevent WinContig from being able to make all the files contiguous unless you first delete a large file from the USB drive to make more room! So I would advise that you only use Defraggler to defrag single files and don't interrupt it once it has started. If you need to make all files on a drive contiguous use WinContig (or Ctrl+F2 in RMPrepUSB).
P.S. In case you missed it, in a previous blog post, I describe a case where a 6GB ISO could not be copied and then defragged on an empty 8GB USB drive and the reason why this happens.

2015-10-29

影音轉檔及字幕使用

軟體:
1. Handbrake : 從光碟片抽取影音檔, 轉換影音格式. 不提供字幕檔格式設定/編輯.
2. Avidemux : 合併/裁剪影音檔
3. ConvertZ : 字幕檔簡繁體轉換 (Microsoft Office Word, Libreoffice Writer 也都有簡繁轉換功能; 接著利用 notepad++ 轉換至 UTF-8 (檔首無 BOM))
4. Notepad++ : 改變字幕檔編碼格式為 UTF-8; 檔案大小會比原本的檔案增大約 1.5 倍; UTF-8 以 3 bytes 存中文.
5. SrtEdit : 轉換字幕檔格式 (SRT, SSA, ASS), 中文簡繁轉換, 調整字幕大小及字型
6. VLC : media player
7. PLEX : media server


=============================================================================
影音檔格式差別:

MKV:
老牌封裝格式。以可以自由調節各項設置而備受視頻壓制人員的喜愛,而且後天可以提取內掛字幕和外掛字幕都很容易。只是這個格式在安卓和iOS等移動設備上不是默認支持的,因為其相同碼率和設置下體積較大,且由於充分開放自由設置而導致的編碼不同等問題不適合移動設備觀看,另外Mac OSX也不是原生支持這種格式的。

MP4:
新興封裝格式。雖然不及MKV那般高自由度的調節選項,但是由於其被移動設備、掌機以及Mac OSX等原生支持,在移動視頻領域異軍突起,成為了很多視頻網站和論壇開始大量採用的視頻格式。不過此種格式雖然也是可以封裝其他視頻格式的,但是由於其有限的調節設定導致其後天再編輯性不強,也無法提取內嵌字幕。


=============================================================================
字幕有兩種形式

1. softsub (軟)
可以是獨立的字幕檔,也可以封裝在影片檔內. 最大的特點是可以選擇、開啟/關閉指定字幕
常見文字格式: ASS、SSA、SRT、Plain Text
常見圖形格式: DVD字幕、Blu-ray字幕

2.hardsub (硬)
如果你的播放設備不支援字幕(softsub),你就要重新編碼視訊將字幕烙印在畫面上, 但轉換編碼格式很耗時還會損失畫質. 播放時一定有字幕,因為字幕是烙印在畫面上,有畫面就有字幕

輸入字幕

支援的字幕格式:
‧ Plain Text (純文字): 僅內建
‧ SubRip (SRT): 內建、外掛
‧ Advanced SubStation Alpha (ASS): 僅內建
‧ SubStation Alpha (SSA): 僅內建
‧ DVD Subtitles (IDX+SUB): 僅內建
‧ Blu-ray Subtitles (PGS/SUP): 僅內建

字元編碼格式:
‧ UTF-7
‧ UTF-8
‧ UTF-16
‧ UTF-32

前置作業

如果 SRT 之類的文字格式字幕的字元編碼不是 Unicode 格式, 你必須先將字元編碼轉為 UTF-8 或其他 Unicode 格式

http://www.mobile01.com/topicdetail.php?f=511&t=4192036

如果是獨立的字幕檔 (非 SRT),可用 mkvmerge 將所需的字幕、視訊、音訊重新封裝為單 MKV 檔給Handbrake 或 VidCoder 讀取。如果需要匯出內建字幕,可用 gMKVExtractGUI 匯出字幕。

http://www.mobile01.com/topicdetail.php?f=510&t=4192044

由於 Handbrake 不提供字幕樣式設定選項,所以純文字字幕只能使用預設的風格/樣式,但你可以將純文字字幕轉為 ASS,並直接在 ASS 字幕內設定風格/樣式。最後再用 mkvmerge 重新封裝成單 MKV 給 Handbrake 或 VidCoder 讀取。

http://www.mobile01.com/topicdetail.php?f=510&t=4192039

Handbrake 輸出字幕設定

開啟影片後切換到 "Subtitles" 分頁; 如果字幕來源是輸入影片,則點擊 [Add Track] 之後從 "Source" 的下拉式選單選取要使用的字幕, 如果字幕來源是 SRT 檔,則點擊 [Import SRT] 來選取字幕檔案,且必須設定正確的字元編碼 (Car Code), 如果你勾選 [Burn In],則該字幕會被燒錄(烙印)至畫面上,即 "hardsub"。


HandBrake 轉檔出現亂碼 = =
除了Handbreak設定要選UTF-8之外,.srt檔有些也要用文字編輯另存成UTF-8格式。

=============================================================================

2015-10-18

RS485 & RS232 簡介

RS485 & RS232

通訊可分成串列通訊與並列通訊兩種,串列通訊是以分時方式每次傳送一個位元(bit)給接收端,像是RS232、USB等等。
若以操作模式區分可以分成單端傳輸(Single-ended transmission)與差動傳輸(Differential transmission),單端傳輸資料傳送之電壓準位的參考是地GND;而差動傳輸資料傳送之電壓準位是參考則是兩端的電位差,換句話說資料不是對地在送。
單端傳輸之缺點是抗雜訊能力較差,傳輸距離無法遠與傳輸速率慢,例如 RS232。差動傳輸之優點則是抗雜訊能力強,傳輸距離較遠與傳輸速率快,例如RS485。

 


規格
RS232 RS423 RS422 RS485
操作模式 單端傳輸 單端傳輸 差動傳輸 差動傳輸
線上允許之傳送/接受數目 1 Driver/1 Receivers 1 Driver/10 Receivers 1 Driver/10 Receivers 32 Driver/32 Receivers
最大傳輸距離 50 feet (15 m) 4000 feet (1.2 km) 4000 feet (1.2 km) 4000 feet (1.2 km)
最大傳輸速率 20 kb/s 100 kb/s 10 Mb/s 10 Mb/s
接收端之輸入靈敏度 ±3 V ±200 mV ±200 mV ±200 mV

 

RS485 簡介

RS485是一種工業標準,RS485之傳輸距離最大為1.2公里,傳送速率最大為10 Mb/s。RS485優點是抗雜訊能力強,通訊過程只需要2條線,RS485是一種半雙工傳輸,半雙工意指同一時間只能做傳送或是接收的動作,無法同時傳送與接收,像是對講機就是半雙工通訊的一種。

RS232通訊至少需要3條線(一條發射線TxD、一條接收線RxD、一條接地線GND),RS232通訊電壓準位的參考是地;而RS485傳輸不需要地線,其電壓準位的參考標準不是地,而是兩端之電位差。
RS485的電氣規格:邏輯“1”以兩線間的電壓差為+(2~6)V表示;邏輯“0”以兩線間的電壓差為-(2~6)V表示。RS485之電壓準位相較於RS-232來的低,所以較不易損壞介面電路的IC。再者,RS485電壓準位TTL電壓準位相容,也方便與TTL 電路連接。

RS485介面是採用差動傳輸方式,其抗共模能力增強,即抗雜訊干擾性好。因為RS485組成的半雙工網路,只需二條線,所以RS485介面均採用遮罩雙絞線傳輸。

應用

RS485可以是1對多甚至是多對多通訊。RS485最大傳輸距離為1.2 km,另外RS232通訊只能是1對1傳輸,而RS-485通訊可允許多對多傳輸(32 Driver 32 Receiver),故可利用RS-485介面方便地建立起設備網路。

2015-03-21

2015-03-10

Setup Raspberry’s wireless network and assign a static IP address in Raspbian

參考文件:
1. paulv's comment in /etc/network/interfaces changed,weird 2 LAN IPs instead of 1
2. Setting a static IP on Raspberry Pi on Raspbian 20150505

----------------------------------------------------------------------------------------
Setup wireless network:
NEVER modify /etc/network/interfaces again.

add theses codes to /etc/wpa_supplicant/wpa_supplicant.conf
network={
    ssid="SSID"
    psk="Your_wifi_password"
}


Set static IP address for an interface:
NEVER modify /etc/network/interfaces again.

Add these to /etc/dhcpcd.conf

interface eth0
static ip_address=192.168.0.200/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

Replace eth0 and the addresses as what you want.

Fixing Raspberrypi’s WiFi Dropout Issues on EDUP EP-N8508GS

If you find your wifi 'drops out' from time to time, you can fix it by following procedures:

Create and edit a new file in /etc/modprobe.d/8192cu.conf

sudo vi /etc/modprobe.d/8192cu.conf
# Disable power saving (recommended)
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

Then reboot with sudo reboot. 結果反應在 /sys/module/8192cu/parameters/…

For details, please check "A Brief Introduction to RTL8192C driver Power Saving"

# In associated idle
rtw_power_mgnt=0|1|2
0 == disable power saving
1 == power saving on, minPS
2 == power saving on, maxPS

rtw_enusbss=0|1
0 == disable auto suspend
1 == enable auto suspend

rtw_hwpwrp_detect=0|1
0 == disable HW power pin detection
1 == enable HW power pin detection

# Under unassociated idle state
rtw_ips_mode=0|1
0 == low power, IPS_NORMAL
1 == higher power, IPS_LEVEL2

The conventional wisdom, because we're running our RPis as server systems not clients, is to set rtw_power_mgnt=0 and rtw_enusbss=0 to prevent the dongle going into power saving and to ignore the other two parms because they don't make any difference. If the server goes into power saving we'd need a process to wake it up. That's different from a client system where interaction from a keyboard user will trigger a request to wake up and associate the dongle.

2015-03-07

GNU / Linux 各種壓縮與解壓縮指令

.7z
套件名稱:p7zip-full。
壓縮:$ 7z a FileName.7z FileName
使用密碼 (PASSWORD) 壓縮:$ 7z a FileName.7z FileName -pPASSWORD
解壓縮:$ 7z x FileName.7z

.bz
壓縮:unkown。
解壓縮1:$ bzip2 -d FileName.bz
解壓縮2:$ bunzip2 FileName.bz

.bz2
套件名稱:bzip2。
壓縮:$ bzip2 -z FileName
解壓縮1:$ bzip2 -d FileName.bz2
解壓縮2:$ bunzip2 FileName.bz2

.gz
套件名稱:gzip。
壓縮 : $ gzip FileName
解壓縮1:$ gunzip FileName.gz
解壓縮2:$ gzip -d FileName.gz

.lha
套件名稱:lha。
壓縮:$ lha -a FileName.lha FileName
解壓縮:$ lha -e FileName.lha

.rar
套件名稱:rar, unrar。
壓縮:$ rar a FileName.rar DirName
解壓縮1:$ rar e FileName.rar
解壓縮2:$ unrar e FileName.rar
.tar (僅打包,無壓縮)
套件名稱:tar。
打包:$ tar cvf FileName.tar DirName
解包:$ tar xvf FileName.tar

.tar.bz
壓縮:unkown。
解壓縮:$ tar jxvf FileName.tar.bz

.tar.bz2
套件名稱:bzip2。
壓縮:$ tar jcvf FileName.tar.bz2 DirName
解壓縮:$ tar jxvf FileName.tar.bz2

.tar.gz
套件名稱:gzip。
壓縮:$ tar zcvf FileName.tar.gz DirName
解壓縮:$ tar zxvf FileName.tar.gz

.tar.tgz
套件名稱:gzip。
壓縮:$ tar zcvf FileName.tar.tgz FileName
解壓縮:$ tar zxvf FileName.tar.tgz

.tar.xz
套件名稱:xz-utils。
壓縮:$ tar Jcvf FileName.tar.xz DirName
解壓縮:$ tar Jxvf FileName.tar.xz

.tar.Z
壓縮:$ tar Zcvf FileName.tar.Z DirName
解壓縮:$ tar Zxvf FileName.tar.Z

.tgz
套件名稱:gzip。
壓縮:$ tar zcvf FileName.tgz FileName
解壓縮:$ tar zxvf FileName.tgz

.xz
套件名稱:xz-utils。
壓縮:$ xz -z FileName
解壓縮:$ xz -d FileName.xz

.Z
壓縮:compress FileName
解壓縮:$ uncompress FileName.Z

.zip
套件名稱:zip。
壓縮:$ zip FileName.zip DirName
解壓縮:$ unzip FileName.zip