VideoRecorder.wiki
author almikes@aol.com
Mon, 08 Dec 2014 15:22:07 +0000
changeset 468 f4ebe0c62d97
parent 252 4c9881425131
child 687 fe70504acfc2
permissions -rw-r--r--
Information about overwriting.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
224
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     1
#summary How to compile/use video recorder
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     2
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     3
= How to compile? =
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     4
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     5
Source is available at http://code.google.com/r/stepik-777-videorec/source/checkout
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     6
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     7
To compile it you will need the following libraries:
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     8
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
     9
 # libavcodec, libavformat, libavutil.
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    10
 # freeglut or glut.
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    11
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    12
*For Linux* the following command should be enough:
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    13
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    14
 _apt-get install libavcodec-dev libavformat-dev libavutil-dev freeglut3-dev_
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    15
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    16
*For Windows*:
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    17
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    18
1. ffmpeg/libav
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    19
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    20
 ffmpeg download page (http://ffmpeg.org/download.html) recommends to download wibdows binaries from http://ffmpeg.zeranoe.com/builds/
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    21
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    22
 You will need shared and dev builds.
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    23
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    24
 Put *avcodec-54.dll*, *avformat-54.dll* and *avutil-51.dll* from shared build to your hedgewars bin directory.
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    25
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    26
 Put *libavcodec.dll.a*, *libavformat.dll.a*, *libavutil.dll.a* from dev build to _<your local clone>\misc\winutils\lib_ 
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    27
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    28
 Put include directories (only *libavcodec*, *libavformat* and *libavutil*) from dev build to _<your local clone>\misc\winutils\include_
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    29
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    30
 You can also try libav (http://www.libav.org/download.html) instead of ffmpeg, it should work, but their windows binaries are unreasonably large.
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    31
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    32
2. glut
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    33
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    34
 This page (http://wiki.freepascal.org/OpenGL_Tutorial) suggests to download glut from here: http://user.xmission.com/~nate/glut.html
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    35
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    36
 Just put *glut32.dll* from *glut-3.7.6-bin.zip* to your hedgewars bin directory.
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    37
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    38
= How to use it? =
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    39
225
770f7cffcb45 Edited wiki page VideoRecorder thru web user interface.
stepik-777@mail.ru
parents: 224
diff changeset
    40
Options can be set in special page, you can access it using button left to 'game settings' button. Currently, it contains only options, but later it will also contain list of recorded videos. To record video you must press ‘R’ during playing a game or watching a demo; then press ‘R’ again to stop recording. Recorded videos are saved to _<user data path>/Videos_ (_~/.hedgewars/Videos_ or _C:\Documents and settings\<user name>\Hedgewars\Videos_). Note that video encoding is not real-time; actually, it will occur after you have closed game engine; it takes some time so you must not close frontend after you have closed game engine or you may get damaged video files.
224
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    41
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    42
= How it works? =
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    43
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    44
Video recording is not real-time. Instead it works as follows:
225
770f7cffcb45 Edited wiki page VideoRecorder thru web user interface.
stepik-777@mail.ru
parents: 224
diff changeset
    45
When you play game or watch a demo press ‘R’, game then will start to record camera positions to *VideoTemp/?.txtout* and sound to *VideoTemp/?.sw*. Press ‘R’ again to stop recording. After you will close game engine QTfrontend will rename *?.txtout* -> *?.txtin* and run invisible instance of game engine which will actually encode video using prerecorded camera positions and sound; during encoding video file will be in *VideoTemp* and after encoding finishes it will be moved to *Videos/* and files *?.txtin* and *?.sw* will be automatically removed.
224
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    46
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    47
= Notes =
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    48
252
4c9881425131 Edited wiki page VideoRecorder through web user interface.
unC0Rr@gmail.com
parents: 225
diff changeset
    49
 * If you press ‘R’ multiple times during one game, you will get several videos. They all will be encoded simultaneously, and each instance of game engine will use hundreds of megabytes so be careful.
224
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    50
 * It is supposed to use H.264 (MPEG-4 AVC) video codec. Binaries of ffmpeg for Windows include it. However, on Linux you may have stripped libavcodec without libx264, then different codec will be used which will generate several times larger files. For Ubuntu this may help: http://ubuntuforums.org/showthread.php?t=1117283
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    51
 * Logs from ffmpeg/libav are written to game log (Logs/game0.txt).
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    52
 * Tested only on Windows and Linux.
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    53
 * For offscreen rendering OpenGL FAQ (http://www.opengl.org/wiki/FAQ#Offscreen_Rendering) suggests the following:
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    54
  _Some people want to do offscreen rendering and they don't want to show a window to the user. The only solution is to create a window and make it invisible, select a pixelformat, create a GL context, make the context current. Now you can make GL function calls. You should make a FBO and render to that. If you chose to not create a FBO and you prefer to use the backbuffer, there is a risk that it won't work._
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    55
 SDL 1.2 does not allow to create invisible window, that’s why glut library is used. (SDL 1.3 allows it)
80f71b23d36f add description of video recorder
stepik-777@mail.ru
parents:
diff changeset
    56
 * Video recorder relays on framebuffer extension or auxiliary buffer for offscreen rendering. If your OpenGL implementation has none of these then video recording may not work for you. Although, framebuffer extension must be common nowadays.
225
770f7cffcb45 Edited wiki page VideoRecorder thru web user interface.
stepik-777@mail.ru
parents: 224
diff changeset
    57
 * Setting large resolutions for video may not work due to limitations in your OpenGL implementation. At least resolutions not exceeding your screen resolution should work.