[mythtv] Newbie questions about mpeg2->mpeg2 transcode.

Geoffrey Hausheer mythtv0368 at phracturedblue.com
Sat May 22 12:31:52 EDT 2004

On Sat, 22 May 2004 11:25:21 -0400, "Britt Houser" said:
> Ok, thanks for the clarification.  I thought that hitting X in the
> frontend was like typing 'mythtranscode' from the command line, but I
> see they are two different things.
Umm, I think I may have just added to your confusion here.

> My ultimate goal here is to take stuff I've recorded, edit out the
> commercials, and 'export' them out of myth and store them on a
> seperate file server.  Then I NFS mount this directory on the
> fileserver under /myth/videos and I can watch them that way.

> So after I mark these commercials, I hit X, and the transocoding will
> start, and the resulting file will be mpeg2?
Umm, no.  Sadly, there is no straight forward way to do this today.

You have a few options:
a) convert to divx/xvid.  I think nuvexport or mythencode will do this
for you
b) convert to mpeg4/nuv.  Mythtranscode would do this, but I'm not sure
if the videos will pleay in mythvideo
c) convert to mpeg2.  The only way I know to do this today is to use
mythtranscode exported to mencoder

what you really want (as you said initially and I failed to understand)
is the mpeg2->mpeg2 transcoder.  But it isn't really 100% finished.  I
can't help you with the nuvexport/mythencode programs as I've never used
them.  I believe both of these solutions requires reencoding the stream

if you use mythtranscode via the 'X' method, you will get mpeg4/nuv
streams.  I am not sure if mythvideo can play them or not, and they are
certainly not generally protable (though there is a directshow filter
that should handle them)

the examples in the documentation section 21.1 may work for you to
generate mpeg2 streams, however, I've never tried it and you'd need to
find correct settings for -ovc and -oac for it to work.  You will also
lose quality because it will reencode the entire file.

And to make this comment relevant to the mythdev list:

To actually do what you want likely requires fixing mythtranscode (or
rewriting the mpeg2trans from scratch).  There are several problems that
need to be addressed:
a)  The processing code was written against an outdated MPEG2 spec, and
thus doesn't correctly handle things like missing GOP frames.
b)  The remuxing code has problems setting the PTS/DTS correctly.  This
was initially due to missing features in ffmpeg, and I believe this has
improved, so it might be easy to fix now.
c)  When the code was written, libavformat had no way to insert padding
frames to control the stream bitrate.  This causes lots of havoc for many
d)  The cutting code works on GOP boundaries.  Fixing this while
maintaining a fully compliant stream is very hard.  There are a few
possibilities, none of them ideal:
  i) reencode the frames to the next I frame after the cut.  Rewrite the
  GOP to have a smaller number of frames.  This will probably cause
  incompatibility with players which don't expect the GOP size to change.
   It is MPEG2 compliant, but I'm not sure if it is DVD compliant.
  ii) cut to nearest I-frame, and use microjumps to hide this.  The
  problem here is that the microjumps would be equivalent to the current
  cut-list, and thus would be myth-specific, and would need to be stored
  in the db.  It is possible that a DVD could perform these skips as well
  by doing some magic with the indexes within the VOB, but I'm not 100%
  sure of this.
  iii) ???

More information about the mythtv-dev mailing list