Library – LibNSV

LibNSV was another one of my early projects. I started with this project right after I finished my Tic Tac Toe game.

The NSV Library project page can be found HERE 

NSV stands for Nullsoft Streaming Video, and was a format created by one of those working for nullsoft. The original creator of this format quit nullsoft before getting it out of Beta, and so it still stands as beta. More can be read here: NSV at Wikipedia.

Not too long after, the source and documentation of the format was given out, giving us programmers the chance to continue the format. Some started making their own streaming applications, and some created muxers. I wanted the NSV format to live, as I think it a wonderfull format for video streaming, and I therefore started to write the NSV library.

At the start I had practically NO idea how to manipulate raw binary and hex data, so I got a little help understanding the finer points of programming with raw data by asking one of those who had allready written some code for NSV. I sat manny hours studying hex versions of NSV files, and studying the documentation before I started to grasp what was where and what I had to read and manipulate. I started writing small command applications where I tried to read the framerate and some information in the header, to test what I had learned. After a while I left the project, seeking to do more game programming, and to get a better understanding of C/C++ before continuing. It took another year before I came back to the project, and at that time I started over from the ground.

It didn’t take long untill I had basic reading and writing of NSV files going, and I opened a Sourceforge.net account, wanting to give out my source for others to see and use. While writing the Library I also started a small application to test the library. That application was my first real application that actually did something usefull. It could open anny kind of NSV file, broken or not, and read out the raw/encoded video and audio, and then write them out into different files, it was an NSV Demuxer. it could also read simple information, like how manny key-frames, what the average bitrate was and some more. Using this application I found a lot of bugs in the library, like how I had missed the reading of AUX chunks in the frames, and how it sometimes flagged a frame as invalid when it was not.

nsvdemuxer_old_s1.png

Closer to the start/middle of 2007 if I don’t remember wrong, I started a NSV Muxer. I had started learning to use the ffmpeg library to read other formats, and then wanted to try my frame writing inside the NSV library. In the end I had a good enough NSV muxer that could take video and audio from other formats(AVI, MKV, MP3, MP4 etc.) and put them into a streamable NSV file.

NSV Muxer Old

The NSV Muxer never was released, but I did upload the source of the latest working version to the SVN on sourceforge(See links.) The reason I never released it was because it never worked like I really wanted it to. Yes, It could mux mostly ok, but sometimes if would give of random crashes, and ffmpeg would give information that I didn’t expect, or not give any information at all.

A little over the middle of 2007 I found the source for the NSV lib to be a mess, and fixing stuff was a pain. I figured I’d give out latest working version of the lib and the Demuxer/muxer on the SVN on sourceforge(See links) and then start a rewrite.

The rewrite was started is pure C(instead of the mix of C and C++) and was meant to be easy to read and use, and as bug free as possible. I wrote the file reading and writing of frames, and started on the streaming part(You can use your own filesystem or stream the data from anny source, like a network.) I got a bit stuck at the streaming part, and had little time ot ponder on it, so I left it for a while and went around trying to learn some graphics libraries like OpenGl, Ogre 3D and Irrlight instead.

As of now, January 2008, I have got an email from another programmer, asking to give me a hand in the project. Originally I had figured that I’d let the project be untill I was done at my current school, but since he offered to help, I started re-organising the rewrite, and uploaded it to the SVN.

I have plans to continue writing the library, and I have plans to write some tools for NSV. But as of now it goes slowly. I will see how it goes with the help of another programmer, as I have yet to actually be in a team when programming something, and he will probably work on his own untill I at least get over the exams at school.

I will continue to update this at a later time.

Links: See right —->

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: