MP4 Movies

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

MP4 Movies

Post by chris319 »

Might PB someday handle MP4 movie playback?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: MP4 Movies

Post by PB »

It does. Well, it uses whatever codecs you have installed. So install 'em for MP4. ;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: MP4 Movies

Post 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.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: MP4 Movies

Post by c4s »

Just tested it. Works here without any problems.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: MP4 Movies

Post 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%)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: MP4 Movies

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
BasicallyPure
Enthusiast
Enthusiast
Posts: 539
Joined: Thu Mar 24, 2011 12:40 am
Location: Iowa, USA

Re: MP4 Movies

Post 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.
BasicallyPure
Until you know everything you know nothing, all you have is what you believe.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: MP4 Movies

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply