Controlling the Speed of YouTube, Flash, HTML5, and Desktop Videos with Deviare Hooks

June 13th, 2012 | Posted by Sebastian Wain in Audio | C# | Deviare | Video

Controlling Playback Speed

Our Deviare Hooking Engine can be used to speed up or slow down a video during playback using the code available here (github repository). This code is pretty small and clearly shows how Deviare handles the complexities of API hooking. Although this sample code deals only with video it is also possible to use Deviare to produce code for processing audio.

Controlling playback speed has multiple practical applications. The most obvious application is the classic “fast-forward”, but there are others. Studies done as far back as the late sixties indicated that listening to teaching materials that had been sped up by a factor of two twice is more effective than listening to them once at normal speed. Skeptical? see the Comprehension of Repeated Time-Compressed Recordings paper. Controlling the speed of a video is also a useful feature for learning. Slowing a video down may help when taking notes, while it can be sped up to skip unnecessary or redundant parts.

Our code can be used to modify the playback speed of videos on any site or application. Most internet video site do not allow you to control playback speed. YouTube is currently testing an HTML5 site that includes such controls. The desktop application VLC can also be used to stream YouTube videos at a couple of different speeds. The advantage of our solution is that it is independent of player capabilities.

Technical Details

The key to speeding up or slowing down a video is to convince multimedia players that our computer is slower or faster than it really is. If the application believes that the computer is faster than it really is, it slows down the video. If it thinks its slower, then the video will be played faster. For example, Adobe’s Flash technology relies on timeGetTime() to determine the time between each video-frame. If your computer is too slow to process a video-frame, then Flash increments the frame rate to keep it synchronized with the audio. If we make Flash believe that the elapsed time is shorter, the video will play more slowly.

Related Microsoft Windows Information

Some applications desgined to alter playback speed hook the functions timeBeginPeriod(), timeEndPeriod(), which affect a global Windows setting. Windows uses the lowest value (e.g: highest resolution) requested by any process. Setting a higher resolution can improve the accuracy of time-out intervals in wait functions. However, it can also reduce overall system performance, because the thread scheduler switches tasks more often. High resolutions can also keep the CPU power management system from entering power-saving modes. Setting a higher resolution does not improve the accuracy of the high-resolution performance counter.

Business Opportunities

If you are interested in building applications which control the speed of video playback, drop us a line or engage on a discussion in our forums.

Further Research

Accelerating audio poses some interesting challenges that are the subject of much research. One is how to increase the audio speed while keeping it intelligible. This is used in many fields: from learning to advertising. In advertising, it is used to convey the same audio message in a shorter period of time. Since time is money, this saves millions in big campaigns. The Techniques, Perception, and Applications of Time-Compressed Speech paper provides a good overview of this topic.

Related Services

  1. Reverse Engineering
  2. Interception and Filter Drivers Services
  3. Application Virtualization and Packaging

See Also

  1. Logging Printer Activity
  2. DirectSound Capture Using Deviare

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.