VBScreenCap : Capture d'écran facile en vidéo AVI
Par Patrice Dargenton
Version 1.0 du 05/02/2005
Capture Activities on Screen in a Movie
Source elle-même en provenance de MSDN : Encoding a File
Ce logiciel permet de capturer l'activité de l'écran pour en faire un fichier vidéo au format AVI, ce qui est utile par exemple pour faire des présentations de logiciel (sans avoir à installer le logiciel). On peut aussi capturer un commentaire audio, via la source par défaut de l'enregistrement audio de votre poste Windows. Pour avoir une qualité suffisante, notamment pour que les textes affichés soient lisibles, le débit est élevé et faiblement compressé. Si cela ne suffit pas, il est possible de diminuer la résolution en taille et en couleur de l'écran, et cela directement dans les propriétés du raccourci, ou de l'exécutable (voir la doc en anglais pour plus d'info.). Si le logiciel ne marche pas, par exemple s'il manque un composant (en l'occurrence "Windows Media Encoder 9 Series"), vous serez pris en charge ! (mais quand même pas pour l'absence de .Net)
- Le double-clic ne fonctionne pas pendant la capture, sans doute que, par manque de rapidité, certains événements de souris se perdent (réduire la vitesse du double-clic ?) ; utilisez le bouton droit de la souris, on peut généralement trouver un menu alternatif ;
- Pour certaines captures, par exemple pour capturer la visualisation d'une vidéo dans Windows Média Player, il faut désactiver l'accélération matérielle de la carte graphique, car la capture ne peut fonctionner que pour ce qui est géré de façon logiciel. Cela concerne aussi certains effets graphiques tels que l'effet fantôme (avec frm.Opacity) ;
- Si vous arrivez à faire du 800x600 ou plus, dites mois comment vous avez fait, car je n'ai pas réussi à dépasser du 640x480 (quelque soit la résolution de départ) ;
- La vidéo produit est au format Windows Media Video 9 : si le codec est absent sur le poste où vous voulez diffuser votre vidéo, le codec sera téléchargé automatiquement par Windows Media Player (en version XP en tout cas) ;
- Si on essaie de compresser la vidéo après coup par le code (voir l'exemple "Encoding a File" plus bas), au lieu de le faire en temps réel, cela ne change rien, on retombe en 320x240 (le format de Microsoft en vaut que pour le temps réel, sinon il ne vaut rien, à moins qu'il n'y ait un paramétrage à faire ?) ;
- Le fichier vidéo produit n'est pas reconnu par VideoToolBox v220.127.116.11, un utilitaire permettant de retrouver le codec de la vidéo, mais le format est convertible par TMPGEnc.exe, par exemple en DivX 3.11 avec le son en MP3 :
Dans cet exemple, j'ai capturé le son après coup et je l'ai mixé grâce à TMPGEnc (ne pas interrompre l'encodage, car le mixage du son se fait en seconde passe, une fois que la vidéo est complètement compressée, on ne peut donc pas tester le son sur le début de la vidéo : seul la compression vidéo peut être testée ainsi sur un échantillon).
Site de TMPGEnc : www.tmpgenc.net/fr/f_main.html
Téléchargement (gratuit) : http://download.pegasys-inc.com/download_files/TMPGEnc-2.521.58.169-Free.zip
- VBScreenCap est un logiciel .Net, la plateforme .Net (Framework 1.1) doit donc être installée (gratuit aussi) :
- Pour ceux qui n'ont pas Visual Studio .Net, n'oubliez pas que Visual Basic 2005 Express Edition Beta est gratuit jusqu'à nouvel ordre, n'attendez pas ! (Microsoft n'a pas encore décidé s'il serait payant d'ici la fin de l'année) :
Programming Reference (point d'entrée du SDK) :
Visual Basic Code Examples :
Encoding a File (Visual Basic) :
Définir un profil (résolution de capture) :
Producer 2003 page :
Microsoft Producer for Microsoft Office PowerPoint 2003, the current version of this popular add-on for Microsoft PowerPoint, can help you easily capture, synchronize, and publish audio, video, slides, and images. It's the ideal tool for creating engaging presentations, training, and business communications.
Best Practices for Using the Windows Media Screen Codec White Paper :
Best Practices for Using the Windows Media Screen Codec
by Laura Knops
Microsoft® Windows Media® Encoder 9 Series, Microsoft Producer for Microsoft Office PowerPoint® 2003, and the Microsoft Windows Media Screen codec
This software is based in part on the work of the Independent JPEG Group.
GIF decompression code, copyright 1990, David Koblas. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appears in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.
This paper describes the benefits of using the Windows Media Screen codec to capture screen content, highlights some common usage scenarios, and offers best-practice recommendations for enhancing the appearance and behavior of the screen content that you capture.
As a content owner or subject-matter expert, you can use Microsoft® Windows Media® Encoder 9 Series or Microsoft Producer for Microsoft Office PowerPoint® 2003, and the Microsoft Windows Media Screen codec to capture content directly from a computer screen and to compress that content in Microsoft Windows Media Format. The Windows Media Screen codec relies on sophisticated algorithms that process data in a unique way, achieving very high levels of compression for typical application video. By using the Windows Media Screen codec, you can reproduce computer screen images, such as mouse movement, dialog boxes, and drop-down menus, at data rates as low as 15 kilobits per second (Kbps) or at screen resolutions as high as 2048x2048.
Because of its relatively small file size, the content can then be sent over an intranet or the Internet using a variety of methods, including live streaming of the content over dial-up modems, or sending the file as an attachment in e-mail messages. Users can experience high-quality content, even over dial-up connections, without needing to know what the codec is or how it works.
This paper covers the following topics:
· Usage Scenarios. Discusses common scenarios for capturing content by using the Windows Media Screen codec, and describes the tradeoffs of using the different codec versions: Windows Media Screen 7 codec and Windows Media Video 9 Screen codec.
· Best Practices. Provides guidelines for achieving the best results using the Windows Media Screen codec.
· Recommended Configuration. Describes the optimal hardware configuration for using the Windows Media Screen codec.
· Playback Considerations. Explains how the Windows Media Screen codec is used with Microsoft Windows Media Player.
· For More Information. Includes links to more information about creating content using the Windows Media Screen codec.
By using the Windows Media Screen codec, you can easily configure Windows Media Encoder or Producer for Microsoft Office PowerPoint 2003 to capture and compress data from computer screens. This screen-capture technology allows you to quickly and easily deliver content to users over an intranet or the Internet in a variety of scenarios.
Both Windows Media Encoder and Producer enable you to take advantage of the advanced capture and compression features of the Windows Media Screen codec. When you use Producer, you can capture screen content using the Windows Media Screen codec and incorporate that content into rich media presentations that can include existing PowerPoint presentations, Windows Media files, still images, and HTML files. The Capture Wizard in Producer guides you through the process of capturing screen content, which is then automatically imported into your current Producer project when you save the captured file. For example, you may want to use Producer to create a rich media presentation for online training that incorporates a variety of elements, including the instructor's audio narration of PowerPoint slides as well as screen captures that provide an informative demonstration for students.
When you use Windows Media Encoder, screen capture and encoding can take place in one of two ways:
· You can capture and encode content directly from the screen by using Windows Media Encoder and the Windows Media Screen codec.
· You can capture content by using other screen-capture programs, and then convert that content to Windows Media Format by using Windows Media Encoder.
There are several advantages of capturing screen content directly by using Windows Media Encoder and the Windows Media Screen codec. This technology provides a simple, easy-to-use solution for live streaming of low data-rate content. The content is instantly ready for streamed distribution to viewers, and no additional software tools are necessary to create the Windows Media file.
For example, you may want to stream live demonstration content and slides from seminars or conferences over an intranet or the Internet. You can capture and stream both demonstrations and slides in real time without any disruption to those attending the live event. You can also archive the content with negligible post-production efforts so users can access the content on demand. This method for capturing and compressing content produces relatively small files. For example, a 73-second screen capture video compressed at 22 Kbps can maintain a file size of 197 KB.
If you are not streaming a live presentation, though, you may want to use a screen-capture program, such as TechSmith Camtasia Studio or any of a number of other commercially available options, which allow you to edit and annotate your content after you capture it. You can capture your audio and video tracks separately, and then adjust the tracks using the screen-capture program or a variety of editing and post-production software, such as Adobe Premiere Pro and Adobe After Effects, that support uncompressed .avi files. For example, you may want to resize the video, add pan and zoom effects, or pause at specific frames to accommodate a longer audio narration.
In this case, Windows Media Encoder uses the uncompressed .avi file, rather than the computer screen, as its content source. This ability to convert files also means that you can compress and reuse legacy content without needing to recreate it from scratch. When you encode uncompressed .avi files, though, files sizes and bit rates may be greater than when you capture and encode content using the Windows Media Screen codec. This scenario may be ideal for deployments, such as help desk support and on-demand software training, in which the content is downloaded from a Web server or delivered on CD-ROM, rather than streamed in real-time.
For example, you can use the captured screen content to demonstrate software applications to users, rather than relying on static text and screen shots. You can create clips of various user activities or product functions, and integrate those clips into any Web page. You may also want to edit the file before compressing it to add various features to the clip, or to correct any mistakes made in the original screen capture. After the edits are completed, you can compress the .avi file by using Windows Media Encoder and post it to a Web site. In addition to providing an easy way to get product information to customers, this scenario also offers significant value to sales personnel, who no longer must set up and maintain multiple applications.
In most scenarios, it is recommended that you use the Windows Media Video 9 Screen codec, which provides improved handling of shaded images, screen motion, and scrolling for screen captures. This latest version supports one-pass constant bit rate (CBR) and variable bit rate (VBR) encoding with no dropped frames, and is fully optimized for both streaming and download-and-play scenarios. It provides a higher frame rate than the Windows Media Screen 7 codec, so users will have a better experience when they view the content.
Use version 7 when you want all of the capture area, including the continuous-tone regions, to look exactly like the original. The tradeoff of having this exactness is that many more frames will be dropped, and some scene changes may be missed entirely when you capture content using version 7 of the codec. Version 9 decreases the resolution in continuous-tone regions, but provides a better viewing experience. By design, the more restricted the bit rate is, the more quality will be lost in the continuous-tone regions.
Also, use version 7 when your target audience includes users that have Windows Media Player version 6.4, which does not support the Windows Media Video 9 Screen codec and the Windows Media Audio Voice codec.
If you plan to use the Windows Media Screen codec to capture and compress your content, follow the best-practice recommendations in this section to obtain optimum screen-capture quality. These recommendations primarily enhance the appearance and behavior of the captured content, but some of the recommendations may affect the steaming capabilities, and potentially make the content less fault-tolerant. Therefore, make sure that you test your settings prior to deployment to ensure that the results are acceptable for your scenario.
þ Set the screen resolution.
First determine the screen resolution at which the majority of your users will view the content. Then, on the computer where you will capture the content, set that same screen resolution in Control Panel in the Display Properties dialog box. For example, if most users will view the content in an 800x600 window, capture your content at a resolution of 800x600 or lower.
When you capture content at a lower resolution than users are viewing on their screens, Windows Media Player displays a border, the controls are visible, and the content is legible. If you capture the content at a higher resolution than users are viewing on their screens, the streaming content will be resized to fit the Player window, and the quality and legibility of the content may be seriously degraded.
The Windows Media Screen codec will accept screen resolutions from 32x32 pixels to 2048x2048 pixels. Capturing content at a 1024x768 resolution yields more data than capturing at 640x480, so use a lower screen resolution whenever possible. A resolution of 800x600 or lower is recommended.
Also note that the screen resolution that you select is not the same as the frame size that you use to capture the screens. For example, you might set your screen resolution to 800x600, and then capture a frame size of approximately 640x480 pixels.
þ Do not use a background image.
Having an image in the background of your screen capture increases the amount of data, so it is recommended that you turn off the screen's background image. In Control Panel in the Display Properties dialog box, choose None for the background.
This same recommendation also applies when you capture a window of PowerPoint slides. To reduce the amount of data that must be encoded, sent, and decoded, avoid elaborate graphical backgrounds on your slides.
þ Decrease the color quality.
Decreasing the color quality reduces the amount of data that the graphics card must process. In Control Panel in the Display Properties dialog box, set the color quality to 8-bit or 16-bit color. Many modern graphics cards do not have an 8-bit color quality option, and in many cases, 32-bit color will be captured at higher capture frame rates than 16-bit color.
þ Turn off font smoothing.
Fonts that have the edges smoothed do not compress well. In Control Panel in the Display Properties dialog box, use the Effects options on the Appearance tab to turn off font smoothing.
þ Turn off hardware acceleration.
Hardware acceleration can decrease the video quality because it moves some video data processing to the graphics card, which accelerates the CPU processing but slows the ability of the Windows Media Screen codec to read the video data. By turning off hardware acceleration, the video data is stored in main memory and processed by the CPU; therefore, the data can be read faster by the Windows Media Screen codec. In Control Panel in the Display Properties dialog box, use the Advanced options on the Settings tab to turn off video hardware acceleration.
þ Use a Windows Classic theme to avoid dithering effects.
To avoid the dithering effects of the standard Windows XP display appearance, in Control Panel in the Display Properties dialog box, change the theme to Windows Classic.
Alternately, if you want to maintain the Windows XP appearance, do the following:
1. In Control Panel in the Display Properties dialog box, click Appearance, and then click Advanced.
2. On the Advanced Appearance dialog box, for Item, click Active Title Bar, and then for Size, type 21.
3. For Color 1 and Color 2, select the same color. To do so, set Color 1 as a custom color, and then set Color 2 to that same custom color.
4. Repeat steps 2 and 3 for each item that you need to adjust.
þ Close all other applications.
Before you capture content, close all other applications that you are not using so that they do not affect the availability of system resources while you are capturing screens.
þ Maximize the audio quality.
If you plan to capture and compress data from a computer screen directly (as opposed to creating an .avi file), and you plan to use audio, take steps to maximize the audio quality. For example, use a high-quality microphone, and consider using a room designed to minimize background noise.
þ Create a custom template and profile.
If you want to use Producer to capture screens at resolutions higher than 800x600, create a custom template and profile to capture the screen images at these higher resolutions. For more information about creating a custom template and profile, see Producer Help. You can download Producer and also review the white papers available from the Support Center on the Producer 2003 page (http://www.microsoft.com/office/powerpoint/producer/prodinfo/default.mspx).
þ Use a remote desktop connection.
The recommended configuration for screen capture is to run Producer on your primary desktop, and then capture screens from a remote computer. This configuration distributes the workload between the two computers. You can set the capture properties, including the display size and color depth of the remote computer, by using the Display tab in Remote Desktop Connection options.
þ Use a fast processor and graphics card.
Capturing screens is a performance-intensive process that requires a powerful CPU and a fast graphics card. For the best results, use the fastest processor you can obtain or better yet, use a computer with multiple fast processors. The graphic card also makes a significant difference in the screen-capture performance. Use a graphic card with a very fast bit block transfer (BitBlt) in order to quickly retrieve the frame buffer from video RAM (VRAM) to system memory. For more information about the recommended computer configuration for capturing screens, see Recommended Configuration.
þ Check the hardware interrupts.
Check the interrupts to make sure that the audio and video cards are not using the same interrupt request (IRQ). This issue is common for laptop computers.
þ Uninstall unnecessary audio cards.
Uninstall the motherboard audio and any other audio cards that you are not using. Multiple cards compete for resources, including the IRQs, even if the cards are not actively being used.
þ Use one monitor only for capturing content.
If you have a multiple-monitor system, make any necessary adjustments so that you can capture all screens from the primary monitor only.
þ Make sure that your screen capture and encoder settings are in sync.
If you are using another software program to capture your content, and then you are encoding that content using Windows Media Encoder, make sure that the settings of the two programs are in sync. For example, you do not need to capture content at 30 frames per second (fps) if you are going to encode that content at a peak bit rate of 4 Kbps and a frame rate of 5 fps. In fact, this scenario may overload the bit rate with the frame rate and cause the Windows Media Screen codec to miss scene changes within the content. Therefore, capture and encode your content using the same bit rate and frame rate.
þ Capture content for .avi files in uncompressed format.
If you are using other screen-capture, editing, or post-production programs, make sure that your content is captured and edited in an uncompressed format. The goal is to keep the content in uncompressed format from when it is captured until it is ready to be compressed in Windows Media Encoder. Many programs have default settings that automatically compress content, and this compressed format may degrade the quality of the encoding content in Windows Media Encoder.
þ Avoid capturing the entire screen display area.
Capture only the application window or applicable region of the screen, choosing the smallest area possible.
þ Minimize the number of graphics.
Minimize the number of graphics in the capture area. For example, do not capture unnecessary advertising frames and associated graphics on Web pages.
þ Use the lowest frame rate possible.
Consider the average frame rate for users' computers that will be downloading the content, and capture content using the lowest frame rate possible. You may have to experiment with the setting to determine the frame rate that meets your needs.
þ Reduce the number of on-screen activities.
Consider the types of screen activities that can be accommodated by your average frame rate. For example, a frame rate of 3-5 fps will accommodate basic mouse activity and limited typing. To improve video quality, avoid or minimize the occurrence of the following screen activities, which can be difficult to compress or require additional bandwidth:
· Opening and closing windows. As with camera video, the quality of application video degrades with excessive motion. Whenever possible, avoid rapidly opening and closing windows.
· Dragging windows across the desktop. Dragging windows might result in dropped frames, because this type of movement makes it impossible for the codec algorithms to have a consistent frame of reference to compute data. If dragging windows is necessary, in Control Panel in the Display Properties dialog box, use the Effects options on the Appearance tab to turn off the visibility of windows contents when you drag.
· Zooming in and out. This activity can cause content to blur, which is difficult for the Windows Media Screen codec to capture and reproduce. Content will look best when it is captured at 100% of its original size.
· Scrolling up or down on a Web page. Scrolling makes it difficult to maintain a consistent reference point, resulting in dropped frames. This issue underscores the importance of creating content at the appropriate resolution. Using the PAGE UP or PAGE DOWN keys may be an acceptable alternative.
· Displaying images containing great variation in color depth. It is difficult to compress an image when there is significant variation in color from one pixel to the next. The result may be dropped frames of data.
· Using the Windows Media Screen codec to capture a screen that includes a window in which camera video is playing. Compression of camera video and compression of application video are two very distinct techniques. Using the Windows Media Screen codec to compress camera video can result in less than optimal results. You should use a video codec, such as the Microsoft Windows Media Video codec, to compress camera video.
þ Capture short segments of content.
Consider the screens that you intend to capture. Users often have better retention of short segments of task-oriented content rather than longer product overviews. Ideally, your content will be 5 minutes or less in length.
þ Use single-pass VBR to encode content from other sources.
If you are using Windows Media Encoder to encode an uncompressed .avi file, choose one-pass VBR video with a quality level of 93 or higher.
þ Use the highest bit rate possible for your deployment scenario and content.
After you determine your target bit rate, review the total bit rate on the Compression tab in Windows Media Encoder. The encoder adds an overhead value to the audio and video bit rates, so the total bit rate number will actually be higher that the combination of the audio and video bit rates. Therefore, you may need to adjust the audio and video bit rates in order to meet your target bit rate.
If your audio content is speech-only, and it is recorded under good conditions, an audio bit rate of 4 or 5 Kbps can be acceptable. If the recording also contains other sounds, noises, or music, a higher audio bit rate may be necessary.
þ Set the output frame size to the same value as the source.
Do not use Windows Media Encoder to resize the source video. Doing so will severely degrade the image quality and may make text illegible.
þ Increase the buffer size.
You may want to set the buffer to a higher value, such as 10,000 milliseconds. A larger buffer can accommodate a better image quality, but the user must wait longer for the video to start, as a player waits to play until its buffer is filled.
þ Increase the key frame rate.
You can potentially increase the maximum number of seconds between key frames because there is often less movement between screen frames than with traditional video. For example, often nothing changes between screens for 10 seconds or more except movement of the cursor. A key frame has much more data in it than the average I-frame. Therefore, processing more key frames than you need for your content may decrease the quality.
Increasing the number of seconds between key frames means that less data is required to create an image over a period of time. This setting depends on the type of screen captures you are doing, so test the setting to determine the key frame rate that works best for your content. You may want to experiment with key frame rate settings of 6, 10, and even 20 seconds. Also note that the Windows Media Screen codec automatically inserts a key frame at each scene change regardless of the key frame rate setting.
þ Set Windows Media Encoder to run in 256-color mode.
To further improve the CPU usage, you can set the Encoder to run in 256-color mode. To do so, right-click the executable file, click Properties, click the Compatibility tab, and then select the Run in 256 colors check box.
Keep in mind that running in 256 colors can introduce a palette change when switching between programs that have different color schemes. The Encoder does not support palette changes for real-time screen capture. Therefore, you should use 16-bit colors or capture to an .avi file first, and then use the Encoder to convert the file to Windows Media Format.
The following table provides the recommended configurations for capturing and encoding content by using the Windows Media Screen codec. For optimum performance, you should also use an operating system that runs applications, not services, in the foreground.
Microsoft Windows XP Professional
Windows XP Professional
Microsoft Windows 2000 Professional
Dual Pentium IV, 3.0 gigahertz (GHz)
Pentium IV, 2.5 GHz
Pentium II, 450 MHz
Free hard-disk space
500 MB for content creation and editing
5 MB for Windows Media Tools; enough free hard-disk space for content creation and editing
5 MB for Windows Media Tools
Table 1. Component Configuration
Windows Media Screen codecs are included with Windows Media Player 9 Series. Users of earlier versions of Windows Media Player that have an active Internet connection will automatically receive the Windows Media Screen codec the first time they access content that was created with the codec. The automatic codec-download mechanism means that users do not need to install a new Windows Media Player every time a new codec is developed. As a result, information technology (IT) support costs are reduced and users enjoy a better multimedia experience.
Enterprises that have locked down users' desktops or that prevent users from accessing the Internet can deploy the Windows Media Screen codec by using a codec installation package. To download a codec installation package, go to the Codecs Installation Packages page (http://www.microsoft.com/windows/windowsmedia/format/codecdownload.aspx).
The Windows Media Screen codec is installed with Windows Media Encoder 7, Windows Media Encoder 9 Series, and Producer 2003, and will be available through many third-party applications. You can download Windows Media Encoder from the Windows Media Encoder 9 Series page (http://www.microsoft.com/windows/windowsmedia/9series/encoder/default.aspx).You can download Producer from the Producer 2003 page (http://www.microsoft.com/office/powerpoint/producer/prodinfo/default.mspx).