[mythtv-users] Somewhat OT: Transcoding MPEG audio to AC3

Scott Alfter mythtv at salfter.dyndns.org
Sat Dec 18 19:34:46 UTC 2004


Whatever problem I was having with nuvexport now seems to be resolved, so I
can now create a cutlist in mythfrontend, fire up nuvexport, and get an
edited MPEG-2 PS (I have a couple of MPEG encoders installed) out.

The PVRx50 and friends produce MPEG-2 video and MPEG-1 layer II audio.  The
video can be set up to record at a resolution and bitrate compatible with
DVD-Video, but MPEG audio != AC3.  This means that the audio must be
transcoded somehow to AC3.

On the first attempt, I figured I'd demux the source file, transcode the
audio stream, and remux the streams with a sequence like this:

lvedemux foo.mpg
mv foo.mpa foo.mp2
ffmpeg -i foo.mp2 -ab 192 foo.ac3
mplex -f 8 -o bar.mpg foo.m2v foo.ac3
rm foo.m2v foo.ac3

This produced synchronization problems.  Attempting to set an audio delay
with the -O option to mplex didn't improve things any (it didn't help that
lvedemux didn't retrieve audio delay information from the source file like
DVD2AVI does).

(I could've tried lvemux instead of mplex, but the "-f 8" option in mplex
produces streams in the format dvdauthor needs.)

I figured I might try mencoder next, since it would copy from one program
stream to another.  (I'd still need to figure something out to make the
streams compatible with dvdauthor, but just getting a playab;e stream would
be a start.)  I tried it with a direct stream copy of the video and a
transcode of the audio like this:

mencoder -of mpeg -o bar.mpg -ovc copy -oac lavc -lavcopts abitrate=192:acodec=ac3 foo.mpg

The video plays OK, but the audio is mangled beyond playability.  Software
decoding doesn't work, and when I try hardware decoding (-ac hwac3,), the
receiver connected to my computer never kicks into AC3 decoding mode (it did
with the first file).  Changing "acodec=ac3" to a different codec (such as
MP3) works, so it appears it's just AC3 encoding that is broken. :-( Has
anyone figured out a method of transcoding audio while leaving the video
alone and keeping the audio & video synchronized, all under Linux?  I can
do this easily enough under Windows, but doing everything under Linux would
be nice from a standpoint of just popping a blank DVD-R into the burner on
the MythTV box and saving some TV shows to it.

Here are version numbers for the apps I'm using (names of the source
tarballs from which they were built, because this is a Gentoo box):
lve-040322.src.tar.bz2
ffmpeg-0.4.9-pre1.tar.gz
mjpegtools-1.6.2.tar.gz
MPlayer-1.0pre5.tar.bz2

  _/_
 / v \ Scott Alfter
(IIGS( http://alfter.us/            Top-posting!
 \_^_/ rm -rf /bin/laden            >What's the most annoying thing on Usenet?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20041218/e1db81e2/attachment.pgp


More information about the mythtv-users mailing list