Ogg Video Tools provides the command line tool oggJoin to interleave two or more streams into one Theora video file. It is able to interpret the page granule position and interleave the streams in case they contain Theora video or Vorbis audio.
This process is also called multiplexing.
Synopsis: oggJoin newFile.ogv stream1.ogv stream2.oga [ stream3.oga [...] ]
Note: The video stream (.ogv) must come first.
Although oggJoin allows arranging the streams in any possible order, the Theora standard demands that the video stream be the first stream. Correctly stated: the Theora header must be the first header within a multiplexed file, in order to allow players to differentiate between audio only and video files. This is achieved by placing the video stream first stream in the list, as shown in the synopsis.