Playing ROQ Video Files

From The DarkMod Wiki
Revision as of 12:01, 18 November 2007 by Tels (talk | contribs) (add style tag)
Jump to navigationJump to search
Grammar, spelling and/or writing style of this article need to be improved. For help please see the Style Guide. Afterwards, remove the {{style}} from the article.

Originally written by Drumple on http://forums.thedarkmod.com/topic/3504

I have been looking into information on how to get ROQ files properly formatted to work in Doom3, since it is an old, tried and true video format for id, they continue to use it in doom3, however doom3 will only play roq's with tighter restrictions as far as I understand it. And if you intend to make a roq video to be used by the doom3 engine i thought i would post the how-to here, since it will save you a lot of running around and checking out different sites for the lowdown, since most of the sites i checked never once mentioned the proper fps the video needs. So hopefully this can save you some time in researching the requirements.

roq files generally can be different dimensions and QVM will make roq files but not in powers of 2 from what i have seen. trying to get QVM to make a roq video of 512x512 causes an error that its not in the proper size of 512x384.

after searching on a few different forums i found this link for Riot's House of Stuff which has a few programs to help make roq files. one in particular that works good is SwitchBlade 3.12.

  • Since Doom3 will play roq vid's in powers of 2 ( 64x64... 128x128.. ect.. ) the images or video source must be in these dimensions for switchblade to properly format the roq.
  • Frames per second have to be at 30 also for switchblade to work.
  • Audio can be used in the roq, but doom3 does not play the audio track from what i have seen, and in the guis that use video and audio, the audio is triggered to play from a seperate ogg or audio source at the same time the video is started. But if you want to make a roq with audio, the source audio must be 22050, if its not it will be resampled to 22050.
  • Video source dimensions should be at a power of 1.3 to 1, meaning if you take the width of the video and divide it by the height it should be 1.333333 and so on.. this will work for standard screenshots if you want to make a source video from a demo. 1024x768 800x600 640x480 all fall into this category. If the source width and height do not fall into this category then there is information on how to ajust the video source with virtualdub in the switchblade documentation. The reason for this is to have the video play properly within the screen dimensions from a roq formatted in powers of 2.

A basic rundown if you want to create a roq from an avi using switchblade is to use virtualdub to format the avi with the following, fps 30, resize to 512x512, select NO AUDIO from the audio tab, choose the compression you want from the compression tab.. ( generally i have been using no compression which will make huge avi files but should have the best image quality ) and save as AVI. you can use any other filter types that virtualdub has to improve the quality of the avi if you feel it needs it.

Then you just drag and drop that avi onto the DropROQ.exe from the switchblade folder... sit back and let it make your roq video. If the avi has an audio track then you can use virtualdub to export a wav file which you can then use you favorite audio software to make it an ogg.

Swithblade 3.12 has no roq player to see the final product, but SwitchBlade2 does have, and you can get it from that site also. But it turns out that Media Player Classic can play most roq videos, and you can use that to check out your new roq if you have it.

The idlogo and some cinematic scenes in doom3 are at 512x512 roq video, such as part of the ending scene where you get rescued and those dimensions should suffice for most video you want to use.

Not to be redundant but again thats AVI Video Source @30fps, 512x512 drag-and-drop to DropROQ.exe other powers of 2 should work out fine but for cinematics 512x512 works nice.

Test it

This is a test here now to implement the new roq vid ingame, there are different ways to do this depending on what you may want but for now im going to just add a moveable_laptop since it has a common/gui surface in the model already, which is right in front of the screen area.

im using a roq and ogg named myroqtest.roq and myroqtest.ogg.

first i put the roq video and the ogg sound im using in a folder called /video, it could be anywhere of course.

here is the material shader im using:

video/myroq
{
   translucent
   {
       videomap "video/myroqtest.roq"
       linear
   }
}

Then create a gui you will use, this one is named myguitest.gui and placed in the /guis folder:

windowDef Desktop
{
   rect 0 ,0 ,640 ,480
   backcolor 0, 0, 0, 1
   matcolor 0, 0, 0, 1
   background "guis/assets/common/bg"

   windowDef VidFrame
   {
       rect 0,0,640,480
       visible 1
       backcolor 1, 1, 1, 0
       windowDef RoqFile
       {
           rect 0,0,640,480
           visible 1
           background "video/myroq"        // roq shader defined in the material file
           matcolor 1,1,1,1
           onTime 8000
           {
               resetCinematics;
               resetTime "Anim" "0";
               localsound "video/myroqtest.ogg"; // sound file to accompany the video
           }
       }
   }
}

then open up doom3 editor and your map you want to test in and add a moveable_laptop from the menu...

Roq moveselect.jpg

add a key/value of gui /guis/myguitest.gui to it, so it can use the gui we just made

Roq myguitest.jpg

save/bsp and try it out.. what this gui does is wait 8 seconds, then plays the video and replays it every 8 seconds after that. there are many ways to show video ingame, but this one is ok for this test.

you could make a brush and a turn that into a func_static and add the gui key/vals. you need to select one face and apply the common/entitygui to it for where your video will play, but you will have to make shure you fit that image to your selected face, otherwise the video will play in a corner of the selected face.

fit the guientity as in figure B

Roq resize.jpg

And here is a screenshot of it working ingame:

Builderlaptop.jpg