Playing ROQ Video Files: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Petike (talk | contribs)
m typo
Geep (talk | contribs)
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{style}}
= Examples: A Repeating Video on an In-Game Laptop; and on Your Own Video Surface =
{{infobox|bg=#ffb0b0|border=2px solid#ff0000|text=
 
{{{text|As of TDM 2.06, support for FFmpeg video codecs has been added, in addition to ROQ.}}}
[[Image:Builderlaptop.jpg]]
}}
 
== Notice ==
'''These examples of using videos and GUI resources in TDM are still valid and informative, but new FMs should use one of the more modern video formats, not RoQ.'''
== Preamble ==
 
These examples, and their recommendations and images, are by Drumple circa 2007. This was rewritten for concision by Geep, 2020, with these added preamble notes. The general approach is still valid, but the specific tools (SwitchBlade, VirtualDub, and the older Doom3 Editor) are less viable now. Standalone SwitchBlade is no longer available; its development ended with version 3, at which time it was folded into FFmpeg [https://wiki.multimedia.cx/index.php/RoQ RoQ]. TDM now uses a FFmpeg subset for video decoding, including RoQ.
 
Instead, see two 2015-era OpenArena tutorials by [https://openarena.fandom.com/wiki/RoQ ZaRR]:
* The first uses XMedia Record to preprocess, then FFmpeg to output RoQ
* The second uses Shotcut and XnView to preprocess, then roq.exe, id's official win32 RoQ encoder. The latter is evidently no longer available from id, but the tutorial provides a copy.
 
Or consider the Overdose-related RoQ-creation tool [https://overdose-game.com/sdk.html ODVideo]. But caution: RoQ tools tuned for other idTech4 games could be TDM-incompatible.
 
Other 2020-era comments are shown in [square brackets].
 
== Introduction to the RoQ Format ==
 
{{Original_Reference|Drumple|3504}}
{{Original_Reference|Drumple|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.
The ROQ video file format is one traditionally used id Software, starting with early Doom and continuing (with some tightening of playback format requirements) to Doom3. These latter requirements include:
 
* a square, powers-of-2 frame format (e.g., 64x64, 128x128, etc.), holding a width compression of the original's standard-definition 4:3 aspect ratio (i.e., width/height = 1.3333)
* 30 frames per second
* separate audio file, e.g., OGG format.
 
== Programs to Create a ROQ File ==
 
Among possible programs to make ROQ files [Riot], some, such as Quake Video Maker (QVM), fail for our purposes because they cannot handle square videos. SwitchBlade 3.12 works well, paired with preprocessing by VirtualDub.
 
== Preprocessing an AVI with VirtualDub ==
 
SwitchBlade 3.12 will expect an AVI to have following input format:
 
* a square powers-of-2 format. 512x512 is recommended for Doom3 cinematics
* image width compression from a 1.3333:1 [i.e., 4:3] aspect ratio
* 30 fps
* Typically no audio.
 
Use VirtualDub to achieve these. From SwitchBlade documentation, some considerations:


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.
=== Audio ===


after searching on a few different forums i found this link for [http://www.icculus.org/homepages/riot/ 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.
Audio can be included in the ROQ, but Doom3 evidently ignores it. [Unknown if this is still necessarily true in TDM 2.06+] In the GUIs that use video and audio, the audio is triggered to play from a separate 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 Hz, or it will be resampled to that. More typically, in VirtualDub:


* 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.
* Export the original AVI's audio track as a WAV file. Later, use your favorite audio software to make it an OGG.
* '''Frames per second''' have to be at 30 also for switchblade to work.
* While preparing to create the ROQ video, select NO AUDIO from the VirtualDub Audio tab.
* '''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.
=== Video ===


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.
* The 512x512 ROQ video format was used by id in Doom3 for the id logo and some cinematic scenes, such as where you get rescued in the last scene. So those dimensions should generally suffice.
* Video source dimensions should be at a power of 4:3. So if need be, adjust the video source with VirtualDub (as discussed in the SwitchBlade documentation).
* Optionally, choose an overall quality compression you want from the compression tab. (Drumple prefers no compression, which makes huge AVI files but has the best image quality.)
* As needed, use any other VirtualDub filters to improve the quality of the AVI.
* Finally, save as AVI.


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.
== Converting AVI to ROQ with SwitchBlade ==


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.
Just drag and drop the foregoing preprocessed AVI onto the DropROQ.exe from the switchblade folder... sit back and let it make your ROQ video.


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.
== Viewing the Results in a Standalone Player ==


== Test it ==
* Switchblade 3.12 has no ROQ player to see the final product, but SwitchBlade2 (available from the same site) does.
This is a test here now to implement the new roq vid ingame, there are different ways to do this depending
* If you have it, Media Player Classic can play most ROQ videos.
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.
== Testing the Video and Audio In-Game ==
=== On an In-Game Laptop Screen ===


first i put the roq video and the ogg sound im using in a folder called /video, it could be anywhere of course.
There are different ways to implement a new ROQ video in-game. Here, we'll use a moveable_laptop, since it has a common/gui surface in the model already, right in front of the screen area.


here is the material shader im using:
First, put the ROQ video (myroqtest.roq) and the OGG sound (myroqtest.ogg) into your game's directory, for example, within a folder called /video.
 
Create a material shader [e.g., within some .mtr file in your materials folder]:


  video/myroq
  video/myroq
Line 46: Line 84:
  }
  }


Then create a gui you will use, this one is named myguitest.gui and placed in the /guis folder:
Next, we want a GUI that will -
* wait 8 seconds, then play the video [assumed to be no more than 8 seconds long]
* replay it every 8 seconds after that.
So create a file named myguitest.gui, placed in the /guis folder, with content:


  windowDef Desktop
  windowDef Desktop
Line 64: Line 105:
             rect 0,0,640,480
             rect 0,0,640,480
             visible 1
             visible 1
             background "video/myroq"        // roq shader defined in the material file
             background "video/myroq"        // ROQ shader defined in the material file
             matcolor 1,1,1,1
             matcolor 1,1,1,1
             onTime 8000
             onTime 8000
Line 76: Line 117:
  }
  }


then open up doom3 editor and your map you want to test in and add a moveable_laptop from the menu...
Then open up the Doom3 editor [or Dark Radiant these days] and the map that you want to test in, and add a moveable_laptop from the menu...


[[Image:Roq_moveselect.jpg]]
[[Image:Roq_moveselect.jpg]]


add a key/value of gui '''/guis/myguitest.gui''' to it, so it can use the gui we just made
Add a key/value [i.e., spawnarg] of gui '''/guis/myguitest.gui''' to it, for the GUI we just made.


[[Image:Roq myguitest.jpg]]
[[Image: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
Save and try it out. See the first screenshot above.
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
=== Alternative: On Your Own Video Surface ===
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
To make a video surface:
* Make a brush and convert it to a func_static.
* Add the gui key/vals, as above.
* Select one face - where your video will play - and apply the common/entitygui to it [giving Figure A below].
* Make sure you fit that image to your selected face [e.g., in the DR Texture editor, resulting in Figure B], otherwise the video will play in a corner of the selected face.


[[Image:Roq_resize.jpg]]
[[Image:Roq_resize.jpg]]


And here is a screenshot of it working ingame:
== RoQ References ==


[[Image:Builderlaptop.jpg]]
'''VirtualDub'''. Development of this ceased at the end of 2013, and its forum expired in 2015, but (as of Feb. 2020) the last stable version is still available for download at [http://www.virtualdub.org VirtualDub].
 
'''Quake Video Maker (QVM) - Easy ROQ creator'''. Historic URL, no longer valid: www.swift-tools.net/Quake/QVM/ . QVM is still available from 3rd-party sites.
 
'''Switchblade Video Encoder/RoQ Converter'''. Last reported version was 3 [http://planetdoom.gamespy.com/pagetools/pagetools1b7e.html?act=printnews&id=785 says planetdoom], pointing to Riot's homepage. No longer.
 
[http://www.doom3world.org/phpbb2/viewtopic.php?t=3533 Doom3world Discussion]
 
[http://www.modwiki.net/wiki/ROQ_%28file_format%29 Modwiki ROQ]
 
[Riot] At one time there was a list of ROC-creation programs at [http://www.icculus.org/homepages/riot/ Riot's House of Stuff].
 
'''RoQ''' Brief history and tech overview at [https://wiki.multimedia.cx/index.php/RoQ RoQ].
 
'''RoQ Encoder''' Official Encoder (win32): [ftp://ftp.idsoftware.com/idstuff/quake3/tools/roq.zip idsoftware ftp]
 
For an alternative take on using QVM to create ROQ files, see [https://www.moddb.com/tutorials/how-to-create-a-roq-video-file1 How to create a RoQ video-file]


{{tutorial-editing}}
{{tutorial-editing}}
[[Category:Video and cutscenes]]
[[Category:Video and cutscenes]]

Latest revision as of 19:32, 16 March 2020

Examples: A Repeating Video on an In-Game Laptop; and on Your Own Video Surface

Notice

These examples of using videos and GUI resources in TDM are still valid and informative, but new FMs should use one of the more modern video formats, not RoQ.

Preamble

These examples, and their recommendations and images, are by Drumple circa 2007. This was rewritten for concision by Geep, 2020, with these added preamble notes. The general approach is still valid, but the specific tools (SwitchBlade, VirtualDub, and the older Doom3 Editor) are less viable now. Standalone SwitchBlade is no longer available; its development ended with version 3, at which time it was folded into FFmpeg RoQ. TDM now uses a FFmpeg subset for video decoding, including RoQ.

Instead, see two 2015-era OpenArena tutorials by ZaRR:

  • The first uses XMedia Record to preprocess, then FFmpeg to output RoQ
  • The second uses Shotcut and XnView to preprocess, then roq.exe, id's official win32 RoQ encoder. The latter is evidently no longer available from id, but the tutorial provides a copy.

Or consider the Overdose-related RoQ-creation tool ODVideo. But caution: RoQ tools tuned for other idTech4 games could be TDM-incompatible.

Other 2020-era comments are shown in [square brackets].

Introduction to the RoQ Format

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

The ROQ video file format is one traditionally used id Software, starting with early Doom and continuing (with some tightening of playback format requirements) to Doom3. These latter requirements include:

  • a square, powers-of-2 frame format (e.g., 64x64, 128x128, etc.), holding a width compression of the original's standard-definition 4:3 aspect ratio (i.e., width/height = 1.3333)
  • 30 frames per second
  • separate audio file, e.g., OGG format.

Programs to Create a ROQ File

Among possible programs to make ROQ files [Riot], some, such as Quake Video Maker (QVM), fail for our purposes because they cannot handle square videos. SwitchBlade 3.12 works well, paired with preprocessing by VirtualDub.

Preprocessing an AVI with VirtualDub

SwitchBlade 3.12 will expect an AVI to have following input format:

  • a square powers-of-2 format. 512x512 is recommended for Doom3 cinematics
  • image width compression from a 1.3333:1 [i.e., 4:3] aspect ratio
  • 30 fps
  • Typically no audio.

Use VirtualDub to achieve these. From SwitchBlade documentation, some considerations:

Audio

Audio can be included in the ROQ, but Doom3 evidently ignores it. [Unknown if this is still necessarily true in TDM 2.06+] In the GUIs that use video and audio, the audio is triggered to play from a separate 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 Hz, or it will be resampled to that. More typically, in VirtualDub:

  • Export the original AVI's audio track as a WAV file. Later, use your favorite audio software to make it an OGG.
  • While preparing to create the ROQ video, select NO AUDIO from the VirtualDub Audio tab.

Video

  • The 512x512 ROQ video format was used by id in Doom3 for the id logo and some cinematic scenes, such as where you get rescued in the last scene. So those dimensions should generally suffice.
  • Video source dimensions should be at a power of 4:3. So if need be, adjust the video source with VirtualDub (as discussed in the SwitchBlade documentation).
  • Optionally, choose an overall quality compression you want from the compression tab. (Drumple prefers no compression, which makes huge AVI files but has the best image quality.)
  • As needed, use any other VirtualDub filters to improve the quality of the AVI.
  • Finally, save as AVI.

Converting AVI to ROQ with SwitchBlade

Just drag and drop the foregoing preprocessed AVI onto the DropROQ.exe from the switchblade folder... sit back and let it make your ROQ video.

Viewing the Results in a Standalone Player

  • Switchblade 3.12 has no ROQ player to see the final product, but SwitchBlade2 (available from the same site) does.
  • If you have it, Media Player Classic can play most ROQ videos.

Testing the Video and Audio In-Game

On an In-Game Laptop Screen

There are different ways to implement a new ROQ video in-game. Here, we'll use a moveable_laptop, since it has a common/gui surface in the model already, right in front of the screen area.

First, put the ROQ video (myroqtest.roq) and the OGG sound (myroqtest.ogg) into your game's directory, for example, within a folder called /video.

Create a material shader [e.g., within some .mtr file in your materials folder]:

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

Next, we want a GUI that will -

  • wait 8 seconds, then play the video [assumed to be no more than 8 seconds long]
  • replay it every 8 seconds after that.

So create a file named myguitest.gui, placed in the /guis folder, with content:

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 the Doom3 editor [or Dark Radiant these days] and the map that you want to test in, and add a moveable_laptop from the menu...

Add a key/value [i.e., spawnarg] of gui /guis/myguitest.gui to it, for the GUI we just made.

Save and try it out. See the first screenshot above.

Alternative: On Your Own Video Surface

To make a video surface:

  • Make a brush and convert it to a func_static.
  • Add the gui key/vals, as above.
  • Select one face - where your video will play - and apply the common/entitygui to it [giving Figure A below].
  • Make sure you fit that image to your selected face [e.g., in the DR Texture editor, resulting in Figure B], otherwise the video will play in a corner of the selected face.

RoQ References

VirtualDub. Development of this ceased at the end of 2013, and its forum expired in 2015, but (as of Feb. 2020) the last stable version is still available for download at VirtualDub.

Quake Video Maker (QVM) - Easy ROQ creator. Historic URL, no longer valid: www.swift-tools.net/Quake/QVM/ . QVM is still available from 3rd-party sites.

Switchblade Video Encoder/RoQ Converter. Last reported version was 3 says planetdoom, pointing to Riot's homepage. No longer.

Doom3world Discussion

Modwiki ROQ

[Riot] At one time there was a list of ROC-creation programs at Riot's House of Stuff.

RoQ Brief history and tech overview at RoQ.

RoQ Encoder Official Encoder (win32): idsoftware ftp

For an alternative take on using QVM to create ROQ files, see How to create a RoQ video-file