CodecPage
 video encoding&cleaning


 Codecpage News

 


Multiplexing (MPEG2)

Cutting MPEG streams usually works with demultiplexed files: separate video and audio. Most DVD authoring software also requires demultiplexed sources. Round plastic disks however are clumsy to use compared to harddisk storage. So if we just want to view some videos, instead of making a DVD structure (with the nice feature of menus), we may just decide to use simple MPEG2 format. This can also hold multiple audio streams and if our playback device has a 'goto' or a really fast forward/rewind function, we may need no chapters or menus.

For simply multiplexing, there is the ancient TMPGenc for example with it's extra functions, or a nicely made application named Imago MPEG-muxer.

Imago is very self explaining and works as quick as it gets. But sometimes we may have accumulated lots of files. The problem then is, we'd have to wait for completion of each job before we can start the next one.

So batch multiplexing would come in handy.

There is a program called Imagobatch, promising to do multiple files automatically. Alas it has some bugs:

Fortunately you don't need this tool too badly, as you can achieve the job by Imago's command line interface as well.

The interface description Imago spills at a DOS prompt (parameter /?) reads as follows:

--------------------------------------------------------------------------
ImagoMPEG-Muxer Command line interface:
--------------------------------------------------------------------------
ImagoMPEG-Muxer videofile [[audiofile1] [audiofile2] ...] [-o [-mpg|-vob|-vobs] [outputpath]]
# videofile: mandatory, full path required, enclose in ""
     Use mpv, m2v, mv2 file extensions only.
# audiofiles: if left out muxer searches for audiofiles itself.
     Zero, one or multiplex files allowed
     Use mp2, mpa, mp3 or ac3 file extensions only
# -o: create output immediately
# -mpg: create MPG file. This is the default
# -vob: create VOB file
# -vobs: create segmented VOB files
# outputpath: specify output path. Default is equal to video input file

--------------------------------------------------------------------------

Normally we need only a few of these functions. Just a command like
ImagoMPEG-Muxer "C:\Testfiles\video.mpv" -o
should do it if we name video and audio files correctly beforehand.

Assume we have a folder named Testfiles on drive C:, containing 5 video files named video1.mpv ... video5.mpv.
In order to make a batch file multiplexing them all, first we need a listing of these files with full path name.
This can be achieved with the dir command at the command line. If you don't have the 'command prompt here' Power Toy installed, you may also chose execute from the Start menu and give it "command" as parameter, then enter
cd .. several times to get to C:>.

There you may enter the following:

dir>mux.txt Testfiles\*.mpv /s /b

You can alternatively enter the above line into the editor, save it on C: as "anything.bat" and then execute this (double click on the .bat file). Remember to modify the text with your own folder name.

The result in any case should be a text file named mux.txt, with a content similar to the following:

C:\Testfiles\video1.mpv
C:\Testfiles\video2.mpv
C:\Testfiles\video3.mpv
C:\Testfiles\video4.mpv
C:\Testfiles\video5.mpv

Note that if Testfiles has sub folders, any video files in them will also be listed, with full path name. So you may batch process entire folder trees this way.

Now we can edit the text file by adding the appropriate text before and after each line:

ImagoMPEG-Muxer "C:\Testfiles\video1.mpv" -o
ImagoMPEG-Muxer "C:\Testfiles\video2.mpv" -o
ImagoMPEG-Muxer "C:\Testfiles\video3.mpv" -o
ImagoMPEG-Muxer "C:\Testfiles\video4.mpv" -o
ImagoMPEG-Muxer "C:\Testfiles\video5.mpv" -o

Remember the keyboard shortcuts for copying, cutting and pasting: ctrl-C, ctrl-X, ctrl-V, allowing to finish this editing job very quickly.

Save the resulting file in the same folder as the ImagoMPEG-Muxer.exe, under a name with .bat as extension, mymuxjob.bat for example.

Now if you execute mymuxjob.bat, it should automatically call Imago for each video file one after another. Imago should automatically open the appropriate audio files as well and multiplex everything into .mpg files.

The audio files need to have the same main name as the video files and be in the same folder. You may multiplex up to 3 audio files (e.g. different languages languages) automatically by giving them .mpg, .mp2, and .mp3 extensions. All of them will be taken as mp2 if they are mp2. You may also have an AC3 automatically picked up as well.

 

Useful tools:

Imago MPEG-muxer

 

 


 



Copyright (C) 1998-2011; all rights reserved. All materials in these pages are presented for scientific evaluation of video technologies only. They may not be copied from here and used for entertainment or commercial activities of any kind.
We do not have any relation to and do not take any responsibility for any software and links mentioned on this site. This website does not contain any illegal software for download. If we, at all, take up any 3rd party software here, it's with the explicit permission of the author(s) and regarding all possible licensing and copyright issues, as to our best knowledge. All external download links go to the legal providers of the software concerned, as to our best knowledge.
Any trademarks mentioned here are the property of their owners. To our knowledge no trademark or patent infringement exists in these documents; any such infringement would be purely unintentional.
If you have any questions or objections about materials posted here, please
e-mail us immediately.
You may use the information presented herein at your own risk and responsibility only. We do also not guarantee the correctness of any information on this site or others and do not encourage or recommend any use of it.
One further remark: These pages are covering only some aspects of PC video and are not intended to be a complete overview or an introduction for beginners.