Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Newbie Question regarding video playback.

This thread is locked; no one can reply to it. rss feed Print
Newbie Question regarding video playback.
beleaver
Member #16,154
January 2016

First off, this is my first touch with Allegro 5.

I wanted to insert a video as an intro to a game I'm developing (just to get to know the basics) but I think I am missing too many things.

Although I included <allegro5/allegro_video.h> the following assertion always fails:

ALLEGRO_VIDEO* video = NULL;
video = al_open_video("video.mp4");
assert(video);

I've tried different video formats.
Obviously I am missing how to make this Visual Studio 2013 project support these kinds of formats somehow.

Could anyone point me to the right direction?

Thanks for your time if you have kept reading till here!

Bruce Pascoe
Member #15,931
April 2015
avatar

Did you call al_init()?

Peter Hull
Member #1,136
March 2001

beleaver
Member #16,154
January 2016

First off, thank you for your responses.

I will try to provide more information cause i get that helping me now is more than just a line (that i hoped).

First things first I'm running Allegro.5.1.12.4 (as supplied from NuGet packages), where
al_init_primitives_addon();
al_install_keyboard();
al_init_font_addon();
al_init_ttf_addon();
al_init_image_addon();

are perfectly acceptable but not al_init_video_addon();

Here i'd like to point out, that i do have managed to get the game running with bitmaps and audio, but i get a not defined error for the video addon.

I have come across this video addon ("https://github.com/liballeg/allegro5/tree/5.1/addons/video").

Is this something i have to add on my own? And after adding it do i have to compile something from the start? (cause i didn't compile allegro in the first place, just got what nuget packages provided as is).

Thank you again for your time!

Peter Hull
Member #1,136
March 2001

I tried with this program:

#include <allegro5/allegro.h>
#include <allegro5/allegro_video.h>

int main() {
  if (al_init() && al_init_video_addon()) {
    ALLEGRO_VIDEO* video = al_open_video("320x240.ogv");
    /* Rest of program...! */
    return 0;
  }
  else {
    return 1;
  }

}

and the Allegro nuget package same as yours. I haven't had time to look any more but at least it loads up the video ( video is not null)

Have you tried the allegro video addon example?

Hope that helps

beleaver
Member #16,154
January 2016

Thank you so much, i tweaked a little the code and now i can se an .ogv video before the game as an intro.

So i guess here comes a final Question (or one of them since my biggest problem got solved, and really thank you for that).

What formats from videos can be loaded?
.OGV file loaded successfully, but mp4 kept returning null.

Is there any way to make it happen with the mp4 quality?

Of course what i have till now is something i can work with on amateur level, the question is so i can understand better the nature of video and allegro working together.

SiegeLord
Member #7,827
October 2006
avatar

Currently only OGV is supported. MP4 and others are in principle possible (the code is mostly there), but it's just very hard to support as the library we use for decoding is hard to work with (especially on Windows).

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

beleaver
Member #16,154
January 2016

Okay, thanks for informing me about that.

Is there any place to post the code as a demo or something, to help others when I'm done?

SiegeLord
Member #7,827
October 2006
avatar

If you want, you could write a mini tutorial here: https://wiki.allegro.cc/index.php?title=Allegro_5_API_Tutorials

Alternatively, just post your code here and someday somebody might find it via search.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Go to: