Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tcl/Tk video player

124 views
Skip to first unread message

Giorgio Valoti

unread,
Nov 13, 2009, 2:53:11 PM11/13/09
to
Hi all,
I got a request for a cross platform (Win/Mac OS X), completely
self-contained, interactive video player. Details are still sketchy but
this application should:
- be directly executable from USB pen drive, no installation process
should be involved;
- play the movie, gather related answers from the user and send them
back to a server.

I think Tk is an ideal candidate for this project, since I could use a
StarPack, but I’ve used Tcl primarily for web-related and I don’t know
if I’m missing important details:
- can I use Tk to playback videos directly from a StarPack?
- do I have a complete control of the playback process from within tcl?
The user should not be able to stop/pause/skip/whatever the movie;
he/she must follow the course material and answer to a small number of
questions?

Thank you in advance

--
Giorgio Valoti

Pat Thoyts

unread,
Nov 14, 2009, 4:05:08 PM11/14/09
to
Giorgio Valoti <gior...@me.com> writes:

>Hi all,
>I got a request for a cross platform (Win/Mac OS X), completely
>self-contained, interactive video player. Details are still sketchy
>but this application should:
>- be directly executable from USB pen drive, no installation process
>should be involved;
>- play the movie, gather related answers from the user and send them
>back to a server.
>
>I think Tk is an ideal candidate for this project, since I could use a

>StarPack, but IοΏ½ve used Tcl primarily for web-related and I donοΏ½t know
>if IοΏ½m missing important details:


>- can I use Tk to playback videos directly from a StarPack?
>- do I have a complete control of the playback process from within
>tcl? The user should not be able to stop/pause/skip/whatever the
>movie; he/she must follow the course material and answer to a small
>number of questions?
>

For Windows there is tkvideo which provides a Tk widget that hooks up
to DirectX and can play some video formats. It's really been used for
webcams but can play .avi and .wmv and maybe others. The demo
application in the sources provides control (play,pause, stop and a
slider to move to a time point).

Another option is quicktimetcl which can do quicktime and maybe some
other formats and will work on Mac and Win.

No idea what you use on linux/unix.

--
Pat Thoyts http://www.patthoyts.tk/
To reply, rot13 the return address or read the X-Address header.
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD

Uwe Klein

unread,
Nov 14, 2009, 5:57:54 PM11/14/09
to
Pat Thoyts wrote:
>
> No idea what you use on linux/unix.
>
http://sourceforge.net/projects/mplayertcl/

uwe

giorgio_v

unread,
Nov 16, 2009, 3:10:43 AM11/16/09
to
On 14 Nov, 22:05, Pat Thoyts <cnggub...@hfref.fbheprsbetr.arg> wrote:
> Another option is quicktimetcl which can do quicktime and maybe some
> other formats and will work on Mac and Win.
>

Yes, I thought about quicktimetcl but it seems no longer maintained.

Arndt Roger Schneider

unread,
Nov 16, 2009, 8:10:02 AM11/16/09
to
giorgio_v schrieb:

Depends on what type of video you like to play...
Aplpe is currently reimplementing QuickTime (Snow Leopard QuickTime X
and 7).
Investing any work in a QuickTime 7.x package is very likely
lost.

On video formats:
QuickTime has its own mpeg2 decoders, which you have to purchase from
Apple (20$).

Although perian is capable to display almost every codec including mpeg
2 it can't
be used for mpeg 2 video playback in QickTime...
...and perian is not availabe for Windows.

BTW: perian is based on ffmpeg as is mplayer

Included in ffmpeg is a stripped down video player : ffplay,
which has a command line interface.

There is already a cross-platform video player: videolan
X11 and Windows versions are implemented in Qt and OSX in Cocoa.


-roger

Giorgio Valoti

unread,
Nov 17, 2009, 1:44:06 AM11/17/09
to
On 2009-11-16 14:10:02 +0100, Arndt Roger Schneider <arndt...@web.de> said:

>
>
> There is already a cross-platform video player: videolan
> X11 and Windows versions are implemented in Qt and OSX in Cocoa.
>

Seems really interesting but it’s not clear to me how to embed the
player inside a Tk application? (as I said, I never developed with Tk,
only “pure” Tcl, so my questions could appear silly/naive).

--
Giorgio Valoti

Arndt Roger Schneider

unread,
Nov 17, 2009, 4:20:25 AM11/17/09
to
Giorgio Valoti schrieb:

Depends how seemless the integration has to be
--I don't think you can strip videolan off its gui...

If you do want to provide all the controls in Tk, but only let the
video player display the video --without its own decorum: ffplay

Tk contains the -container and -use properties for toplevel and
frame windows; these two properties together with winfo id are
being used to integrate any kind of window into a tk window hierarchy.

I suggest you should read the man pages on toplevel and frame.

-roger

Pat Thoyts

unread,
Nov 17, 2009, 5:28:36 PM11/17/09
to
Giorgio Valoti <gior...@mac.com> writes:

>On 2009-11-16 14:10:02 +0100, Arndt Roger Schneider <arndt...@web.de> said:
>
>> There is already a cross-platform video player: videolan
>> X11 and Windows versions are implemented in Qt and OSX in Cocoa.
>>
>

>Seems really interesting but itÔøΩs not clear to me how to embed the


>player inside a Tk application? (as I said, I never developed with Tk,

>only ÔøΩpureÔøΩ Tcl, so my questions could appear silly/naive).

With tkvideo (windows only):

package require tkvideo
tkvideo .v -source Wildlife.wmv
pack .v -fill both -expand 1
.v start

bs

unread,
Nov 17, 2009, 5:30:09 PM11/17/09
to
On Nov 17, 1:20 am, Arndt Roger Schneider <arndt.ro...@web.de> wrote:
> Giorgio Valoti schrieb:
>
> > On 2009-11-16 14:10:02 +0100, Arndt Roger Schneider
> > <arndt.ro...@web.de> said:
>
> >> There is already a cross-platform video player: videolan
> >> X11 and Windows versions are implemented in Qt and OSX in Cocoa.
>
> > Seems really interesting but it’s not clear to me how to embed the
> > player inside a Tk application? (as I said, I never developed with Tk,
> > only “pure” Tcl, so my questions could appear silly/naive).
>
> Depends how seemless the integration has to be
> --I don't think you can strip videolan off its gui...
>

You can...I started down that path maybe 1-2 years ago, and got it
semi working (on linux, didn't try other platforms). I got busy with
other things, so never finished it. It wasn't very straight forward
(at least to me)...maybe things have gotten better since then. I think
they were working on a new api lib.

There's also this Tcl module here http://www.crystalballinc.com/vlad/software/
, but I have never used it, so I'm not sure it capabilities.

Giorgio Valoti

unread,
Nov 18, 2009, 1:23:21 AM11/18/09
to
On 2009-11-17 23:28:36 +0100, Pat Thoyts
<cngg...@hfref.fbheprsbetr.arg> said:

> Giorgio Valoti <gior...@mac.com> writes:
>
>> On 2009-11-16 14:10:02 +0100, Arndt Roger Schneider <arndt...@web.de> said:
>>
>>> There is already a cross-platform video player: videolan
>>> X11 and Windows versions are implemented in Qt and OSX in Cocoa.
>>>
>>

>> Seems really interesting but it’s not clear to me how to embed the


>> player inside a Tk application? (as I said, I never developed with Tk,

>> only “pure” Tcl, so my questions could appear silly/naive).


>
> With tkvideo (windows only):
>
> package require tkvideo
> tkvideo .v -source Wildlife.wmv
> pack .v -fill both -expand 1
> .v start

(I replied privately to Pat but I think it could be useful to repost
the message here)

[…] I’m trying out TkVideo. I have downloaded the starkit version and the
tclkit interpreter (version 8.4). The demo launches but when I try to
play a .avi file I get this error:

error: no video source initialized
error: no video source initialized
   while executing
"$app(video) pause"
   (procedure "Pause" line 5)
   invoked from within
"Pause $Application"
   (procedure "SetFileSource" line 5)
   invoked from within
"SetFileSource $Application $file"
   (procedure "onFileOpen" line 10)
   invoked from within
"onFileOpen ::::demo1"
   (menu invoke)

I’ve also tried the same thing from the tk console:

tkvideo .v
.v configure -source "movie.avi"

--> failed to initialize video source: code 0x80040217

[…]

I’m using Win XP SP 2, Windows Media player 9 under Parallels on Mac OS X.
The .avi file is played as expected using Windows Media Player 9.

--
Giorgio Valoti

giorgio_v

unread,
Nov 18, 2009, 5:09:58 AM11/18/09
to
On 18 Nov, 07:23, Giorgio Valoti <giorgi...@mac.com> wrote:
> The demo launches but when I try to
> play a .avi file I get this error:
> […]
>
> I’m using Win XP SP 2, Windows Media player 9 under Parallels on Mac OS X.
> The .avi file is played as expected using Windows Media Player 9.

Just tried with .wmv and .mpeg clips with the same results.

Arndt Roger Schneider

unread,
Nov 18, 2009, 9:12:06 AM11/18/09
to
bs schrieb:

>On Nov 17, 1:20 am, Arndt Roger Schneider <arndt.ro...@web.de> wrote:
>
>
>>Giorgio Valoti schrieb:
>>
>>
>>
>>>On 2009-11-16 14:10:02 +0100, Arndt Roger Schneider
>>><arndt.ro...@web.de> said:
>>>
>>>
>>>>There is already a cross-platform video player: videolan
>>>>X11 and Windows versions are implemented in Qt and OSX in Cocoa.
>>>>
>>>>

>>>Seems really interesting but it�s not clear to me how to embed the


>>>player inside a Tk application? (as I said, I never developed with Tk,

>>>only �pure� Tcl, so my questions could appear silly/naive).


>>>
>>>
>>Depends how seemless the integration has to be
>>--I don't think you can strip videolan off its gui...
>>
>>
>>
>
>You can...I started down that path maybe 1-2 years ago, and got it
>semi working (on linux, didn't try other platforms). I got busy with
>other things, so never finished it. It wasn't very straight forward
>(at least to me)...maybe things have gotten better since then. I think
>they were working on a new api lib.
>
>There's also this Tcl module here http://www.crystalballinc.com/vlad/software/
>, but I have never used it, so I'm not sure it capabilities.
>
>
>

So the question is whether it works cross-platform --the Aqua-gui is cocoa.

Videolan is partly implemented in lua and it
should be possible to slip a tk gui into it
using it as a bridge to integrate videolan into a tcl/tk application...

... would make it possible to bypass the
offical COM/dbus/applescript interface, too.

-roger

giorgio_v

unread,
Nov 18, 2009, 10:42:23 AM11/18/09
to
On 18 Nov, 15:12, Arndt Roger Schneider <arndt.ro...@web.de> wrote:
> […]

>
> So the question is whether it works cross-platform --the Aqua-gui is cocoa.
>
> Videolan is partly implemented in lua and it
> should be possible to slip a tk gui into it
> using it as a bridge to integrate videolan into a tcl/tk application...
>
> ... would make it possible to bypass the
> offical COM/dbus/applescript interface, too.

I’m thinking about sidestepping the tk solution altogether and use
Wub. Does this server block until a request is completed (like
tclhttpd, if I remember correctly)?

0 new messages