Python help: Sending a "play" command to quicktime, or playing amovie in python

Discussion in 'Python' started by Varnon Varnon, Oct 23, 2009.

  1. I'm sure this is a simple problem, or at least I hope it is, but I'm
    not an experience programer and the solution eludes me.

    My realm of study is the behavioral sciences. I want to write a
    program to help me record data from movie files.
    Currently I have a program that can record the time of a keystroke so
    that I can use that to obtain frequency, duration and other temporal
    characteristics of the behaviors in my movies.

    What I really want, is a way to start playing the movie. Right now I
    have to play the movie, then switch to my program. I would love it if
    it were possible for me to have my program send a message to quicktime
    that says "play." Or any other work around really. If python could
    play the movie, that would work just as well.

    I'm using a mac btw.

    Any suggestions?
    Varnon Varnon, Oct 23, 2009
    #1
    1. Advertising

  2. Varnon Varnon

    Chris Rebert Guest

    On Fri, Oct 23, 2009 at 3:07 PM, Varnon Varnon <> wrote:
    > I'm sure this is a simple problem, or at least I hope it is, but I'm
    > not an experience programer and the solution eludes me.
    >
    > My realm of study is the behavioral sciences. I want to write a
    > program to help me record data from movie files.
    > Currently I have a program that can record the time of a keystroke so
    > that I can use that to obtain frequency, duration and other temporal
    > characteristics of the behaviors in my movies.
    >
    > What I really want, is a way to start playing the movie. Right now I
    > have to play the movie, then switch to my program. I would love it if
    > it were possible for me to have my program send a message to quicktime
    > that says "play." Or any other work around really. If python could
    > play the movie, that would work just as well.
    >
    > I'm using a mac btw.
    >
    > Any suggestions?


    import subprocess
    subprocess.Popen(["open", "path/to/the/movie.file"])

    Docs for the subprocess module: http://docs.python.org/library/subprocess.html
    For information on the Mac OS X "open" command, `man open` from Terminal.

    Cheers,
    Chris
    --
    http://blog.rebertia.com
    Chris Rebert, Oct 23, 2009
    #2
    1. Advertising

  3. Varnon Varnon

    Terry Reedy Guest

    Re: Python help: Sending a "play" command to quicktime, or playinga movie in python

    Chris Rebert wrote:
    > On Fri, Oct 23, 2009 at 3:07 PM, Varnon Varnon <> wrote:
    >> I'm sure this is a simple problem, or at least I hope it is, but I'm
    >> not an experience programer and the solution eludes me.
    >>
    >> My realm of study is the behavioral sciences. I want to write a
    >> program to help me record data from movie files.
    >> Currently I have a program that can record the time of a keystroke so
    >> that I can use that to obtain frequency, duration and other temporal
    >> characteristics of the behaviors in my movies.
    >>
    >> What I really want, is a way to start playing the movie. Right now I
    >> have to play the movie, then switch to my program. I would love it if
    >> it were possible for me to have my program send a message to quicktime
    >> that says "play." Or any other work around really. If python could
    >> play the movie, that would work just as well.
    >>
    >> I'm using a mac btw.
    >>
    >> Any suggestions?

    >
    > import subprocess
    > subprocess.Popen(["open", "path/to/the/movie.file"])
    >
    > Docs for the subprocess module: http://docs.python.org/library/subprocess.html
    > For information on the Mac OS X "open" command, `man open` from Terminal.


    Or, for more control, look at pygame or other Python game frameworks.
    Terry Reedy, Oct 23, 2009
    #3
  4. Varnon Varnon

    Chris Varnon Guest

    Thanks, That works wonderfuly. Once I set quicktimes preferences to
    "play on open" it opens and plays the movie exactly like I want.
    But now I need a line of code to bring python to the front again so it
    can read my input. Any more suggestions?

    On Fri, Oct 23, 2009 at 5:17 PM, Chris Rebert <> wrote:
    > On Fri, Oct 23, 2009 at 3:07 PM, Varnon Varnon <> wrote:
    >> I'm sure this is a simple problem, or at least I hope it is, but I'm
    >> not an experience programer and the solution eludes me.
    >>
    >> My realm of study is the behavioral sciences. I want to write a
    >> program to help me record data from movie files.
    >> Currently I have a program that can record the time of a keystroke so
    >> that I can use that to obtain frequency, duration and other temporal
    >> characteristics of the behaviors in my movies.
    >>
    >> What I really want, is a way to start playing the movie. Right now I
    >> have to play the movie, then switch to my program. I would love it if
    >> it were possible for me to have my program send a message to quicktime
    >> that says "play." Or any other work around really. If python could
    >> play the movie, that would work just as well.
    >>
    >> I'm using a mac btw.
    >>
    >> Any suggestions?

    >
    > import subprocess
    > subprocess.Popen(["open", "path/to/the/movie.file"])
    >
    > Docs for the subprocess module: http://docs.python.org/library/subprocess.html
    > For information on the Mac OS X "open" command, `man open` from Terminal.
    >
    > Cheers,
    > Chris
    > --
    > http://blog.rebertia.com
    >
    Chris Varnon, Oct 24, 2009
    #4
  5. Varnon Varnon

    Chris Rebert Guest

    > On Fri, Oct 23, 2009 at 5:17 PM, Chris Rebert <> wrote:
    >> On Fri, Oct 23, 2009 at 3:07 PM, Varnon Varnon <> wrote:
    >>> I'm sure this is a simple problem, or at least I hope it is, but I'm
    >>> not an experience programer and the solution eludes me.
    >>>
    >>> My realm of study is the behavioral sciences. I want to write a
    >>> program to help me record data from movie files.
    >>> Currently I have a program that can record the time of a keystroke so
    >>> that I can use that to obtain frequency, duration and other temporal
    >>> characteristics of the behaviors in my movies.
    >>>
    >>> What I really want, is a way to start playing the movie. Right now I
    >>> have to play the movie, then switch to my program. I would love it if
    >>> it were possible for me to have my program send a message to quicktime
    >>> that says "play." Or any other work around really. If python could
    >>> play the movie, that would work just as well.
    >>>
    >>> I'm using a mac btw.
    >>>
    >>> Any suggestions?

    >>
    >> import subprocess
    >> subprocess.Popen(["open", "path/to/the/movie.file"])
    >>
    >> Docs for the subprocess module: http://docs.python.org/library/subprocess.html
    >> For information on the Mac OS X "open" command, `man open` from Terminal.


    On Fri, Oct 23, 2009 at 4:05 PM, Chris Varnon <> wrote:
    > Thanks, That works wonderfuly. Once I set quicktimes preferences to
    > "play on open" it opens and plays the movie exactly like I want.
    > But now I need a line of code to bring python to the front again so it
    > can read my input. Any more suggestions?


    Add the -g option so focus isn't given to Quicktime (this is covered
    in the manpage I pointed you to):

    subprocess.Popen(["open", "-g", "path/to/the/movie.file"])

    Also, in the future, try to avoid top-posting (see
    http://en.wikipedia.org/wiki/Posting_style).

    Cheers,
    Chris
    --
    http://blog.rebertia.com
    Chris Rebert, Oct 24, 2009
    #5
  6. Varnon Varnon

    Chris Varnon Guest

    >> On Fri, Oct 23, 2009 at 5:17 PM, Chris Rebert <> wrote:
    >>> On Fri, Oct 23, 2009 at 3:07 PM, Varnon Varnon <> wrote:
    >>>> I'm sure this is a simple problem, or at least I hope it is, but I'm
    >>>> not an experience programer and the solution eludes me.
    >>>>
    >>>> My realm of study is the behavioral sciences. I want to write a
    >>>> program to help me record data from movie files.
    >>>> Currently I have a program that can record the time of a keystroke so
    >>>> that I can use that to obtain frequency, duration and other temporal
    >>>> characteristics of the behaviors in my movies.
    >>>>
    >>>> What I really want, is a way to start playing the movie. Right now I
    >>>> have to play the movie, then switch to my program. I would love it if
    >>>> it were possible for me to have my program send a message to quicktime
    >>>> that says "play." Or any other work around really. If python could
    >>>> play the movie, that would work just as well.
    >>>>
    >>>> I'm using a mac btw.
    >>>>
    >>>> Any suggestions?
    >>>
    >>> import subprocess
    >>> subprocess.Popen(["open", "path/to/the/movie.file"])
    >>>
    >>> Docs for the subprocess module: http://docs.python.org/library/subprocess.html
    >>> For information on the Mac OS X "open" command, `man open` from Terminal.

    >
    > On Fri, Oct 23, 2009 at 4:05 PM, Chris Varnon <> wrote:
    >> Thanks, That works wonderfuly. Once I set quicktimes preferences to
    >> "play on open" it opens and plays the movie exactly like I want.
    >> But now I need a line of code to bring python to the front again so it
    >> can read my input. Any more suggestions?

    >
    > Add the -g option so focus isn't given to Quicktime (this is covered
    > in the manpage I pointed you to):
    >
    > subprocess.Popen(["open", "-g", "path/to/the/movie.file"])
    >
    > Also, in the future, try to avoid top-posting (see
    > http://en.wikipedia.org/wiki/Posting_style).
    >
    > Cheers,
    > Chris
    > --
    > http://blog.rebertia.com
    >


    Wonderful. I totally missed the -g option.
    I use pygame for the input handling currently. Maybe its not the most
    elegant solution, but it's what I knew how to do. I just wasn't sure
    how to do that one last bit.
    Thanks a bunch!

    Also, I typicaly don't post over email lists, so I didn't think about
    the top-posting. This is the prefered method right?
    Thanks again.
    Chris Varnon, Oct 24, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian

    dynamic streaming quicktime qtl

    Brian, Jan 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,436
    Brian
    Jan 25, 2004
  2. Wesley Fraser

    Quicktime in python

    Wesley Fraser, Dec 29, 2003, in forum: Python
    Replies:
    2
    Views:
    1,004
    Wesley Fraser
    Dec 29, 2003
  3. Stefan Tietke

    getting Quicktime video into Python

    Stefan Tietke, Jul 1, 2005, in forum: Python
    Replies:
    0
    Views:
    2,911
    Stefan Tietke
    Jul 1, 2005
  4. jeremito
    Replies:
    11
    Views:
    985
  5. Creegan

    Playing Quicktime movies

    Creegan, Sep 25, 2003, in forum: Javascript
    Replies:
    1
    Views:
    148
    Randell D.
    Sep 26, 2003
Loading...

Share This Page