"Sure Plays Everywhere"
Resources>> Docs >>

Click here to view sample video clips.


News:
SurePlayer.org announces first open source MPEG 1 Java Video Player

 

Home >>

About >>

News >>

FAQs >>

Demos >>

Links >>

Download>>

Contact >>

 

Documentation (from the README):

SurePlayer Version 1.0 4/19/01

SurePlayer is an all-Java open-source streaming video player. It makes video clips available to web viewers without them needing any preinstalled viewer software (besides a web browser with JIT compiler).

On a reasonably fast CPU (350+ Pentium), it will decode approximately half-size video (256 x 192 x 24 fps). Faster processors give better results--my 1ghz PIII can *almost* handle full-rate full-size MPEG-1.Postage stamps (128 x 96, 64x48, etc) work well on just about any
machine.

-- BUILDING

make

-- RUNNING

Sureplayer runs as an application or an applet. To run off the
command line: 

java -Xincgc -cp sureplayer.jar org/sureplayer/SurePlayer sample.mpg

The "-Xincgc" flag turns on the incremental garbage collector, which keeps play smooth. On my box, the non-incremental garbage collector interrupts play for about 100ms, which makes for jerky video.

To run as an applet, view

sample.html

Which is included.

-- ACKNOWLEDGEMENTS

This player builds on the excellent work of three other projects:
heavily-tweaked version of MPEG_Play, coupled with a similarly-tweaked JavaLayer audio decoder, which was based on maplay.

MPEG_Play MPEG video decoder:
Joerg Anders
http://rnvs.informatik.tu-chemnitz.de/~jan/MPEG/MPEG_Play.html

JavaLayer MPEG Layer 1-3 audio decoder:
Mat McGowan (JavaLayer)
http://www.javazoom.net/javalayer/javalayer.html

maplay MPEG Layer 1-3 audio decoder:
Tobias Bading (maplay3-1.1)
ftp://ftp.tnt.uni-hannover.de/pub/MPEG/audio/other-servers/Maplay-Mirror

I am deeply indebted to Joerg Anders, who wrote the MPEG video decoder. I apologize for massacring his source. To start a project with such an excellent base is a rare pleasure.

Thanks to Rick Prelinger and Brewster Kahle, for the archive.org film material.

I'd like to thank the folks at OptimizeIt. It's a a truly excellent Java profiler, with Linux support. Using it I was able to achieve a ~2x speedup from the original source.

This project would never have started without BYOBroadcast's commitment and support. Big thanks to Ben Krysiak and the rest of the gang for sponsoring this work.

-- HOW TO Code Video for SurePlayer

While SurePlayer should play any MPEG-compliant stream, it works better with some rather than others. Your biggest problem in coding video is size--to ensure that your file has a chance of playing in a large percentage of web browsers, 

Size: keep the image size down. 256 x 192 (49k pixels) works well in most browsers. 160 x 120 (19k pixels) is safe even on a slower box. 354 * 240 (85k pixels) is too big for all but the most stoked boxes.

Bitrate: If you want typical DSL and cable modem user to be able to stream your files, keep the total bitrate below 400kbit/sec. That gives you 112 for video and 288 for video. 160x120 around 300kbit/sec looks pretty good.

Framerate: MPEG-1 supports a fixed set of framerates: 23.976 24, 25, 29.97, 30, 50, 59.94, and 60. Rates 30 and less are appropriate for web streaming, and the slower the better.

I am told that given a clever MPEG encoder, you can synthesize half and third rates with a small bandwidth cost by interspersing empty B-frames into the stream. I have yet to try this, as it isn't supported by mpeg_encode. I intend to modify mpeg_encode to try this--I'll report on how it works once I get it going. If you already have a tool to do it, please let me know.

Interlace: Interlace is evil.

If your material was from 24fps progressive source but was transfered to 29.97 video, be sure to remove the 3:2 pulldown. Find a good article on 3:2 pulldown at:

http://www.dvdfile.com/news/special_report/spotlight/3_2_pulldown.htm

-- Creating MPEG on Linux

There are many good resources on the web describing how to create MPEG. Start looking at http://www.mpeg.org I am using the following tools:

MPEG Video Encoding

BERKELEY MPEG TOOLS (Version 1.0, Release 2; August 1995)
mpeg_encode
http://bmrc.berkeley.edu/frame/research/mpeg

Note: the sample parameter files included in the mpeg_encode
distribution produce awful-looking video, because the quality parameters are set too low. A sample mpeg_encode.param file is included in this distribution that better balances the tradeoff
between space and quality.

MPEG Audio Encoding

toolame-02h
http://members.dingoblue.net.au/~mikecheng

Most MPEG video files are coded with MPEG Layer II audio. This is less efficient, but less CPU-intensive, than MPEG Layer III. SurePlayer supports Layer II and Layer III audio, but Layer III currently adds about 60k to the Jar file size.

I used toolame to encode MPEG Layer II audio. It does a great job. For small streaming web files, I've been coding mono around 112kbits and getting good results.

Multiplexing Audio/Video

lavtools mplex version 1.3b3 Release 1.4.1 (7.12.2000)
http://mjpeg.sourceforge.net

Be sure to use the lavtools version of mplex, not the older one
floating around on the net. The mjpeg people added variable bitrate support, which is critical as Berkeley's mpeg_encode produces variable bitrate video. VBR is good -- you want it because it produces files that are significantly smaller at a given quality.

MPEG Statistics
mpeg_stat
ftp://mm-ftp.cs.berkeley.edu/pub/multimedia/mpeg/stat

I'm using the Berkeley mpeg_stat program to gather statistics on the files I've created. It's a great tool--it will tell you exactly
where your bits are going.

-- BUGS

1. No audio on Linux Netscape Navigator 4: It appears no one bothered to implement the Sun's unsupported AudioPlayer API on the Linux version of Navigator. Navigator 6 should work, as it supports the javax audio classes.

2. Shutdown problems on IE: Quite often IE 4 doesn't bother to call the applet's stop method when backing off a web page running the applet.

3. Thread shutdown issues: Some of the threads don't close down cleanly on stop.


-- TODO

Front-end buffer: Buffer a large amount of video before play start, to smooth out streaming over dubious connections.

Fix LayerIIDecoder so that put_next_sample isn't called zillions of times