b2dLoadMovie

Category: 2D Overlay

Syntax:

b2dLoadMovie:Int(filename:String)


Parameters

Returns

A movie handle, or 0 on failure



Summary

Opens a video file for playback and returns a handle to it. Ordinary video files are played directly — .mp4, .mkv, .webm, .mov and whatever else the system can decode; there is no special movie format and no converter.

Decoding is done by GStreamer, so which formats work depends on the GStreamer plugins installed. Most .mp4 files are H.264 video with AAC audio, which need the libav plugin; scripts/deps-runtime.sh checks for it. On Fedora and openSUSE, H.264 support comes from RPM Fusion or Packman rather than the official repositories.

The movie's size is known as soon as it loads (b2dMovieWidth, b2dMovieHeight), but nothing is shown until b2dPlayMovie starts it. The whole soundtrack is decoded when the movie loads, so a very long film takes a moment and uses memory in proportion to its length. Call this after b2dGraphics.

Returns 0, printing the reason, if the file is missing, has no video, is a still image, or cannot be decoded with the plugins installed.

View detailed documentation online



Example
movie = b2dLoadMovie("Media/intro.mp4")
If movie = 0 Then
    Print "Could not load the movie"
Else
    b2dPlayMovie(movie)
EndIf

See examples/Runtime/31 - Movies.


BambooBasic © 2026 Michael Denathorn