Plan 9: Audio-Video Pipeline

Video pipeline in action

Two important points about videos:

  1. A video is a series of images.
  2. RGB format is used for display. YUV format is used for storage and transmission. 
Recording 
────────────────────────────────────────────────────────

[Video Source] → [Frame Processing] → [Video Encode] ┐
                                                                                                     ├→ [Mux] → [Container Stream]
[Audio Source] → [Audio Processing] → [Audio Encode] ┘


Playback 
────────────────────────────────────────────────────────

[Container Stream] → [Demux] → [Video Decode] → [Video Sink]
                                                      │
                                                      └→ [Audio Decode] → [Audio Sink] 
 

 

Sample image usage session:

jpg -yc a.jpg > a.yuv
1024x768
video/vsink -ki 1024x768 a.yuv
 
# usage: video/yuvconv -i fmt -s WxH [-o fmt] file
video/yuvconv -i yuv444 -s1024x768 a.yuv > b.yuv
video/vsink -ki 1024x768 b.yuv

 

Sample video usage session:

video/vsource -gn 1 > b.yuv
video/vsink b.yuv
video/vsource /dev/screen | video/vsink
 

 

Sink as a Screensaver / Image viewer 


Use composable programs to run screensaver or image viewer. DEL to exit the program.

Options:

g    grid ( 1x2 , 2x2 etc.) 
k    interactive (press any key to continue) 
l    loop
r    images per second (rate)
s    stretch 

 

Lessons Learnt

  1.  When a graphical program runs, it replaces the window label with the argument passed in initdraw(nil, nil, "label").
  2. riow has a CLI option -s label to set sticky window. Sticky windows are skipped while circling through open window.
  3. Plan 9 image is actually XBGR even though channel string is x8r8g8b8 and channel constant is XRGB32 on x86.
  4. Still images use YUV444 to maintain maximum details. Video uses YUV420 which sacrifices details for size. 


Code

 

 

 

Comments

Popular posts from this blog

Plan 9 : The Infinity Notebook

Plan 9: Quick Boot with UEFI

Comics Builder in GNU Emacs