Re: VB6 and Video Part 2

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Trying the Quartz.
Plays wmv.
Does not play the AVI that the mciSendString played.
Need the AVI capability becuase that is what comes off my camera.
Your sample code did not work.
I had other sample Quartz code that does work for wmv.

Is there some tweak to something to tell quartz to accept AVIs ?
I used 'Type MPEGVideo' with mcisendstring to get the AVI to play there.
What's needed for quartz?


"Mike Williams" wrote:

"Lorin" <Lorin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:80DD5CF5-BF6C-4845-85D0-2003A6853BFA@xxxxxxxxxxxxxxxx

Thanks for all the help so far with mciSendString.
. . . . . Works like a champ ... but The last and final
question is . . . . . -

I don't believe that, Lorin! Surely you can't mean that? "The last and final
question"? Sheesh! The last and final question I ask will be the question I
ask immediately before I die! I'm not sure what it will be yet, but it won't
be more than about 15 years away I reckon, and I'm working on it ;-)

Now that I can place the video in a PictureBox,
how do I set the size of the video? [big snip] If
I do not use the PictureBox and use the native#
screen, I can drag the corner and get any size video
screen I want. I want the flexibility of the PictureBox
(drag, menu etc). I have looked at the docs and on
newsgroups but cannot find how to tell the mci to set
the video size.

I'm really not very heavily "into" this video stuff, Lorin, but whenever I
want to play a video in VB6 (which admittedly, as an "oldie", is not very
often because we usually "listen to the wireless"!) I use the Active Movie
Type Library, which lives in Quartz.dll and which is installed by default on
all versions of Windows (certainly on all versions from Win98 to Vista) and
which therefore does not require you to distribute anything with your VB6
exe file.

Here is an example which plays a mpg video and which sizes the video to the
current size of the Picture Box. Paste the code into a VB Form containing a
Picture Box and a Command Button. Obviously, you will need to change the
hard coded .mpg path to an .mpg file that exists on your own system.

You will also need to use the VB IDE Project / References menu and scroll
down the list and place a tick against Activemovie control type library. If
you cannot find it in the list then click the "Browse" button and browse to
System32/Quartz.dll. You don't need to worry about this stuff for your
compiled exe because Quartz.dll is already installed and registered on all
versions of Windows (at least on all versions that I have used).

Anyway, paste in the following code and run the program and click the
button.

Mike

Option Explicit
Private m_objVideoWindow As IVideoWindow
Private m_objMediaControl As IMediaControl
Private Const WS_VISIBLE = &H10000000

Private Function OpenVideo(Filename As String, _
display As PictureBox) As Boolean
display.ScaleMode = vbPixels
OpenVideo = True
On Error GoTo videoNotLoaded
Set m_objMediaControl = New FilgraphManager
Call m_objMediaControl.RenderFile(Filename)
Set m_objVideoWindow = m_objMediaControl
m_objVideoWindow.WindowStyle = WS_VISIBLE
m_objVideoWindow.Top = 0
m_objVideoWindow.Left = 0
m_objVideoWindow.Width = display.ScaleWidth
m_objVideoWindow.Height = display.ScaleHeight
m_objVideoWindow.Owner = display.hWnd
Exit Function
videoNotLoaded:
OpenVideo = False
End Function

Private Sub Command1_Click()
If OpenVideo("c:\temp\kate.mpg", Picture1) Then
m_objMediaControl.Run
Else
MsgBox "Cannot open video file."
End If
End Sub






.



Relevant Pages

  • Re: avi playback problem
    ... What video codec is used in that AVI? ... > plays at a slow, choppy speed that is way out of sync with the audio. ...
    (microsoft.public.windowsmedia.player)
  • Re: VB6 and Video Part 2
    ... Is there some tweak to something to tell quartz to accept AVIs? ... I used 'Type MPEGVideo' with mcisendstring to get the AVI ... Plays AVI files with no problems at all. ... I only really "dabble" in this stuff and I don' know very much about it (which is why I asked for Mike D for more info on MCI in the previous thread on this subject). ...
    (microsoft.public.vb.general.discussion)
  • Re: Vegas will not open video converted from FLV properly
    ... Video Converter to convert an .FLV Youtube video to AVI format. ... Player plays the resulting AVI video fine! ...
    (rec.video.desktop)
  • loading video with simulink & running model error
    ... Currently, when I try to load in an avi video into simulink, it ... plays rather slowly. ... avi file is uncompressed and is 20 seconds of a sports game footage. ...
    (comp.soft-sys.matlab)
  • Re: Vegas will not open video converted from FLV properly
    ... Video Converter to convert an .FLV Youtube video to AVI format. ... Player plays the resulting AVI video fine! ...
    (rec.video.desktop)