Plan 9: Audio-Video Pipeline
Video pipeline in action
Two important points about videos:
- A video is a series of images.
- 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
- When a graphical program runs, it replaces the window label with the argument passed in initdraw(nil, nil, "label").
- riow has a CLI option -s label to set sticky window. Sticky windows are skipped while circling through open window.
- Plan 9 image is actually XBGR even though channel string is x8r8g8b8 and channel constant is XRGB32 on x86.
- Still images use YUV444 to maintain maximum details. Video uses YUV420 which sacrifices details for size.