It is currently Mon Nov 30, 2020 9:46 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: playmovie drives me crazy :'(
PostPosted: Sat Jun 06, 2020 12:41 am 
Offline
New User
New User

Joined: Fri May 03, 2013 10:50 am
Posts: 9
Hello :'(
I copy/paste the movie.pb example from the official documentation...
When i F5 it doesnt work...ok ok....(doesnt work = sound ok but no video)
I open a new tab (ctrl+N) it doesnt work either...ok...ok...(sound ok but no video)
I open another tab (CTRL+N) it works (sound ok and video ok)

it's incredible...i think i will have to do a video capture of this since no one will belive me...

i'm using PB 5.72(x86) on Win10 x64
I must say that some days ago my computer switched off brutally, so i reinstalled PB to be sure that the crash isnt the source of the issue

The code i use (from the documentation) :

Code:

If InitMovie() = 0
  MessageRequester("Error", "Can't initialize movie playback !", 0)
  End
EndIf

MovieName$ = "Sigma.mp4"   ; i edited this line
If MovieName$
  If LoadMovie(0, MovieName$)
 
    OpenWindow(0, 100, 150, MovieWidth(0), MovieHeight(0), "PureBasic - Movie")
    PlayMovie(0, WindowID(0))
     
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  Else
    MessageRequester("Error", "Can't load the movie...", 0)
  EndIf
EndIf



Maybe a config file i must delete? Please help :'(


Top
 Profile  
Reply with quote  
 Post subject: Re: playmovie drives me crazy :'(
PostPosted: Sat Jun 06, 2020 2:29 am 
Offline
Addict
Addict

Joined: Thu Apr 18, 2019 8:17 am
Posts: 1090
Sounds more like your PC (corrupt video drivers) or the video itself is the problem. Have you tried other videos, and other videos after rebooting your PC?

What happens if you move the window a few pixels after the video starts playing? Does it work then?

The example code you posted is 100% perfect, so it's not a PureBasic bug.


Top
 Profile  
Reply with quote  
 Post subject: Re: playmovie drives me crazy :'(
PostPosted: Sat Jun 06, 2020 3:11 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1689
Hi salutcava,

I had a similar problem that may or may not be related; try the following Registry hack:

Code:
If InitMovie() = 0
  MessageRequester("Error", "Can't initialize movie playback !", 0)
  End
EndIf
lpSubKey.s = "SOFTWARE\Microsoft\Direct3D\Shims\EnableOverlays"
lpValueName.s = ProgramFilename() : lpData = 1

If RegCreateKeyEx_(#HKEY_CURRENT_USER, lpSubKey, 0, #Null, #REG_OPTION_VOLATILE, #KEY_SET_VALUE, #Null, @phkResult, @lpdwDisposition) = #ERROR_SUCCESS
  RegSetValueEx_(phkResult, lpValueName, 0, #REG_DWORD, @lpData, SizeOf(LONG))
  RegCloseKey_(phkResult)
EndIf

MovieName$ = "D:\PureBasic\OpenCV_2.4.13.6_WIN_32_SRC_(main)\binaries\videos\ball.mp4"   ; i edited this line
If MovieName$
  If LoadMovie(0, MovieName$)
 
    OpenWindow(0, 100, 150, MovieWidth(0), MovieHeight(0), "PureBasic - Movie")
    PlayMovie(0, WindowID(0))
     
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  Else
    MessageRequester("Error", "Can't load the movie...", 0)
  EndIf
EndIf

If RegOpenKeyEx_(#HKEY_CURRENT_USER, lpSubKey, 0, #KEY_SET_VALUE, @phkResult) = #ERROR_SUCCESS
  RegDeleteValue_(phkResult, @lpValueName)
  RegCloseKey_(phkResult)
EndIf

_________________

STATUS: Comfortably Numb :: Downloads moved to My PureBasic Stuff; access key required.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: playmovie drives me crazy :'(
PostPosted: Sat Jun 06, 2020 6:02 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon May 09, 2011 9:36 am
Posts: 535
Quote:
Windows: as it uses the DirectX technology (DirectShow), any kind of media can be played with this library: AVI, MPG, DivX, etc.


can you Play a .MP4 Movie with PureBasic MoviePlayer code ??

MovieName$ = "Sigma.mp4" ; i edited this line

_________________
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison


Top
 Profile  
Reply with quote  
 Post subject: Re: playmovie drives me crazy :'(
PostPosted: Sat Jun 06, 2020 12:39 pm 
Offline
New User
New User

Joined: Fri May 03, 2013 10:50 am
Posts: 9
-Hello BarryG, thx for your answer :')
Other video were working ok, after rebooting the PC
Using ResizeMovie was unsuccessful :(
I agree, the code is 100% perfect :(

-Hello JHPJHP, thanks for your answer.
You rock. Actually the RegKey was already set before i start your code, so i changed lpdata value from 1 to 0
AND NOW IT WORKS ! You rock !! Thx a lot !

-Hello VB6_to_PBx, thanks for your answer too.
Yes a MP4 can surely be played by movieplay on windows.

Thanks to you three for your answers, now it's fixed with the regkey from JHPJHP.
Issue solved ! You are genius!


Top
 Profile  
Reply with quote  
 Post subject: Re: playmovie drives me crazy :'(
PostPosted: Sat Jun 06, 2020 1:18 pm 
Offline
Addict
Addict

Joined: Thu Apr 18, 2019 8:17 am
Posts: 1090
salutcava wrote:
Using ResizeMovie was unsuccessful

I meant you moving its window with your mouse (manually). Sometimes that makes a video start displaying properly. But we won't know now, because of the RegKey fix.

salutcava wrote:
the RegKey was already set before i start your code, so i changed lpdata value from 1 to 0
AND NOW IT WORKS ! You rock !! Thx a lot !

Interesting! Will have to remember that for future reference.


Top
 Profile  
Reply with quote  
 Post subject: Re: playmovie drives me crazy :'(
PostPosted: Tue Jun 16, 2020 8:22 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Oct 24, 2005 1:05 pm
Posts: 739
It seems to help if ResizeMovie() is called after the window is opened and after PlayMovie() is called.

Don't forget to call FreeMovie() when finished.


Top
 Profile  
Reply with quote  
 Post subject: Re: playmovie drives me crazy :'(
PostPosted: Sat Oct 03, 2020 1:56 am 
Offline
User
User

Joined: Sun Nov 27, 2016 6:38 am
Posts: 37
Hello i had the same problem using mci on windows 10, now i found out the same thing happens with the build in movie commands. The registry solution works for me sometimes. the solution i found for mci also fixes the movie commands in a more reliable way at least on my systems.

quote from the other thread that also applies to the movie lib:
Quote:
I found a strange workaround now. It only fails to load the first video. in this case Film1 is always failing and stays blank, the rest, Film2 and 3 will play fine as long as i don't close the first handle to Film1. It also works with just the open command without playing Film1. Any idea what this strange behavior could be?


Code:
InitMovie()

#Film1 = 0
#Film2 = 1
#Film3 = 2

MovieName$ = OpenFileRequester("Choose the movie to play", "", "Movie files|*.avi;*.mpg;*.mp4|All Files|*.*", 0)
If MovieName$
   LoadMovie(#Film1, MovieName$) ; dummy video to fix future videos
   
   OpenWindow(0, 100, 150, MovieWidth(#Film1), MovieHeight(#Film1), "PureBasic - Movie")
   
   PlayMovie(#Film1, WindowID(0)) ; Broken! will play a Blank video, the following videos also work with this line commented out
   ;FreeMovie(#Film1) ; If i close here Film2 won't work either and only Film3 will play, otherwise both work
   
   LoadMovie(#Film2, MovieName$)
   PlayMovie(#Film2, WindowID(0))  ; Plays Fine
   
   LoadMovie(#Film3, MovieName$)
   PlayMovie(#Film3, WindowID(0))  ; Plays Fine
   ResizeMovie(#Film3, 0, 0, 100, 100)
   
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


one more note: Film1,2,3 don't have to be the same file, it can be 3 different video files and it will still work.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye