Java NAL Parser
This package includes tools written in Java to read and process NAL packets of the MPEG H264/AVC standard. It is possible to read NAL header data, stream NAL data at fixed FPS rate, split certain layers of SVC streams without the dependent layers, and just print data found inside NAL streams. In order to decode the packets, the official standard decoder is required.
The SCVStreamPlayer allows you to input a SVC stream and then displays the video contained in it in mplayer. The implementation was used to make a proof of concept for LiveShift, a peer to peer video streaming application. The idea was to allow different peers to watch different qualities/resolutions of a video and still have data shared in between them. The results are encouraging as it suceeds in general, but the decoding is very CPU-demanding — dual core processing could barely manage iPhone resolutions. In order to boost its performance, it uses multiple threads for the player class.
- SVCStreamExtractor - Extracts NAL packets by type.
- SVCStreamPlayer - Takes a NAL packet stream and tries to play it with mplayer.
- SVCStreamPrinter - Prints list of NAL packets in stream.
- SVCStreamRater - Slows streaming down to a fixed rate.
- create_multi_layer.pl - Prepares all files necessary for LiveShift based on
- SVCPacket - Encapsulates a NAL packet, made basically for reading not writing. * SVCStreamReader - Takes an InputStream and returns SVCPackets.
- DatagramOutputStream - Implements an OutputStream to send UDP packets
- BitInputStream - Implements an InputStream to read single bits
- DatagramInputStream - Implements an InputStream to recieve UDP packets
- See the main methods in the java classes. Best use eclipse an import the whole project, then configure to your setup.
- For create_multi_layer.pl, look inside the source code for setup.
- Some hard coded paths inside the source files.
- Requires some setup, especially if not under Ubuntu.
- Implementation not complete, just enough to make a PoC. Missing ability to read NAL "header" packets.
- mplayer for the SVCStreamPlayer
- ffpmeg for the create_multi_layer.pl script
- jsvm compiled (working BitStreamExtractor H264AVCDecoderLibTest H264AVCEncoderLibTest)
- perl for the setup helper script
- JSVM necessary binaries, compiled on 64bit Ubuntu for 32bit (-m32).
- Sample encoded SVC data (split into stream and header).
- BitInputStream for reading bit streams in Java.
- DatagramInputStream for simple (and unreliable) InputStream.
GPL v2 (Exception: Bundled Software)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Copyright(C) 2009 CSG@IFI http://www.csg.uzh.ch Binzmühlestrasse 14, 8050 Zürich
The code was written by Alexander Schäfer during his assignment work, supervised by Fabio Hecht.