OpenArena
Register
Advertisement

RoQ is the format that the game (Quake3 and derivatives, including OpenArena) supports for video playback. This is about cinematics (pre-rendered videos), they are a different thing than demos.

RoQ videos are rarely used. They may add noticeable filesize and have some limitations... however they can be shown in the GUI (think about the intro video and the tier presentations of Q3A) or even inside the maps.

For players: related variables and commands[]

  • /r_inGameVideo <0 or 1> - Allows (1) or pauses (0) the playback of in-map cinematics. Default value is 1.
  • /s_musicvolume <decimal values between 0.0 and 1.0> - In case the map author placed the audio as map background music, you will need to have it >0 in order to hear the sound. Default value is 0.25.
  • /s_volume <decimal values between 0.0 and 1.0> - It allows to control the volume of sounds. If not using OpenAL, it may also affect background music volume. Default value is 0.8.
  • /s_ambient 1 - In case the map author placed the audio as target_speaker. Needed for DeFRaG mod (or iDFe engine only). Not supported in stock baseoa.
  • /cinematic <filename> - Command to manually play a roq file, full screen. Examples: /cinematic idlogo.roq, /cinematic video/mymap/myvideo.roq

For mappers and mod authors: how-to[]

Here there are a couple "How to create RoQ video and place it in a map" guides created starting from two written by ZaRR (the first one, the second one), without the use of Quake Video Maker tool (the second one uses roq.exe by idSoftware). Other tutorials (including usage of Quake Video Maker tool) are linked in the External links section.

ZaRR's first method[]

Tools:

Must be 256x256 to be played correctly in-level by vanilla Q3/OA. If the RoQ has to be used inside menus (full screen) instead of inside a map, it should be safe up to 512x512.

Videos MUST BE 30 FRAMES PER SECOND.

If you want to play your video back in a id Tech 3 engine game, then input video dimensions MUST BE POWERS OF TWO. This means 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, or 32768.

Audio may be 11025 Hz, 22050 Hz, or 44100 Hz, any number of bits, BUT IT WILL BE ENCODED AS 22050 HZ 16-BIT REGARDLESS OF WHAT YOU DO, so it is a good idea to make your input audio those settings.

And of course if you use ROQ video in-level for Q3/OA then you should keep only video, because sound won't play in-level (we mention workarounds in step 5). Sound should be played back correctly in menus, instead.

1. With XmediaRecode convert, for example, into mpeg without audio and set 30 fps and 256x256 resolution (or with audio, if the video is for menus).
Note: depending from your input video format, maybe you could even skip step 1 and go directly to step 2, as also FFmpeg supports various input formats.

2. Make a shortcut[1] for FFmpeg.exe, right mouse button click on it, select Properties and add this at the end of the command line/destination/object field (exact naming of the field may vary depending from your Windows language):
-i inputname.mpeg -r 30 -s 256x256 outputname.roq
The above is assuming your input and output files will be placed in the same folder of FFmpeg.exe.
You can also use -an option to remove audio.

Inside the pk3, cinematics go under "video" folder (e.g. /video/idlogo.roq or /video/mymap/myvideo.roq[2]).

3. Create a shader including a "videomap" stage to load the roq file. Add its .shader file to your shaderlist.txt. See also Mapping manual/Shaders.

An example of videoshader can be seen in ZaRR's map roycovideo http://ws.q3df.org/map/roycovideo/, here it is:

textures/roycovideo/roycovideo
{
	{
		videomap video/roycovideo/royco_cup_a_soup.roq
		rgbGen identity
	}
}


4. In NetRadiant Custom (or the editor of your choice), create a brush and assign the shader you created to the face of the brush which will show the video. Assign a classic texture or shader to the other faces of the brush (e.g. bricks texture, wood texture, common/caulk if they are not visible to players...).

5. If you want to also play sound: as said in-level videos do not play sound, so you have to workaround. You can either use a target_speaker entity (see 5a) or set a background music (see 5b). So, first prepare the audio file (e.g. by extracting the audio from your original video using XMedia Recode or the tool you prefer) and place it under either "sound" or "music" path depending from your choice; usually, sound should be mono and music should be stereo.

5a. In the map editor, place a target_speaker near to the brush of the video. Set its "noise" key to the audio file you wish to play -e.g. set it to "sound/mymap/sound01" (better if without specifying the extension)-. You can set LOOPED_ON spawnflag to make it play all the time. The sound will be heard while near to the entity by default, but it you prefer, it can be broadcasted to all players no matter their position, by setting the GLOBAL spawnflag. See also Mapping manual/Triggers and movers#target_speaker.

5b. In the map editor, set the audiofile in the "music" key on worldspawn (generic entity) to choose a background music (a wav or ogg file) -e.g. set it to "music/mymapmusic" (better if without specifying the extension)-. You may prefer this approach instead of creating a target_speaker due to the latter getting desynced if map restarts, however even music can desync (see below), so it doesn't really make a big difference. Background music will heard by all players who haven't muted music volume (s_musicvolume cvar), no matter their position in the map. Players may theoretically override the music with one of their choice using "/music music/filename" in console.

Also good to know that when player does not look at the in-level video then the video will be paused until player looks back to it. So, the audio will end up desynced anyway, as the background music or the target_speaker will not pause when the video will.

To sum up, you may wish to do not associate a sound to the in-level video at all, or to associate a "generic" music or sound to it, which does not require to be in sync with the video.

ZaRR's second method[]

This is a variant which uses different tools than the first method to create the .roq files. But the part about how to use it in your maps is the same.
So, this replaces the first two steps of the previous method, the rest is the same.

Tools:

Shotcut steps:
Export your video file in 2 steps, to get a series of images and an audio file:
1. Export to .bmp 256x256 (you may probably also use 128x128 or 512x512 -the latter one only for playback in menus, not in-game-. Sizes should be powers of two.), be sure to set aspect correction to same 256x256. (Don't export to .jpg because aspect correction may be lost)
2. Export to .wav 22khz STEREO for /cinematic or MONO for in-game. (Normalize audio if needed, ZaRR used OcenAudio for that)
Note: ZaRR said that Shotcut supports RoQ video (so in theory you may just export directly to roq format from it), but he wasn't able to make /cinematic play the sound if he created the video file that way.

XnView steps:
Check sizes of exported .bmp files, they should be indeed 256x256 if that was your target.
Select them all and CTRL+U to multi-convert.
Choose .jpg format and in "filters" you may use "Auto-crop by colour (black)" if needed, or just crop. But converting to .jpg is needed for sure, because the old RoQ.exe program doesn't work with .bmp files (it seems to support jpg and tga).
When it's done, delete old bmp files or move them somewhere else.

RoQ.exe steps:
Use a plain text editor to modify a .param file (or create a new one by copying one of the existing ones) according to your needs (set appropriate folders and filenames) and then run RoQ.exe with your .param file name (e.g. roq.exe idlogo.param).

Additional tips[]

  • A simple way to have a RoQ video launch when starting your own mod is to provide players a .bat file containing a command similar to ..\openarena.exe +set fs_game flagraiders2 +cinematic idlogo.roq[3] (if you want to test it with FlagRaiders mod, which includes a short roq file). Of course, .bat files work under Windows... under Linux you would use a .sh script instead.
    • Of course, that requires players to launch your mod using such scripts. And autodownload can provide them only pk3 files. If you are programming your own mod, you may be able to modify its code to automatically play a video when you wish, instead.
  • About the shader: you may like to use qer_editorimage to show a placeholder image inside the editor, if you don't like the default "shader image missing" to be shown there. This has no impact on the final in-game result. Example: qer_editorImage textures/mymap/myvideo_screenshot.jpg
  • About the shader: depending from where you may want to place the video, in some cases you may even consider using surfaceparm nolightmap in the shader, in order to have the surface not influenced by the lighting of the room.

External links[]

See also[]

Notes[]

  1. If you prefer, you could use command prompt or a batch file instead of using a shortcut.
  2. As you can guess, in case of in-level videos, the second kind of path is advisable.
  3. The initial "..\" is assuming the .bat file is placed inside the mod folder. The same may be obtained without the "..\" at the beginning of the line, but adding a previous line containing "cd .." instead.
Advertisement