匿名使用者
匿名使用者 發問時間: 電腦與網際網路程式設計 · 1 0 年前

播放影片速度

vb6用MMControl播放影片時,如何讓播放速度加快,且可以自己設定播放幾倍的速度?

或用DirectShow播放影片時,如何讓播放速度加快,且可以自己設定播放幾倍的速度?

除了用MMControl或DirectShow播放影片之外,還可以用什麼方式~

用過DirectShow播放,好像只有1倍或2倍的播放速度

是否可以自己設成4倍,8倍,16倍....等等

已更新項目:

試著把.Max = 2200 改成.Max = 32000,

執行時HScroll1拉到最右邊,速度32000感覺跟2000的速度一樣~

也試過把HScroll1拉到16000及8000的值,跟.Max = 2200的速度差不多~

好像也是最快的,播放速度只能2倍左右

2 個解答

評分
  • W.J.S.
    Lv 7
    1 0 年前
    最佳解答

    '用mciSendString speed vb到股溝找會找到很多資料

    '表單置一PictureBox,3個CommandButton,1個HScrollBar

    Private Type RECT

    Left As Long

    Top As Long

    Right As Long

    Bottom As Long

    End TypePrivate Type MORP

    dwCallback As Long

    rc As RECT

    End TypePrivate Declare Sub GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal p$, ByVal s$, ByVal f&)

    Private Declare Sub mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal c$, ByVal r$, ByVal u&, ByVal h&)

    Private Declare Function mciGetDeviceID& Lib "winmm.dll" Alias "mciGetDeviceIDA" (ByVal n$)

    Private Declare Sub mciSendCommand Lib "winmm.dll" Alias "mciSendCommandA" (ByVal i&, ByVal m&, ByVal p&, ByRef w As Any)Private Sub Command1_Click()

    Dim p As String, s As String * 255, sz As MORP

    p = "C:\Test.mpg" '檔案路徑

    GetShortPathName p, s, 255

    s = Left(s, InStr(s, Chr(0)) - 1)

    mciSendString "close MyMusic", "", 0, 0

    mciSendString "open " & s & " Alias MyMusic parent " & Picture1.hWnd & " style child", "", 0, 0

    s = String(255, Chr(0))

    mciSendString "status MyMusic window handle", s, 255, 0

    sz.dwCallback = Val(Left(s, InStr(s, Chr(0)) - 1))

    mciSendCommand mciGetDeviceID("MyMusic"), &H843, &H20000, sz

    Picture1.Move 0, 0, sz.rc.Right - sz.rc.Left, sz.rc.Bottom - sz.rc.Top

    mciSendString "play MyMusic", "", 0, 0

    HScroll1 = 1000 '1000是正常速度

    End SubPrivate Sub Command2_Click()

    mciSendString "stop MyMusic", "", 0, 0

    End SubPrivate Sub Command3_Click()

    mciSendString "play MyMusic fullscreen", "", 0, 0

    End SubPrivate Sub Form_Load()

    ScaleMode = 3

    With HScroll1

      .Min = 100: .Max = 2200

      .SmallChange = 100: .LargeChange = 300: .Value = 1000

    End With

    Command1.Caption = "播放"

    Command2.Caption = "停止"

    Command3.Caption = "全螢幕"

    End SubPrivate Sub Form_Unload(Cancel As Integer)

    mciSendString "close MyMusic", "", 0, 0

    End SubPrivate Sub HScroll1_Change()

    mciSendString "set MyMusic speed " & HScroll1, vbNull, 0, 0

    Caption = "速度 : " & HScroll1

    End Sub

    2010-12-25 14:16:52 補充:

    試過2267應是最大值,要再快的話各人認為可以配合seek+speed去作.

  • 6 年前

    到下面的網址看看吧

    ▶▶http://qoozoo09260.pixnet.net/blog

還有問題?馬上發問,尋求解答。