Anyone using Avisynth?

Started by naltimari, Wed 14/05/2008 19:37:46

Previous topic - Next topic

naltimari

I'm still investigating, but in my game I intend to use Avisynth to handle the videos. In short, Avisynth is an open-source app that acts as a proxy to WMP. Which means that in AGS, you just have to call PlayVideo and point it to an '.avs' file, which is an Avisynth 'script'.

I'm sure this explanation is overly simplified, and my english is not very good, so you'd rather visit the site to understand it better than take my word for it. But the advantages, from an AGS game designer perspective, are:


  • You can distribute the codec along with the game (the codec is just a dll file, unlike traditional win32 'codecs' which have to be installed), thus alleviating the user from the hassle of finding the right codec and installing it. I'm sure Avisynth can be installed on the user's system easier than a third party codec (like Xvid);

  • Avisynth has a lot of filters you can apply to your video, like transformations, transitions, and even text (you can subtitle your clip, for example), because its scripting language allows you to do so;

  • Avisynth has a plug-in architecture, and there are some streaming plugins around that allow for video over the network (hasnt done much research on this, but i think its possible);

  • You can mix two or more video clips, with audio, so you can achieve all kinds of effects, like voice overs, effects/music/no-music, etc. You can even 'make' a video out of a couple of still pictures!

  • Instead of just playing videos full-screen, Avisynth could be used to play video 'inside' the game screen, if only you take a snapshot of the screen prior to playing the video, then 'composite' the video inside the snapshot using the Avisynth scripting language.
As soon as I'm done with it, I intend to post a new thread explaining it, but if you guys want to do some research on your own and exchange information via PM, that would be awesome.

Avisynth has a huge following among video editors, and a huge community also. I think it would be a great addition to an AGS game designer's toolbox.

Rui 'Trovatore' Pires

QuoteAvisynth could be used to play video 'inside' the game screen

This in particular interests me A LOT. And if regular AGS processing could go on in the meantime (even if non-interactible - a cutscene would do) it would be even perfect...
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

GarageGothic

QuoteInstead of just playing videos full-screen, Avisynth could be used to play video 'inside' the game screen, if only you take a snapshot of the screen prior to playing the video, then 'composite' the video inside the snapshot using the Avisynth scripting language.

But pressumedly this wouldn't work during gameplay? You could just have static screens while the video plays? E.g. the player character sits down and turns on the tv. The video plays. He gets up and you resume gameplay.

Nevetheless, it's an interesting technology. And whether it's Avisynth or Ogg Theora, I'd be happy to see an AGS video format not dependent on installed codecs.

Rui 'Trovatore' Pires

But I'd like to, say have a border around the video. Maybe even some AGS-scripted subtitles, to be played during the video playback. Something for a Temujin-style game, for instance.

Of course it would be awsome if we could also have something Urban-Runner style - actually be able to play as the movie progresses. But at the moment you can fake it with lots of frames AND it's not something that's likely to be made any time soon, realistically, so it's ok.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

naltimari

Quote from: Rui 'Trovatore' Pires on Wed 14/05/2008 22:16:26
This in particular interests me A LOT. And if regular AGS processing could go on in the meantime (even if non-interactible - a cutscene would do) it would be even perfect...

Unless i'm mistaken, while PlayVideo is working its magic, the screen is no longer controlled by AGS, but by WMP. Then, to mix an AGS cutscene and video you would have to use an Avisynth script, because it HAS the control of the screen (although indirectly, via WMP).

But you would have to convert your cutscene into a 'video', in order to Avisynth to 'play'. Avisynth scripting language is pretty powerful, but I wonder if it's worth the trouble to code a cutscene in it... but i guess it's possible, if you really like to experiment... ;)

My suggestion was waaaay simpler than that, just take a snapshot of the room, for example, one that has a large LCD screen next to your character, and then, inside Avisynth script, compose the snapshot (which would be a PNG file sitting somewhere) with the video, using Avisynth commands to size & position the video right inside the LCD screen.

Rui 'Trovatore' Pires

That would be enough for the "border" effect. ;D (yeah, I know I can just put the borders in the video, but I don't really like that "look")

Just wish I could AGS-code subtitles for while movies display... ah well, maybe this Xmas Santa will surprise me! :D
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

naltimari

Quote from: Rui 'Trovatore' Pires on Wed 14/05/2008 22:51:17
Just wish I could AGS-code subtitles for while movies display... ah well, maybe this Xmas Santa will surprise me! :D

This certainly can be done, all you have to do is make an avisynth script with text commands (the subtitles) and fire it up in AGS with PlayVideo. Since avisynth scripts are text files, you can even generate them on the fly, prior to calling PlayVideo.

Rui 'Trovatore' Pires

Hmmm, I couldn't control them from AGS, with all the slight nuances available... but nevertheless, it might be more than enough for my needs - or should I say dreams, as I don't *need* any of this now.

Super!!!
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

GarageGothic

Quote from: naltimari on Wed 14/05/2008 22:56:29This certainly can be done, all you have to do is make an avisynth script with text commands (the subtitles) and fire it up in AGS with PlayVideo. Since avisynth scripts are text files, you can even generate them on the fly, prior to calling PlayVideo.

If it was possible to parse the name of the AGS translation file to Avisynth, would Avisynth scripts be able to display language-specific subtitles? 

Rui 'Trovatore' Pires

Hmm, that could probably be done by generating the script on-the-fly, as suggested, or just by having as many scripts as there are languages, and then in AGS finding out which tranlsation is being used and play the correct script.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

GarageGothic

Ah yes, if the script was generated on-the-fly with AGS file commands, then the alternate language Strings could be retrieved directly from the translation file itself.

naltimari

Quote from: GarageGothic on Wed 14/05/2008 23:12:04
Ah yes, if the script was generated on-the-fly with AGS file commands, then the alternate language Strings could be retrieved directly from the translation file itself.

Yes. Avisynth supports 'traditional' subtitle file formats, like .srt, .ssa, etc, so you would have to supply one subtitle file for each language, and generate the script on-the-fly to match the movie and the appropriate language.

It could be done with multiple audio tracks too. I mean, you could have one video track and several audio tracks, and have avisynth play the selected audio track according to the language it is running on (supposing each audio track is in a different language).

This really opens up a lot of possibilites... :)

LimpingFish

Indeed. :)

I'll be interested to see where this goes, and how practical it would be to use.
Steam: LimpingFish
PSN: LFishRoller
XB: TheActualLimpingFish
Spotify: LimpingFish

TheMagician

This really sounds interesting.
Especially the "one video - multiple audio files" thing.

Thanks Naltimari for bringing this to our attention.

Dualnames

Good job, that might actually kill us all... in a good way. Good job for pointing it out.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk