Thursday, January 11, 2018

MovieShop buffer underflow or overflow (by Steve Bowie)

Sometimes I get an error message when I Play (or Record) a scene which refers to a buffer underflow (or overflow). What causes this, and how do I fix it?

Issues to Ponder:

First, note that these conditions CAN be caused by many factors which prevent video data being read from or saved to the hard disk properly.
SCSI errors (improper bus termination, poor connections etc.) can result in damaged data being written to the drive (mangled JPEGs) or data flow problems. SCSI bus issues can prevent video being streamed to and from the drive quickly enough to satisfy system requirements. Usually, SCSI errors will show up elswhere as well - transient error messages from the OS (checksum and bad block errors), frequent lockups and drive validation problems, and intermittent bootup failures are typical.
External video problems (sync, cabling etc.) can also be responsible for poor frames being recorded (or NOT being recorded!) When bad data is encountered, obviously playback halts. In either case above, buffer underflow can occur even though the buffer settings ARE CORRECT! If you are pretty sure you don't have these kind of problems (you haven't added or removed any drives lately, and the system behaves reasonably well otherwise), read on....

The RAM Buffer:

MovieShop uses a RAM buffer (temporary memory space) to ensure smooth transfer of video and audio data to and from the hard disk(s). Some other NLE systems simply drop frames instead, and you have to hope no-one notices! Another benefit of this arrangement is that less expensive (and often faster) non-AV rated hard disks can be used on the DraCo.

Max Buffer Size:

The maximum size of the buffer allocated is adjustable - the location of the slider depends on the version of MovieShop you use. In version 4.x, it is accessed from the Settings/Project menu. Sliders are located in the upper part of the tabbed panels for Video and Audio. A similar slider is hidden away in MovieShop v.5, and can only be accesssed by opening the Advanced Options window - see below for instructions.
The max Video buffer setting defaults to 2 megs, and this is generally adequate on a DraCo (before the 32 bit DCM card arrived, the lower transfer rates of the Zorro II bus used by the VlabMotion card meant much higher RAM buffers were common.) Changing this number is generally not necessary, but if all else fails you could bump it up a bit as an experiment.

Record and Play Burst:

Much more important than the max buffer size, are the settings for 'Record' and 'Play Burst!' These settings limit the size of a single 'chunk' of data which can be written to, or read from) the RAM buffer. The default settings for both Video sliders is 256 kbytes. This setting generally works well. However some hard drives 'prefer' to read and write data in larger or smaller 'bite sizes,' just as some people like their food chewed to a finer or lesser degree. It's not uncommon that adding or changing a drive can dictate an adjustment. If you frequently see under/overflow messages on Record or Play - especially when the problem occurs well (15 seconds or more) into playback - adjustment could well solve the problem. If the problem relates principally to playback errors occuring just after pressing Play, see the discussion of 'Preload Size' below.
Please note: while the settings are adjustable for both Video and Audio, we have never yet encountered a problem with the default Audio settings, so the discussion which follows refers only to the Video settings.

Accessing Buffer Settings:

To access the adjustment sliders, you must open the hidden 'Advanced Options' window. Press and hold the 'Right DraCo' key, and press 'e'. The 'Execute Command' string requester will appear. At the cursor, type the command 'openwindow advopts' - don't enter the quotation marks - then press the Enter/Return key. The Advanced Options window should appear.
Click on the 'Buffer' tab. In version 5, this is where the max buffer sliders are found. The left side of the panel exposes the Video settings.

Optimizing the Burst Settings:

As a general rule, identical settings for Play and Record seem to work just fine. Here's one way to determine optimal settings: Load a current project, then access the Advanced Options window as described above. Open the Scene list, and click on a typical scene, preferably one which lasts at least a couple of minutes. Before doing anything else, open the 'Status' window by selecting the Movie Shop menu item 'Windows/Status'. This little window shows three vertical 'LEDs' - the center one shows Video drive space in use; the right-hand strip refers to Audio space used. The left-most stripe is the one we're interested in. It shows RAM Buffer useage in real time.
Now we're ready - click Play in the Scene Control panel, and observe the activity of the buffer 'LED' in the Status Window as the video plays back. If the level of data in the buffer during playback is not being replenished by the hard disk quickly enough, the Buffer level will begin to decrease. It may take 15-30 seconds or more, but sooner or later there will be no video left to play from the buffer. Video playback will halt, and the 'video buffer underflow' error will appear ... the buffer has 'run dry!' Again, if this error occurs IMMEDIATELY on pressing play, see the segment below regarding Preload Size. (If it doesn't happen, you don't seem to have a problem - why are you reading this?)
Try a different setting. To begin with, don't get wild - just move the Playback slider one notch either way and try playback again. Watch for a change in the buffer useage pattern, as shown in the Status window. When you raise or lower the slider, you'll see a corresponding change in size of the 'jumps' the 'LED' displays on playback, but we're not concerned about that particularly. What we DO want to acheive is to find a burst size which our hard disk can happily live with - you'll know you're moving in the right direction when playback goes longer and longer before a problem occurs. Ultimately, you should quickly find an optimal setting permitting virtually endless playback without a glitch! Set the Record Burst size to the same setting, and you should have solved your problem.

Preload Size:

Also important is the 'Pre Load Size.' This setting determines how much data is preloaded into the buffer when you hit the 'Play' gadget BEFORE playback actually begins. Think of this setting as enabling the system to 'build up a little steam' before playback commences. (See above to locate this parameter's slider.)
Often, a hard drive will perform a themal recalibration shortly after playback begins. If the buffer was not sufficiently 'preloaded,' there might be no video data available in the buffer to permit continuous playback during this little 'hiccup.' Video playback would fail, usually resulting in a 'video buffer underflow' error. This slider defaults to 1 meg. Increasing the setting to 1.3 or 1.4megs will often cure a system experiencing playback problems that occur right after hitting Play.

No comments:

Post a Comment