Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Video Addon - al_open_video() always returns null

This thread is locked; no one can reply to it. rss feed Print
Video Addon - al_open_video() always returns null
chundermike
Member #16,629
January 2017

Hi,

I'm trying to use the Allegro 5.2.2 video addon, but al_open_video() always returns NULL. al_init_video_addon() is returning ok, and the file I'm trying to open is in the expected place. I've even tried the example in github (https://github.com/liballeg/allegro5/blob/5.1/examples/ex_video.c) and even that doesn't work. I've tried many types of video file (mpg, mp4, off, wmv) and they all return null when I try to open them. I've tried Windows, linux and Raspberry Pi environments and they all have the same problem.

I'm thinking now it's something to do with not having a backend (ogg or ffmpeg) installed, but I've absolutely no idea how to do this. I can't find anything on the web anywhere explaining what to do.

Could someone please explain how I can get the video addon working please? (Windows preferably, but ideally linux too).

Many thanks in advance,
Mike

SiegeLord
Member #7,827
October 2006
avatar

The extension needs to be .ogv, and the contents need to have the theora codec for video and optionally ogg codec for audio. I've attached a test video you can try.

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

chundermike
Member #16,629
January 2017

Thanks for the quick reply. I tried your example and it worked fine :)

So I guess I'll have to convert all my videos into ogv format (using ffmpeg) now?

Would the only way to write an app which accepts other formats (such as mp4) be to use a different addon (or code it myself)?

Also I have seen the ffmpeg backend mentioned as being supported in the past, but if I understand correctly this has been removed due to stability issues? If this were re-instated would it be capable of accepting non-ogv video formats?

Many thanks again,
Mike

SiegeLord
Member #7,827
October 2006
avatar

So I guess I'll have to convert all my videos into ogv format (using ffmpeg) now?

Yep.

Quote:

Would the only way to write an app which accepts other formats (such as mp4) be to use a different addon (or code it myself)?

Basically, yeah.

Quote:

Also I have seen the ffmpeg backend mentioned as being supported in the past, but if I understand correctly this has been removed due to stability issues? If this were re-instated would it be capable of accepting non-ogv video formats?

For better or worse, ffmpeg likes to change its APIs very often and what used to be in Allegro stopped working at some point. I spent a bit of time trying to get it to work without much success, so in an effort to get the video addon to be released with Allegro 5.2 at all, that backend got removed. It'll take a bit of work to get it back (e.g. I would consider the refactoring proposed in https://github.com/liballeg/allegro5/issues/604 to be the essential start), but there's no philosophical reason why it can't be done.

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

chundermike
Member #16,629
January 2017

Many thanks again

Just one last question on this topic if you don't mind...can I have more than one instance of an ALLEGRO_VIDEO and, if so, how I distinguish between their different ALLEGRO_EVENT_VIDEO_FRAME_SHOW events? (Sorry I cannot find much documentation on the ALLEGRO_EVENT_VIDEO_FRAME_SHOW type to indicate if it has any fields)

Thanks,
Mike

SiegeLord
Member #7,827
October 2006
avatar

ALLEGRO_EVENT_VIDEO_FRAME_SHOW is a user event with event.user.data1 field set to the video pointer.

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

Thomas Fjellstrom
Member #476
June 2000
avatar

Would you be able to also check the event source? I imagine it should get set to something useful like other events?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Go to: