Difference between revisions of "ROQ Videos"

From 3DGE Wiki
Jump to: navigation, search
m
 
Line 6: Line 6:
  
 
== Technical details ==
 
== Technical details ==
The format runs at a fixed 30 frames per second with an optional 22050 Hz mono or stereo sound track. Videos may technically be up to 65520 x 65520 pixels with both dimensions divisible by 16 and produce a valid RoQ file, but none of id Software’s games will play back a video with dimensions that aren’t a power of two, most likely because of OpenGL’s texture sizing restrictions.
+
The format runs at a fixed 30 frames per second with an optional 22050 Hz mono or stereo sound track. Videos may technically be up to 65520 x 65520 pixels with both dimensions divisible by 16 and produce a valid RoQ file, but none of id Software’s games will play back a video with dimensions that aren’t a power of two, most likely because of OpenGL’s texture sizing restrictions.<blockquote>'''NOTE''' : It’s been reported that movies with dimensions greater than 512 x 512 cause issues in EDGE. Whatever the dimensions, make sure they are POWER-OF-TWO!</blockquote>RoQ is a motion compensating vector quanitizer format, similar to Cinepak, but higher quality due to the use of the ITU-R BT.601 colorspace (the same one used in component video, PAL televisions, JPEG and MPEG), whereas Cinepak uses a low-quality YUV-like colorspace designed for faster decoding that often results in gamut degradation before compression even begins.
 
 
'''NOTE''' : It’s been reported that movies with dimensions greater than 512 x 512 cause issues in various id Software games. Until this can be positively confirmed or denied it’s best to avoid higher resolutions.
 
 
 
RoQ is a motion compensating vector quanitizer format, similar to Cinepak, but higher quality due to the use of the ITU-R BT.601 colorspace (the same one used in component video, PAL televisions, JPEG and MPEG), whereas Cinepak uses a low-quality YUV-like colorspace designed for faster decoding that often results in gamut degradation before compression even begins.
 
  
 
Because it’s a vector quantizer, RoQ files are very fast to decode and very slow to encode. Decoding involves nothing more than converting the colorspace of the codebooks and then copying data, whereas encoding involves using several complicated schemes to produce a “palette” of image fragments that will result in the least degradation.
 
Because it’s a vector quantizer, RoQ files are very fast to decode and very slow to encode. Decoding involves nothing more than converting the colorspace of the codebooks and then copying data, whereas encoding involves using several complicated schemes to produce a “palette” of image fragments that will result in the least degradation.

Latest revision as of 10:09, 9 July 2018

RoQ is a video file format that originated in The 11th Hour game. After Graeme Devine, the creator of the format joined id Software, the RoQ file format has been in use in every game the company has released such as Quake III, Return to Castle Wolfenstein and DOOM 3. As it applies to id Tech 4 , these files are used for video sequences and animated materials and are stored in / base/video .

EDGE uses ROQ as the format of choice for cinematic playback.

Technical details

The format runs at a fixed 30 frames per second with an optional 22050 Hz mono or stereo sound track. Videos may technically be up to 65520 x 65520 pixels with both dimensions divisible by 16 and produce a valid RoQ file, but none of id Software’s games will play back a video with dimensions that aren’t a power of two, most likely because of OpenGL’s texture sizing restrictions.
NOTE : It’s been reported that movies with dimensions greater than 512 x 512 cause issues in EDGE. Whatever the dimensions, make sure they are POWER-OF-TWO!
RoQ is a motion compensating vector quanitizer format, similar to Cinepak, but higher quality due to the use of the ITU-R BT.601 colorspace (the same one used in component video, PAL televisions, JPEG and MPEG), whereas Cinepak uses a low-quality YUV-like colorspace designed for faster decoding that often results in gamut degradation before compression even begins.

Because it’s a vector quantizer, RoQ files are very fast to decode and very slow to encode. Decoding involves nothing more than converting the colorspace of the codebooks and then copying data, whereas encoding involves using several complicated schemes to produce a “palette” of image fragments that will result in the least degradation.

RoQ uses two codebooks per frame, with the second being constructed from pieces of the first, with up to 256 entries each. Due to this, only 1024 new colors can be introduced each frame, severely limiting the color gamut. This could arguably be improved by better predicting which sections will be motion compensated, but doing so is difficult, since codebook entries are generated from non-motion-compensated image sections, but whether or not they’ll be used depends on the quality of them compared to motion compensated sections, resulting in a chicken-and-egg problem. This is made worse by the fact that all three major RoQ codecs are single-pass.

While the format is limited and much lower quality than MPEG and Indeo Video, it was presumedly preferred by id Software because of the lack of royalties, the lack of patent liability that presents a serious problem with most video formats, and the absence of complex platform-specific APIs.

Content creation

You can create your own RoQ files using one of the following:

TUTORIAL

  1. To create a movie from a source file (either MP4 or AVI, but AVI is preferred) - you must have FFMPEG downloaded first. You can download the version you need from the FFMPEG Website.
  2. Put your source movie into the same directory as you have the binary for FFMPEG.
  3. Next, open the command-prompt (or your CLR of choice), and type in the following switches:
ffmpeg -i {yourmovie.format} -r 30 -s 512x512 -ar 22050 {output}.Roq
Where {yourmovie} is the source title, format is either MP4/AVI, and output is the name of your ROQ. The technical gist is that it encodes the movie at 30FPS (which is hard-coded, so better to have your video at 30FPS before you encode it), with a fixed resolution of 512x512 (power-of-two will upscale it automatically), and 22050 is the sound frequency (MUST BE 22KHZ!).

It's a good idea to do some video checks first. ROQ is limited to 512x512, but EDGE has scaling routines that make it look pretty decent in higher resolutions. Make sure your video is POWER OF TWO, otherwise your ROQ will decode poorly.

  1. With your ROQ, name it {intro.roq} and put it in the /video namespace inside of your archive. Right now, EDGE is limited to playing ROQ animations on startup only.

TODO: EDGE over-all integration