4.6 Saving scripts as videos

Starting with Hollywood 4.0 it is possible to save Hollywood scripts as AVI video files. This is useful for example if you want to create DVDs of your Hollywood scripts or just run them on a platform that is currently not supported by Hollywood. Saving Hollywood scripts as video files also allows you to import them into video editing software for further processing or format conversion.

Hollywood's video recorder was designed with the idea in mind to reproduce the exact behaviour of the Hollywood script in a video file. Thus, you will most likely not notice any difference between the video file and the actual Hollywood script. Hollywood's video recorder tries to time the script exactly as it would appear in real time mode. Hence, it is no problem for the video recorder to deal with scripts that require exact timing - for example for synchronization with music. The video recorder pays special attention to this and tries to time everything correctly.

To enable the video recorder mode you simply have to specify the -videoout argument together with a filename for the video to be created. Hollywood will then start in recording mode and graphics and sounds will now be redirected into the video stream. Thus, when in recording mode, no sounds will be played because sound data is immediately rendered into the video stream. Also, please note that certain options are disregarded when Hollywood is in video recording mode. For example, in video recording mode Hollywood will always open in windowed mode, never in full screen even if you specify so. Also the window will not be sizeable etc.

The video file written by the video recorder will be an AVI 2.0 stream adhering to the OpenDML standard so streams greater than 2 GB are possible. Hollywood currently uses the Motion JPEG codec to compress the video frames. Audio data is written to the video file without any compression. You can control the quality of the Motion JPEG by using the -videoquality argument.

To achieve the best result you may need to adjust some parameters in the video recorder with which we will deal now:

  1. First, it is advised that you tell the video recorder how many frames per second shall be recorded. You can do this by using the -videofps argument. The value that you specify here should be identical to the frequency of your main loop. If your main loop runs at 25 frames per second, e.g. using the following code:

     
    SetInterval(1, p_MainLoop, 1000\25)
    

    Then your video file should also run at 25 fps. So you would have to specify

     
    -videofps 25
    

    on the command line to tell the video recorder that you want your video to have 25 frames per second.

  2. You may want to specify a scaling resolution for the video file. Remember that the video resolution cannot change but must be static throughout the whole video. Hollywood can change the resolution of its display at any time but for video files this is not possible so if Hollywood's display size changes while the program is in video recording mode, graphics will be scaled to keep up the correct video resolution. By default, the video resolution will be set to the resolution of the first background picture. If you want a different resolution, however, you must specify the -scalewidth and -scaleheight arguments.

  3. Your Hollywood script needs to follow a certain pattern in order for the recorder to save it as a video file. Particularly, the recorder needs to know when its frame buffer shall be flushed into the video file. Normally, this is done whenever it encounters a waiting command. For instance:

     
    VWait()
    Wait()
    WaitEvent()
    WaitTimer()
    etc.
    

    Thus, it is necessary that you use one of the commands above in your script! Your script needs to employ a timing mechanism, otherwise it cannot be converted properly into a video file. Suggested timing mechanisms are either using an interval function which is called a certain number of times per second or using WaitTimer() or VWait(). See script timing mechanisms for more information on the importance of using a correct timing mechanism.

    Flushing the frame buffer whenever a wait command occurs is called the "wait strategy" which is also the default video strategy. Normally, the wait strategy should be suitable for all purposes. With correctly timed scripts, the wait strategy delivers the best results. In some very rare cases - or for debugging purposes - you might want to use the raw strategy instead. When -videostrategy is set to raw, the video recorder will render every frame to the stream no matter if waits are used or not. In most cases, of course, this results in wrongly timed videos so you will most likely never want to use the raw strategy.

  4. Finally, you must decide whether or not the mouse pointer shall be rendered into the video stream. By default, this is disabled because rendering the mouse pointer into the video makes only sense in special situations, for instance if you are creating a demo video where user input shall be visible. To turn on mouse pointer recording, specify the -videopointer argument. All mouse pointer movements will then be recorded in the video file.


Show TOC