Homesource Forums

Homeworld Source Editing Talk
It is currently Fri Sep 19, 2014 2:45 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 26 posts ] 
Author Message
 Post subject: Animations && Interludes
PostPosted: Thu Dec 07, 2006 3:11 pm 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

I've been inspecting the code relating to the animations which exist between levels and start the whole game. I've converted most of the Bink files into AVIs and I'm going to see how feasible it'll be to play them under our respective OSs. I would assume that it'll be fun but it should keep me out of trouble for a while.

If anyone has any objection to using AVI's or has an alternate suggestion. (I'm working on the sound first....) then let me know.

Similarly I'll try and keep the stuff I'm working on #ifdef'd out of the way of anything else so it shouldn't break anything, but I'd like to commit every now and again then I don't lose anything. :)

Aunxx.


Top
 Profile  
 
PostPosted: Thu Dec 07, 2006 3:27 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 14, 2004 12:41 am
Posts: 326
aunxx wrote:
... I've converted most of the Bink files into AVIs and I'm going to see how feasible it'll be to play them under our respective OSs.


Be aware that redistributing the avi's drectly will be a direct copyright infringement as the bink files are not in the source, and are thus not covered by the RDN license or the exceptions to that license granted by Relic.

If, on the other paw, Relic has made the bink cutscenes, or translations thereof in other media, directly available to the public before this then we can work with that... otherwise you might have to settle for issuing bink conversion instructions along with the source :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 07, 2006 3:48 pm 
Offline
coder
User avatar

Joined: Tue Dec 14, 2004 3:24 pm
Posts: 324
Location: UK (UTC+0)
zapkitty wrote:
If, on the other paw, Relic has made the bink cutscenes, or translations thereof in other media, directly available to the public before this then we can work with that...

Which I believe they did. They're in this lot somewhere (also includes NIS movies et al): 3D Downloads. I'm unsure of the compression (they're pretty old so can't be great) and definitely require a broadband connection. Still, in principle they are available to use with the caveat that we shouldn't distribute them, just give the player a pointer to their location. If they download and install them then we play them, otherwise we, er, don't - because there's nothing to play... ;)

_________________
MacHomeworld | HomeworldSDL.org


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 3:25 pm 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
FFS.

Just about sorted the work on sorting the audio out for the movies, and it's included in the AVI from 3D downloads. (Thanks for the link, I think I'll download them all then they'll all be in one place and we'll have a backup. :) )

There also are avi.h and avi.c in the SDL folder which leads me to think that the movies were originally in AVI, then converted for release. Anyhow, I'll keep playing and hopefully get something soon.

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 18, 2006 7:33 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

Not posted anything for a while, so thought I'd put an update in. :)

I've gone back to a converted avi because the quality isn't exactly what I'd call excellent from the released movies. I've converted them to an mpeg v4 format for now, but this is just for my testing.

I've learnt more about how the game hangs together than I though I would of needed to know, and whilst it's been interesting it's been very time consuming.

Currently I've got sound and music, and the subtitles are displaying, but I have one small issue to finish there.

I will use the libavcodec libraries which are part of ffmpeg http://ffmpeg.mplayerhq.hu/ This should work for all three OSs that are being developed. I hope. :)

I have (needs to be re-added to the code) identified the av stream and now need to write the display routines.

Also to do is add the "Escape" key detect so you don't have to watch them. :)

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 18, 2006 11:58 am 
Offline
coder

Joined: Wed Nov 15, 2006 8:15 am
Posts: 100
Great aunxx, good luck to finish the job, if you need a tester don't hesitate. ;)

Concerning the redistribution, I think the easiest way would be to provide a script that convert the bink to avi file just by giving the path to were the bik files are stored.

Then we would have just to indicate it in the INSTALL file how to use it. There would be no copyright infringment. Plus, this script could be used in the installation packager of distributions to convert and install movies directly from the cd.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 20, 2006 7:58 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
:) :) :) :)

Think I've just about sorted this.

Timing, and removing _Loads_ of crappy code lines and debug statements to do, as well as making sure I free everything I need to.

Hopefully upload changes and instructions today or tomorrow. It _should_ be fully wrapped with #ifdef so it'll only be activated if required.

More to follow...... :)

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 21, 2006 4:44 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

I've committed the code this morning. I'm still working on bits of it but the bulk of it is there, and it mostly seems to work.

TODO:
Sort the timing out correctly, and some of the movies don't seem to play correctly. Probably due to my conversion.

Is it worth creating a folder in the svn tree outside the main trunk which contain the movies? then we're only allowing access to users for now?

HOWTO:

The code requires libavformat (and libavcodec) which are part of ffmpeg. This is available for all OSs (I think I checked, but I've slept since then. :) )
available from: http://ffmpeg.mplayerhw.hu/
I've changed the configure script for Linux to allow --enable-movies as an option, and I think this'll work for the mingw build as well. Essentially this defines HW_ENABLE_MOVIES and links to avformat and avcodec.

The code will look for a file in Movies called mm-nn.avi These are the same names as the movies there, but with a different suffix. Assuming the codec can be found it'll then play the movies. :)

To convert the movies you need the radtools. http://www.radgametools.com/bnkdown.htm and use the RAD video tools to convert the movies. I used a mpeg v4 format personlly, but I'm going to test a few others.

Post any questions and problems here and I'll have a look.

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 21, 2006 4:57 am 
Offline
coder

Joined: Wed Nov 15, 2006 8:15 am
Posts: 100
Ok couldn't try it, as I don't have Windows and Rad tools seems to be available only for Windows.

So, I will try to find another way to convert bink files under Linux ;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 21, 2006 12:00 pm 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Just noticed that the image needs stretching.... Think that'll fix the other problem I've seen.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 21, 2006 3:38 pm 
Offline
coder

Joined: Wed Nov 15, 2006 8:15 am
Posts: 100
It works for me, beautiful job aunxx. :D

Little comments :
- As you said, image doesn't go fullscreen, it needs to be strech.
- The video seems to go to quickly. The video finished before the end of the audio speech. I test it, the avi one with mplayer and the bik one with bink player and both seems to go to the same speed, so it doesn't seem to come from the encoding. So timing is to be check.

But the rest works great!!! :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 21, 2006 5:48 pm 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

The image is in 640x480, and seems to be stretched to reach the 640. It only seems to be about 480 pixels wide so needs to be expanded. I've got to look into this before anything else really to try and work out why the image doesn't seem so be the correct dimensions.

Timing was a very rough fix, and I'll tidy it up eventually. There's a comment in the code along the lines of "It's close enough" relating to the timing. :)

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 21, 2006 7:09 pm 
Offline
coder

Joined: Wed Nov 15, 2006 8:15 am
Posts: 100
Hehe, didn't have time to look at the code (exam period :()

I will try to look at this weekend.

And as I will have finally time, I will begin to work on the network part. :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 23, 2006 11:30 am 
Offline
coder
User avatar

Joined: Tue Dec 14, 2004 3:24 pm
Posts: 324
Location: UK (UTC+0)
Not wishing to detract from all the great work being done here but should anyone want to try getting the original Bink stuff working, then this may fill in the gaps to interface with the installed binkw32.dll. This has the advantage of not needing to convert the movies to avi equivalents.

_________________
MacHomeworld | HomeworldSDL.org


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 24, 2006 5:17 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
I've left the code in place which calls the bink api's so I don't think it'll be too difficult for someone to implement.

I've uploaded the movies I'm using to http://www.whoc.org.uk/homeworldSDL/ if anyone else wants to try testing the movies, and let me know if it's working.


Other than that have an excellent holiday all.

Aunxx.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 8:25 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Just found a small "gotcha" with using ffmpeg relating to the compiler option "align-strings"

Upshot is that the movies may not play and the binary may crash if there is a discrepancy. I'll see if I can sort this out.

Otherwise, has anyone else tried to include the movies? If so, has it worked?

Aunxx


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 12:06 pm 
Offline
coder

Joined: Mon Jan 29, 2007 2:45 pm
Posts: 60
aunxx wrote:
Otherwise, has anyone else tried to include the movies? If so, has it worked?


Yes, they seem to be working fine so far. Although I have not played the original game, only HW SDL, so I wouldn't know if there are any differences from the original.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 23, 2007 8:57 pm 
Offline
coder

Joined: Mon Jan 29, 2007 2:45 pm
Posts: 60
It seems r556 broke the AVI support. See bug 42.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 1:36 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Okay.

I think I need some additional info so I'll put some requests into Mantis.

Aunxx


Top
 Profile  
 
PostPosted: Wed Feb 18, 2009 9:08 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Looks like the ffmpeg library has changed and depreciated img_convert

It might be a good time to try and go back and make some sense of the kludged code I wrote to get the movies playing. :)

Aunxx


Top
 Profile  
 
PostPosted: Tue Jun 08, 2010 2:29 am 
Offline
coder

Joined: Tue Nov 07, 2006 4:40 am
Posts: 236
Hi.

The movies were on my server at home, and every time someone downloaded them it saturated my link.

Anyhow, I've put a redirect on and put them on a different server so the download should be a lot quicker now.

Direct link:
http://krond.whoc.org.uk/homeworldSDL/

Aunxx.


Top
 Profile  
 
PostPosted: Thu May 02, 2013 8:04 am 
Offline

Joined: Thu May 02, 2013 7:59 am
Posts: 1
Handbrake should do it.....that being said I have encountered lots of files that it cant....
if not try this VOB AVI converter, convert any movie files
it is my go to converter when others fail.


Top
 Profile  
 
PostPosted: Sat May 04, 2013 1:00 pm 
Offline

Joined: Sat Jun 18, 2011 8:18 pm
Posts: 12
You guys know that libavformat has BINK support built into it now right? Just tell it to play the original .bik files and it'll run them on WIndows/Mac and Linux. The Bink code can be safely deprecated and removed. I've been testing this out. There's some sort of playback error occuring when I'm trying to fire up videos on x86 and x86_64 Linux seems to play the first video correctly then crash out on the second video file. Needs cleanup to fix memory holes etc.


Top
 Profile  
 
PostPosted: Sat May 04, 2013 10:48 pm 
Offline

Joined: Sat Jun 18, 2011 8:18 pm
Posts: 12
okay there is a video crash occuring in (avi.c:435 and 436):

streamPointer=pFormatCtx->nb_streams;
pCodecCtx=streamPointer->codec; the code is crashing x86_32 and x86_64 linux.


Top
 Profile  
 
PostPosted: Sun May 05, 2013 2:42 am 
Offline

Joined: Sat Jun 18, 2011 8:18 pm
Posts: 12
Here is a log dump of the problem. To generate it I ran homeworld through Valgrind debugger. I got the first video to play, quit the mission then played the first mission again. It crashed as it was loading the video a second time http://filebin.ca/g1uUgyVaMSl/homeworld.log


Top
 Profile  
 
 Post subject: Cutscenes FIXED.
PostPosted: Sun May 05, 2013 9:31 am 
Offline

Joined: Sat Jun 18, 2011 8:18 pm
Posts: 12
I've been able to fix the movie playback issue on 32 and 64-bit linux. I believe that this fixes Bink playback on all platforms but my OSX dev environment is unable to compile the game so I will need someone else to test the patches under OSX (Update: CONFIRMED WORKING on i386 AND X86_64 Mac OSX 10.8.3 with latest XCode 4.6, Have also compiled HomeworldSDL as a Universal Binary). It ended up being a rather trivial fix. The two patch files are included in this post as it would not allow me to attach them as files. I have tested these patches on X86_64 and i386 Linux but they should also work on Mac OSX and Windows.


avi.patch:
--- src/Game/Animatic.c 2013-05-06 00:05:26.299852257 +1000
+++ src/Game/Animatic.c 2013-05-06 00:05:10.667774733 +1000
@@ -805,10 +805,10 @@
}

#ifdef _WIN32
- sprintf(filename, "Movies\\%s.avi", animlisting[a].filename);
+ sprintf(filename, "Movies\\%s.bik", animlisting[a].filename);
sprintf(scriptname, "Movies\\%s.script", animlisting[a].filename);
#else
- sprintf(filename, "Movies/%s.avi", animlisting[a].filename);
+ sprintf(filename, "Movies/%s.bik", animlisting[a].filename);
sprintf(scriptname, "Movies/%s.script", animlisting[a].filename);
#endif
animScriptHeader = animLoadNISScript(scriptname);
james@Linuxguy:~/RAID0/Games/Homeworld/animfix$ cat avi.patch
--- src/SDL/avi.c 2013-05-06 00:05:26.563853555 +1000
+++ src/SDL/avi.c 2013-05-06 00:21:19.164577257 +1000
@@ -251,7 +251,6 @@
#endif

#ifdef HW_ENABLE_MOVIES
-
int frame = 0;
int numBytes;
int frameFinished;
@@ -357,6 +356,7 @@
int alignDoubleSet = 1;
int ffmpegAlign = 1;
int videoStream = -1;
+ pFormatCtx = NULL;

// Add intelligence to identifying path and OS here -- TODO

@@ -374,7 +374,7 @@
#if AVI_VERBOSE_LEVEL >= 2
dbgMessagef("sizeof AVFormatContext = %d",sizeof(AVFormatContext));
#endif
-
+/*
#ifndef _X86_64 // Really, really, really must redo this. It's hideous. :(
if ((sizeof(AVFormatContext) == 3976 ) || (sizeof(AVFormatContext) == 3960 )){ //alligned variables
alignDoubleSet = 1;
@@ -387,27 +387,16 @@
ffmpegAlign = 0; // There should only be one stream.
}
#endif
-
+*/
#if AVI_VERBOSE_LEVEL >= 2
dbgMessagef("alignDoubleSet = %d",alignDoubleSet );
dbgMessagef("ffmpegAlign = %d",ffmpegAlign );
#endif

-// There Should only be one stream. So skip the stream test.
-
-// for(i=0; i<pFormatCtx->nb_streams; i++) {
-// streamPointer=pFormatCtx->streams[i];
-// }
-// if(streamPointer->codec->codec_type==CODEC_TYPE_VIDEO) {
-
#if AVI_VERBOSE_LEVEL >= 3
dbgMessagef("aviStart: Found Video Stream= %d.", i);
#endif

-// videoStream=i;
-// i+=pFormatCtx->nb_streams; // get out of the loop!
-// }
-
videoStream=i;

if(videoStream==-1) {
@@ -422,6 +411,7 @@
#endif

#ifdef _X86_64
+// pCodecCtx=pFormatCtx->streams[videoStream]->codec;
pCodecCtx=pFormatCtx->streams[0]->codec;
#else
pCodecCtx=pFormatCtx->streams[videoStream]->codec;
@@ -432,7 +422,7 @@
#if AVI_VERBOSE_LEVEL >= 3
dbgMessage("different");
#endif
- streamPointer=pFormatCtx->nb_streams;
+ streamPointer=pFormatCtx->streams[0];
pCodecCtx=streamPointer->codec; //This is not the best way to do this, but works.
}

@@ -595,7 +585,6 @@
dbgMessage("aviPlay:Entering");
#endif
char fullname[1024];
-
//TODO Include Windows file structure.

strcpy(fullname, filePathPrepend(filename, FF_HomeworldDataPath));
@@ -610,17 +599,10 @@
}
}

-//taskFreezeAll();
-
-// aviSetScreen(pCodecCtx->width,pCodecCtx->height);
-
-// nisFadeToSet(a , 0, b);
-
g_bMoreFrames = TRUE;
aviIsPlaying = TRUE;
aviDonePlaying = FALSE;
aviPlayLoop();
-
aviStop();
aviIsPlaying = FALSE;

@@ -668,9 +650,9 @@
/*binkPlay("Movies\\sierra.bik", NULL, NULL, S_RGB555, TRUE, ANIM00_Sierra);*/
if (aviPlayIntros) {
#ifdef _WIN32
- aviPlay("Movies\\sierra.avi");
+ aviPlay("Movies\\sierra.bik");
#else
- aviPlay("Movies/sierra.avi");
+ aviPlay("Movies/sierra.bik");
#endif
// intro++;
}
@@ -679,9 +661,9 @@
/*binkPlay("Movies\\relicintro.bik", NULL, NULL, S_RGB555, TRUE, ANIM00_Relic);*/
if (aviPlayIntros) {
#ifdef _WIN32
- aviPlay("Movies\\relicintro.avi");
+ aviPlay("Movies\\relicintro.bik");
#else
- aviPlay("Movies/relicintro.avi");
+ aviPlay("Movies/relicintro.bik");
#endif
// intro++;
}


----------------------------------------------------------------------------------------------------------
animatic.patch:
--- src/Game/Animatic.c 2013-05-06 00:05:26.299852257 +1000
+++ src/Game/Animatic.c 2013-05-06 00:05:10.667774733 +1000
@@ -805,10 +805,10 @@
}

#ifdef _WIN32
- sprintf(filename, "Movies\\%s.avi", animlisting[a].filename);
+ sprintf(filename, "Movies\\%s.bik", animlisting[a].filename);
sprintf(scriptname, "Movies\\%s.script", animlisting[a].filename);
#else
- sprintf(filename, "Movies/%s.avi", animlisting[a].filename);
+ sprintf(filename, "Movies/%s.bik", animlisting[a].filename);
sprintf(scriptname, "Movies/%s.script", animlisting[a].filename);
#endif
animScriptHeader = animLoadNISScript(scriptname);


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group