$ ffmpeg -y -i /tmp/video.avi -s 640x480 -pix_fmt gray -vcodec rawvideo /var/tmp/video.avi
I haven't however found a means to re-encode the grayscale into an alternative codec (sigh).
Random thoughts from the 'Fat, Slow Kid'. I am a software engineer by profession, the majority of my thoughts will concern technology and my profession.
$ ffmpeg -y -i /tmp/video.avi -s 640x480 -pix_fmt gray -vcodec rawvideo /var/tmp/video.avi
site:fatslowkid.blogspot.com imagemagick
$ convert frame00000002.bmp frame00000001.bmp -compose difference -composite -threshold 0 -negate diff.bmp



$ convert frame00000002.bmp frame00000001.bmp -compose difference -composite -threshold 0 -negate - | display
$ ffmpeg -i /var/tmp/foo.mpg -f asf - | mplayer -cache 8192 -
$ convert Lenna.jpg - | display -
#!/usr/bin/tclsh
proc createFrame { fileName imageL targets } {
array set image $imageL
set tL ""
foreach e $targets {
switch [lindex $e 0] {
circle
{
set x0 [lindex [split [lindex $e 1] ,] 0]
set y0 [lindex [split [lindex $e 1] ,] 1]
set r [lindex $e 2]
set x1 [expr $x0 + $r]
set y1 $y0
set tL [concat $tL "-fill red -draw 'circle $x0,$y0 $x1,$y1'"]
}
}
}
set cmd "/usr/bin/convert -size $image(width)x$image(height) xc:white $tL $fileName"
puts $cmd
exec bash -c $cmd
}
#---main---
set image(width) 640
set image(height) 480
set fileName /tmp/frame00000001.pnm
lappend targets [list circle 320,240 10]
lappend targets [list circle 100,100 10]
createFrame $fileName [array get image] $targets
#!/usr/bin/tclsh
proc log { msg } {
# puts stderr __$msg
}
proc mean { L } {
set sum 0.0
foreach e $L {
set sum [expr $sum + $e]
}
return [expr $sum / [llength $L].]
}
proc median { L } {
set L1 [lsort -real $L]
return [lindex $L1 [expr [llength $L1] / 2]]
}
proc process { fileName } {
set fp [open $fileName r]
while { [gets $fp line] >= 0 } {
switch -glob -- $line {
*Cpu*
{
log "processing line '$line'"
set el [split $line ,]
set userLoad [string trimleft [lindex $el 0] "Cpu(s):"]
set sysLoad [lindex $el 1]
set niceLoad [lindex $el 2]
set idleLoad [lindex $el 3]
log "parsing $userLoad"
log "parsing $sysLoad"
log "parsing $niceLoad"
log "parsing $idleLoad"
set userLoad [lindex [split $userLoad \%] 0]
set sysLoad [lindex [split $sysLoad \%] 0]
set niceLoad [lindex [split $niceLoad \%] 0]
set idleLoad [lindex [split $idleLoad \%] 0]
log "extracted $userLoad"
log "extracted $sysLoad"
log "extracted $niceLoad"
log "extracted $idleLoad"
# puts [expr $userLoad+$sysLoad+$niceLoad+$idleLoad]
lappend L [expr 100.0-$idleLoad]
}
}
}
close $fp
puts "mean cpu load: [mean $L]"
puts "median cpu load: [median $L]"
}
proc monitorCpuLoad { fileName duration } {
catch { exec top -b -n $duration -d 1 > $fileName }
process $fileName
}
proc help { } {
upvar #0 argv0 argv0
puts stderr "usage: $argv0 \[logFileName\] \[duration\]"
exit
}
#---main---
if { [llength $argv] != 2 } {
help
}
monitorCpuLoad [lindex $argv 0] [lindex $argv 1]
$ mplayer http://202.6.74.107:8060/triplej.mp3 -dumpstream -dumpfile /tmp/audio.mp3