This shows you the differences between two versions of the page.
mantis:ztx:start [2016/03/10 08:24] admin created |
mantis:ztx:start [2016/03/10 08:28] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Zenteknix Utilities ====== | ====== Zenteknix Utilities ====== | ||
+ | ===== Desktop Recording ===== | ||
+ | This is a pair of scripts, a ksh wrapper to launch an ffmpeg capture and a Tcl/Tk GUI for terminating the capture process. | ||
+ | ==== deskvid ==== | ||
<WRAP nowrap> | <WRAP nowrap> | ||
- | <code> | + | <code ksh> |
#!/bin/ksh | #!/bin/ksh | ||
# Copyright (c) 1994-2016 Matt Samudio (Zenteknix) All Rights Reserved. | # Copyright (c) 1994-2016 Matt Samudio (Zenteknix) All Rights Reserved. | ||
Line 31: | Line 34: | ||
</code> | </code> | ||
</WRAP> | </WRAP> | ||
+ | |||
+ | ==== dvidkill ==== | ||
+ | <WRAP nowrap> | ||
+ | <code tcl> | ||
+ | #!/usr/bin/wish | ||
+ | # Copyright (c) 1994-2016 Matt Samudio (Zenteknix) All Rights Reserved. | ||
+ | # Contact information for Zenteknix is available at http://www.zenteknix.com | ||
+ | # | ||
+ | # This program is free software: you can redistribute it and/or modify | ||
+ | # it under the terms of the GNU General Public License as published by | ||
+ | # the Free Software Foundation, either version 3 of the License, or | ||
+ | # (at your option) any later version. | ||
+ | # | ||
+ | # This program is distributed in the hope that it will be useful, | ||
+ | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
+ | # GNU General Public License for more details. | ||
+ | # | ||
+ | # You should have received a copy of the GNU General Public License | ||
+ | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
+ | |||
+ | package require Tk | ||
+ | |||
+ | proc calcMetersFromFeet {} { | ||
+ | if {[catch { | ||
+ | set ::meters [expr {round($::feet*0.3048*10000.0)/10000.0}] | ||
+ | }]!=0} { | ||
+ | set ::meters "" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | proc layoutConversionGUI {} { | ||
+ | grid [ttk::frame .c -padding "3 3 12 12"] -column 0 -row 0 -sticky nwes | ||
+ | grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1 | ||
+ | |||
+ | grid [ttk::entry .c.feet -width 7 -textvariable feet] -column 2 -row 1 -sticky we | ||
+ | grid [ttk::label .c.meters -textvariable meters] -column 2 -row 2 -sticky we | ||
+ | grid [ttk::button .c.calc -text "Stop" -command killVidRecProc] -column 3 -row 3 -sticky w | ||
+ | |||
+ | grid [ttk::label .c.flbl -text "feet"] -column 3 -row 1 -sticky w | ||
+ | grid [ttk::label .c.islbl -text "is equivalent to"] -column 1 -row 2 -sticky e | ||
+ | grid [ttk::label .c.mlbl -text "meters"] -column 3 -row 2 -sticky w | ||
+ | |||
+ | foreach w [winfo children .c] {grid configure $w -padx 5 -pady 5} | ||
+ | } | ||
+ | |||
+ | proc layoutVideoGUI {} { | ||
+ | grid [ttk::frame .c -padding "3 3 12 12"] -column 0 -row 0 -sticky nwes | ||
+ | grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1 | ||
+ | grid [ttk::label .c.plbl -text "Video Recording PID:"] -column 1 -row 1 -sticky w | ||
+ | grid [ttk::label .c.procid -text "$::vpid"] -column 2 -row 1 -sticky we | ||
+ | grid [ttk::button .c.calc -text "Stop" -command killVidRecProc] -column 2 -row 3 -sticky w | ||
+ | foreach w [winfo children .c] {grid configure $w -padx 5 -pady 5} | ||
+ | } | ||
+ | |||
+ | proc killVidRecProc {} { | ||
+ | try { | ||
+ | exec kill $::vpid | ||
+ | set status 0 | ||
+ | } trap CHILDSTATUS { results options } { | ||
+ | set status [lindex [dict get $options -errorcode] 2] | ||
+ | } | ||
+ | |||
+ | if { $status == 0 } { | ||
+ | exit 0 | ||
+ | } | ||
+ | } | ||
+ | |||
+ | wm title . "Desktop Video Capture" | ||
+ | |||
+ | #layoutConversionGUI | ||
+ | #bind . <Return> {calculate} | ||
+ | #focus .c.feet | ||
+ | |||
+ | set vpid [lindex $argv 0] | ||
+ | puts $vpid | ||
+ | layoutVideoGUI | ||
+ | focus .c.procid | ||
+ | bind . <Return> {killVidRecProc} | ||
+ | </code> | ||
+ | </WRAP> | ||
+ | |||
+ |