Page 1 of 1

MP4 Movies

Posted: Sat Apr 05, 2014 8:19 am
by chris319
Might PB someday handle MP4 movie playback?

Re: MP4 Movies

Posted: Sat Apr 05, 2014 8:44 am
by PB
It does. Well, it uses whatever codecs you have installed. So install 'em for MP4. ;)

Re: MP4 Movies

Posted: Sat Apr 05, 2014 9:47 am
by chris319
I think I have the codec. I can play mp4 files with Windows Media Player but no joy with the PB movie functions. The video is H.264.

Re: MP4 Movies

Posted: Sat Apr 05, 2014 11:11 am
by c4s
Just tested it. Works here without any problems.

Re: MP4 Movies

Posted: Sat Apr 05, 2014 11:59 am
by PB
Yep, been playing MP4s for many years with PureBasic.

Here's the stats of one such video (H264 like you) as shown by Media Player Classic:

Code: Select all

Video: MPEG4 Video (H264) 1280x720 23.976fps 2772kbps [Video]

ID                             : 1
Format                         : AVC
Format/Info                    : Advanced Video Codec
Format profile                 : High@L3.1
Format settings, CABAC         : Yes
Format settings, ReFrames      : 1 frame
Codec ID                       : avc1
Codec ID/Info                  : Advanced Video Coding
Duration                       : 3mn 17s
Bit rate                       : 2 773 Kbps
Maximum bit rate               : 5 029 Kbps
Width                          : 1 280 pixels
Height                         : 720 pixels
Display aspect ratio           : 16:9
Frame rate mode                : Constant
Frame rate                     : 23.976 fps
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Scan type                      : Progressive
Bits/(Pixel*Frame)             : 0.125
Stream size                    : 65.3 MiB (93%)

Re: MP4 Movies

Posted: Sat Apr 05, 2014 1:06 pm
by ts-soft
MP4 works fine here:

Code: Select all

EnableExplicit

InitNetwork() : InitMovie()

Define.s video = "http://www.annettlouisan.de/1/video/deinding.mp4"
Define.s file = GetTemporaryDirectory() + GetFilePart(video)

If FileSize(file) <= 0
  ReceiveHTTPFile(video, file)
EndIf

If LoadMovie(0, file)
  OpenWindow(0, #PB_Ignore, #PB_Ignore, MovieWidth(0), MovieHeight(0), "Annett Louisan - www.annettlouisan.de")
  PlayMovie(0, WindowID(0))
  While MovieStatus(0) <= 0
    Delay(10)
  Wend
  Repeat
    Select WaitWindowEvent(100)
      Case #PB_Event_CloseWindow
        Break
      Case 0
        If Not MovieStatus(0)
          Break
        EndIf
    EndSelect  
  ForEver
EndIf

Re: MP4 Movies

Posted: Sat Apr 05, 2014 2:32 pm
by BasicallyPure
Using ts-soft's code the movie downloads to the temp folder ok but PureBasic does not play it.
The movie plays fine with Windows media player or VLC media player.

I'm using Windows 7 Home premium (x64) service pack 1.

Re: MP4 Movies

Posted: Sat Apr 05, 2014 2:43 pm
by ts-soft
I think you have to change the priority of codecs. You can use this tool:
http://www.majorgeeks.com/files/details ... er%29.html