Best video format for AGS

Started by KodiakBehr, Wed 02/09/2015 19:07:59

Previous topic - Next topic

KodiakBehr

Was debating which forum to post this in, so no worries if it needs relocation.

Until now, we've been implementing video in .ogv format for the usual obvious reasons.  Problem is no matter how the video is compiled, the framerate just isn't as smooth in AGS as I would like.

With this in mind, is there any reason why we wouldn't want to use a MP4 with the H.264 codec instead?  That's pretty much as universal as it gets, isn't it?

Cassiebsg

What about xvid, isn't that one free too?
There are those who believe that life here began out there...

selmiak

xvid is getting old and has its flaws. MP4 with H.264 inside or .MKV with H.264 inside should be first on the list of video compatibility for AGS, especially with the new HD resolutions in AGS. After that of course XVID.

Problem

Is there a way to check from inside AGS if a video has been successfully played? (I don't think so, because PlayVideo doesn't return anything.) This would allow us to use H.264 and have a fallback OGV if for some reason it doesn't play.

abstauber

Using h.264 would be no option for commercial developers (same as mp3), because of the pretty steep licensing fees.

Monsieur OUXX

Also, does H.264 do lossless? That's important for low-res games.
 

Snarky

I would argue that even in a low-resolution game, there are very few use-cases for lossless video. Video is much more forgiving of minor compression artifacts, since because each frame is displayed for a very short moment, you don't have time to study it and notice them. A high-quality lossy encoding should be indistinguishable in practice and save a lot of storage. If you do need absolutely lossless video, you can just import the frames as sprites and display them as an animation.

In any case, x264 apparently allows encoding lossless into h.264 format: https://stackoverflow.com/questions/768999/what-is-a-good-lossless-video-codec

Monsieur OUXX

#7
Quote from: Snarky on Thu 03/09/2015 10:33:55
I would argue that even in a low-resolution game, there are very few use-cases for lossless video. Video is much more forgiving of minor compression artifacts, since because each frame is displayed for a very short moment, you don't have time to study it and notice them. A high-quality lossy encoding should be indistinguishable in practice and save a lot of storage. If you do need absolutely lossless video, you can just import the frames as sprites and display them as an animation.

In any case, x264 apparently allows encoding lossless into h.264 format: https://stackoverflow.com/questions/768999/what-is-a-good-lossless-video-codec

yeah but sometimes you want to do sequences that look like actual gameplay, but without going through the hassle of scripting the whole thing. And in a pixel-art game, the transition between "real" gameplay" and video is not seemless if the codec is not lossless. That was a problem in many 90's games, such as Heart of Darkness.

If H.264 allows encapsulating lossless codecs such as x264, then I'm happy.
 

abstauber

About h.264 again: according to the MPEG-LA, everything under 100.000 units is free, after that, it's 0.20$ per "encoder", which I suppose can be interpreted as a game. So for most of us, h.264 pricing shouldn't be a big deal - even for the commercial devs.

Btw. this is also a quite interesting read:
http://www.gamasutra.com/view/news/170671/Indepth_Playing_with_video.php


KodiakBehr

Thanks for pointing out this information to us -- this is something I'm afraid I would have overlooked otherwise.  I guess we'll pursue the H.264 and see about obtaining a license.

abstauber

Honestly this was more a pointer towards OGV ;)
But since I haven't worked with videos in AGS since .flc, I obviously have no idea how good the Theora implementation is.

Problem

It's pretty bad unfortunately. I don't know why, but the built-in video playback just doesn't run smoothly, at least for high resolution games. On some PCs even the audio stutters. Other video formats work much better, maybe because they are not played by AGS? Of course the best solution would be to improve the performance of the built-in OGV playback, because it doesn't depend on any codecs being installed, but for now we'll try our luck with H.264.
I don't know much about Windows codecs, is it safe to assume that the H.264 codec is installed on current Windows machines?

KodiakBehr

H.264 is supposed to be pretty universal.  However, AGS delivered an interesting error when it attempted to play an external .mp4.  Note that I have no trouble running this .mp4 outside of AGS, but when being called through AGS, it says:



This is a message generally associated with a filter/codec absence.  But the video runs just fine outside of AGS, so I'm at a loss for explaining why things are different inside.  Is this an engine bug?

Cassiebsg

My guess is that Allegro does not have the codec to render the video, and therefor gives that error.
You have no idea how many head bangs I have given cause VirtualDub refuses to load any mp4 file, or mkv, or... >:(
There are those who believe that life here began out there...

Problem

This has nothing to do with Allegro. The AGS manual says that AGS plays anything supported by Windows Media Player.

Monsieur OUXX

Quote from: Problem on Wed 09/09/2015 19:48:15
This has nothing to do with Allegro. The AGS manual says that AGS plays anything supported by Windows Media Player.
You said the vido plays well outside of AGS, but with what player? For example if you use VLC they have their own codecs embedded, they don't care about what's on your system.
 

KodiakBehr

It ran perfectly in Windows Media Player.  With no idea why we're having issues with MP4s in AGS, we're currently trying to make do with Theora, which is good for the universality and the lack of codec licensing issues.  We're dropping the framerate and resolution a fair bit, but it still chugs...just a little less so.

Cassiebsg

I'm not sure what frame rate you are using, but keep in mind that animated series/movies only normally use 15fps. Your video is mostly still pics, so you could probably drop the rate fairly low with still decent show... or import the "spites" and code the intro in AGS. (Which am currently considering for my own intro, since I haven't had much success playing AGS videos on my system so far).
There are those who believe that life here began out there...

Problem

The camera zooms and parallax layers in the video can't be done in AGS at this resolution, so the intro would have to be a lot simpler without a video. We've dropped the framerate a bit, which makes the video playback more stable. 15fps is too low though, the camera movement doesn't look good this way. But I think with careful testing we can find a compromise between video quality and smooth playback.

abstauber

Did you already try AJA direct3d plugin?
http://www.adventuregamestudio.co.uk/forums/index.php?topic=45348.0

Since it seems like it addresses D3D directly, you might see better performance - or at least you can corner the culprit ;)

SMF spam blocked by CleanTalk