Ogg Theora Cook Book


The command line is a text-based method of calling utility programs and others in a shell command interpreter session in a terminal program. Most GNU/Linux systems have a program called Terminal on the main application menu. In most cases, it offers the user the Bourne-Again Shell, 'bash', a successor to the original Bourne shell, 'sh', but there are several others in use.

Every user should know how to use simple text commands such as 'df -h', which says to get a 'disk fullness' report in 'human'-readable units (MB rather than disk sectors). The basic features and many of the intermediate concepts of the command line are documented in the Floss Manuals book Introduction to the Gnu/Linux Command Line, available at no charge at http://en.flossmanuals.net/gnulinux. Readers of that book who try out the examples given will be well prepared for anything described in this chapter. That is, they will have passed the beginner stage, and be ready to enter the threshold of the advanced user stage. Advanced command line use in GNU/Linux basically means two things: using the full range of options available in a command (as listed by the man command--try 'man man'), and writing scripts of more than a few lines using more than just simple commands.

Many video editing tools come in both a command line version and a full-screen text or GUI version that accepts a set of selections from the user, and composes a command line to execute. For example, installing packages from the command line in Debian, Ubuntu, and related GNU/Linux distributions uses the apt-get utility. (In Red Hat, use yum.) The full-screen text package installer in these systems is aptitude, and the GUI installer is synaptic. A well-written GUI tool can make it much easier to create, save, and reuse command options than selecting commands in text, or can help in navigating large file systems or databases. On the other hand, many GUI tools do not give control of all command options, so that more advanced use requires the command line, or alternatively saving complex commands in text files, and making them into executable script files with the chmod command.

Lossless Video Editing

Video editing is a very expensive venture in terms of your computer's computational power and memory consumption. This is because complex video editing tools must enable you to work with every frame of a video and every sample of an audio stream.

However, handling every single frame is not always necessary. In some cases, people only want to extract the video or the audio stream from a file, or merge ('multiplex') a file from video and audio streams, or they don't care about frame-accurate video cutting.

In these cases the video and audio streams don't need to be re-encoded and this makes the handling of video less costly in terms of your computer's resources. It also means the editing tools are very fast.

This editing process is called lossless, as there is no re-encoding involved. Re-encoding video always causes a loss in quality and editing video without re-encoding is therefore lossless. The encoded packets (chunks of data), either video or audio, are not touched. They are kept as they are, so they are decoded with the same quality they had before the editing process.


There are two main tool boxes for lossless video editing: The Ogg Video Tools and the Oggz Tools. They are both collections of command line tools. Ogg Video Tools and Oggz Tools works on GNU/Linux, OSX, and Windows.

Oggz can be found here: http://www.xiph.org/oggz/

Ogg Video Tools can be found here : http://sourceforge.net/projects/oggvideotools. If you are a Ubuntu user, you can directily install Ogg Video Tools by adding a Personal Package Archove to your system's Software Sources : https://launchpad.net/ubuntu/+ppas?name_filter=oggvideotools

In some cases the two tool sets overlap in their functionality. Oggz Tools is a bit more focused on developers, while the Ogg Video Tools is more focused on end users. Ogg Video Tools provides a lot more tools for creating and handling ogg video files, while Oggz Tools provides a number of other tools, especially for analysing ogg files.

Ogg Video Tools can handle video streams created by the Theora encoder and audio streams created by the Vorbis encoder. Oggz can handle additional stream formats, like FLAC, Speex, CELT etc.

Ogg Video Tools command line tools include:

  • oggSplit: demultiplexes a multiplexed ogg file into several files with one stream in each.
  • oggJoin: multiplexes Ogg audio (vorbis) and Ogg video (theora) files into a single Ogg file.
  • oggCut: creates a new Ogg file as a subpart of an original input Ogg file.
  • oggCat: concatenates two or more Ogg files.
  • oggResize: changes Theora and/or Vorbis streams in multiple ways. 
  • oggDump: prints a dump of packets or pages within a given Ogg file.
  • oggLength: returns the length of a given Ogg file.
  • oggSilence: creates a vorbis audio file of a given length and filled with silence.

Oggz Tools command line tools include:

  • oggz-chop: extracts part of an Ogg file between given start and/or end times.
  • oggz-merge: merges ogg files together, interleaving pages in order of presentation time.
  • oggz-sort: sorts the pages of an Ogg file in order of presentation time.
  • oggz-rip: extracts one or more logical bitstreams from an Ogg file.
  • oggz-info: displays info on the codecs used by an Ogg file.
  • oggz-comment: lists or edits comments within the Ogg stream headers.
  • oggz-validate: checks an Ogg file for common problems.
  • oggz-dump: prints a dump of the packet streams within a given Ogg file.