2020年2月15日 星期六

[Linux] cron 例行性工作


  • crontab -e
    • edit 的意思
    • format
      • sec min hour date month day task
      • e.g.
        • 5 * * * * * * $(date) >> ~/logTime.txt

[Multimedia] Portal


  • Codec
    • AOM
      • VP9/AV1
    • MPEG
      • AVC/H.264
      • HEVC/H.265
      • VVC/H.266
    • China
      • AVS
  • Muxer
    • mp4
    • mpeg2-ts
  • Tool
    • MediaInfo
      • Feature: 提供讀取 media 的 metadata, 有 CLI 與 GUI 介面
      • Install
        • (GUI)
          sudo port install MediaInfo-gui
        • (CLI)
          sudo port install mediainfo
    • FFmpeg
      • probe/codec plugin/player

[FFmpeg] usage


  • transcoding
    • ffmpeg -i input.rmvb -vcodec mpeg4 -b:v 200k -r 15 -an output.mp4
      • -r: rate
  • show signaling information
    • ffprobe -show_packets input.flv

2020年2月12日 星期三

[GNU/Linux] Bash


  • Who/Whom
    • GNU project 下, 供 GNU Operating System / Unix (當然在 GNU/Linux也有) 使用的 Shell.
  • When?
    • first release 1989
  • What?
    • GNU Bourne-Again SHell
    • 屬於 GNU packages, 基本上是一個 command processor, 可處理指令 (e.g. UNIX commands, like ls, sed, ...etc.) 或是執行 shell script
  • Features
    • pipeline
    • Grammar
    • interactive
  • Usage
    • 環境設定, 切換 shell 為 bash (change shell) (MacOSX 最新預設為 zsh
        chsh -s /bin/bash
        
    • Pipeline & redirect
      • file descriptor
        • 0: stdin
        • 1: stdout
        • 2: stderr
    • Shell Script
      • command: ((...))
      • variable syntax: $((...))
      • 相關 shell script 教學可參考鳥哥
    • 常用 scripts
      • iteration
        • for i in $(seq 1 2 10)
        • for file in `find . -name *.mp4`
        • find . -type f -exec mv {} dst/ \; 
      • 取代內容
        • sed 's/orig/replaced/' file.txt
      • pipe
        • find . -exec echo `echo "{}" | sed 's/./foo/g'` \;
      • 字串處理
        • 去頭
        • 去尾
      • 印 timestamp
        • $(date)
    • Config
      • /etc/profile, .bashrc, .bash_profile
  • Reference: