Playing MPEG Video

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Gene
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 75
Joined: Wed Mar 09, 2011 6:48 pm

Playing MPEG Video

Post by Gene » Fri May 20, 2011 6:51 pm

Hello - I am posting this in the Windows Forum because I want to deliver MPEG video on Windows platform without requiring the end user to install QT. I've scoured the forums and User Guide for a clear cut answer on how to do this, but have come up with only bits and pieces of an answer. Maybe someone knows what to do.

I think that LC will play MPEG files through the native windows media player, both because the User Guide indicates that it will, and because I can do it in the authoring environment under some cirumstances. I can make it work by doing the following.

1. Issue a "dontuseqt" command before doing anything else. I have been doing this from the message box, or from a preopen stack handler, and either one works.
2. Manually create a player from the object menu to a card.
3. Manually determine a path to an external .mpg file in the player's property inspector. The first frame of the mpg file then appears on the card, paused.
4. Issue a start player command, and the video begins to play. Stop player will pause the video again.

Problem solved? No.

When I save the stack and then reopen it, the player is there, the video shows up in the source field of the player's property inspector, but the video itself stubbornly refuses to appear.

What am I doing wrong? The solution seems to be so close, yet so far. Any help will be appreciated.

Gene

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Playing MPEG Video

Post by Mark » Sat May 21, 2011 10:45 pm

Hi Gene,

Does your stack contain, any (and I really mean ANY) scripts at all?

Have you turned off "load QuickTime on startup" in the LiveCode preferences?

What is the exact path to the movie according to the property inspector? Please, copy and paste that path here. Don't modify it.

Have you moved the location of the movie, the stack, or both to a different directory?

You can always try toggling the alwaysBuffer of the player object.

Why do you write "issue a start player command"? Why don't you simply press the play button? Have you tried pressing the play button after re-opening the stack?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing MPEG Video

Post by Klaus » Sun May 22, 2011 12:15 pm

Hi Gene,

just to be sure: we are talking about MPG1 video files?
These should indeed work.

EDIT
Hint: The "movie controller" is a QuickTime ONLY feature!
So you need to supply your own controls for start/stop etc. when NOT using QuickTime.


Best

Klaus

Gene
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 75
Joined: Wed Mar 09, 2011 6:48 pm

Re: Playing MPEG Video

Post by Gene » Sun May 22, 2011 5:35 pm

Bingo! Problem solved! Much thanks to both Mark and Klaus for replying, because I really wanted to know that LC would play video other than QT.

The key element was suggested by Mark, which is Turn off "Load QT at Start" in the preferences.

Early on I discovered that you had to use a "dontuseqt" command to make the MPEG-1 video work, but it didn't do any good after the stack was saved and reloaded, even though I used "dontuseqt" in the preopen stack handler (the earliest that I could think of to get it established). Again, however, QT has to be prevented from loading in the preferences regardless of the "dontuseqt" script. The odd thing is that I don't have QT on the machine, but what the heck, the technique works.

Mark - you asked about the "start movieplayer" command. As Klaus pointed out, the player object only deals with QT, so the controller doesn't show up. But, I knew that I would have to create my own controls, which is not a bad thing anyway. "Start Player" and "Stop Player" both work nicely. The next step is to explore just what I can do to control the position of the video playback, and to poll the position for possible use in bookmarks. What puzzles me is that I do have a player object present (even without QT), and I can use it's properties to determine the path to the MPEG file, and the size of the video on the screen. So, it seems that the player object is necessary. By the way, it seems that the player object can be introduced just as easily with script as from the tools menu.

So...my intuition is that, if denied the use of QT, then the player object will use the native Windows Media Player machinery for video playback, and probably will digest any codec that the particular flavor of Windows Media Player that is on the playback machine will deal with (including, perhaps, DVD quality MPEG-2). I'm going to tinker with that, and what kinds of trick things can be done to controlling playback from script.

Thanks again guys, I really appreciate the help. I'm just getting started with LC, and have been keeping my fingers crossed that it has a rich enough feature set to replace what I have been using in the past. You helped me keep the faith!

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing MPEG Video

Post by Klaus » Sun May 22, 2011 6:45 pm

Hi Gene,

glad you got it working!

MPG1 files should be even playable with the "play videoclip XYZ" command.
Maybe that will wok for you? No fiddling around with "dontuseqt" etc. 8)


Best

Klaus

mhoneywill
Posts: 66
Joined: Fri Feb 05, 2010 7:31 pm

Re: Playing MPEG Video

Post by mhoneywill » Sun May 22, 2011 8:42 pm

What would be really great would be if LC could somehow interface with VLC http://www.videolan.org/vlc/ to use that as its video engine.

It is multi-platform and does not come with all the baggage of QT, but not sure how the licencing would work as its GPL.

These pages look interesting, and might give a clue to interfacing it to LC

http://wiki.videolan.org/Documentation:WebPlugin
http://code.google.com/p/vlcj/
http://www.capricasoftware.co.uk/vlcj/index.php
http://wiki.videolan.org/Libvlc

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Playing MPEG Video

Post by Mark » Sun May 22, 2011 9:29 pm

mhoneywill,

You can control VLC from the command line, for example to play movies full-screen. It should also be possible to set up VLC as a server and display the movies in revBrowser, but I never tried that.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Gene
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 75
Joined: Wed Mar 09, 2011 6:48 pm

Re: Playing MPEG Video

Post by Gene » Sun May 22, 2011 11:54 pm

Klaus wrote:Hi Gene,

glad you got it working!

MPG1 files should be even playable with the "play videoclip XYZ" command.
Maybe that will wok for you? No fiddling around with "dontuseqt" etc. 8)


Best

Klaus
Hi Klaus - thanks for the extra feedback. I tried "play videoclip xyz.mpg," and got back "could not create movie reference." BTW, I had imported the video into the stack.

I tried the command both from the command line, and a mousdown handler on a button a card with no joy. I think I'm happy for the time being using the player object aalong with the preconditions already discussed. There doesn't seem to be much extra work or grief in that. Also, I think I'm more comfortable holding video files external to the executable rather than imported into the stack. It's unsubstantiated at this point, but I have a fear that the extra payload might impair the load time of the standalone program. Anyway, it makes it easier to update the videos if they are outside the main program.

Thanks again - Gene

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing MPEG Video

Post by Klaus » Mon May 23, 2011 12:30 pm

Hi Gene,

although your MPG1 files do not seem to work, you do NOT need to IMPORT
video- or audioclips to be able to play them with the "play" command"!
This will also work for external files.


Best

Klaus

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing MPEG Video

Post by Klaus » Thu Oct 18, 2012 10:45 am

Hi friends,

maybe this is of interest for you?
http://forums.runrev.com/phpBB2/viewtop ... =4&t=13168


Best

Klaus

Post Reply