[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#284114: ITP: mpegdemux -- a MPEG1/2 system stream demultiplexer



On Fri, 3 Dec 2004, Erik Schanze wrote:

> There is already a package, that do this.
> Please see "mpgtx".
> 
> What provide your package, that mpgtx is not able to?

This is from the man page:

       mpegdemux(1) has four primary modes of operation:

       scan   In  this  mode  the MPEG system stream is scanned for elementary
              streams.

       list   In this mode the contents of an MPEG system stream are listed in
              a  textual  form. This is useful to get an overview of what's in
              an MPEG file

       demux  In this mode elementary streams are extracted from an MPEG  sys-
              tem  stream.  The system stream packet structure is dissolved in
              the process. Typically each extracted stream is written  to  its
              own file.

       remux  This is like demux, except that the MPEG system stream structure
              is left intact. This means that the output is again an MPEG sys-
              tem stream with all but the selected elementary streams removed.


The reason I'm packaging mpegdemux is that the "list" mode allows me
to split audio and video from a combined MPEG-2 stream, and then
recombine them later without loss of audio/video sync.

Since you are curious, this is the script I'm using, it works for a
MPEG-2 stream having audio in AC3 format (as produced by my PVR).

#!/bin/sh
if [ "$1" = "" ]; then
  echo Usage: `basename $0` file.mpg
  exit 1
fi
file=$1
video=`mpegdemux -l -k -s 0xe0 -p all $file | \
  awk '/pts/ { print $6 }' | sed -e 's/pts=//'| sed -e 's/\[.*//'| \
  sort -n | head -n 1`
audio=`mpegdemux -l -k -s 0xbd -p 0x80 --ac3 $file | \
  awk '/pts/ { print $6 }' | sed -e 's/pts=//'| sed -e 's/\[.*//'| \
  sort -n | head -n 1`
echo Video: $video
echo Audio: $audio
echo "Diff: $(($video-$audio)) ($((($video-$audio)/90))ms)"


If I were to be using the --sync-offset option of mplex, from mjpegtools,
this simple script would give me the exact value to be used as argument.



Reply to: