[MEncoder-users] is this a good workflow?

Andrew Berg bahamutzero8825 at gmail.com
Tue May 11 07:21:28 CEST 2010

On 5/10/2010 9:39 AM, Rick C. wrote:
> Hi again,
> I'm looking for any input regarding this workflow:
> 1.  extract the audio from original file:  mencoder original_file.mpg -of rawaudio -oac mp3lame -ovc copy -o audio.mp3
> 2.  will convert audio.mp3 to audio.m4a outside of mencoder to avoid using libfaac
> 3.  joining everything back together:  mencoder original_file.mpg -audiofile audio.m4a -oac copy -fafmttag 0x706D -ovc lavc -lavcopts vglobal=1:vcodec=mpeg4 -of lavf -lavfopts format=ipod -o new_file.m4v
> This seems to work but is maybe a horrible way to do this and that's why I was looking for some input.  Any advice is much appreciated thanks,
> rc
I prefer to use Nero's AAC encoder and something like the following will
work for any command-line audio encoder:

mencoder input.mpg -of avi -oac copy -ovc lavc -lavcopts
vglobal=1:vcodec=mpeg4 -vf harddup -o temp.avi
ffmpeg -i temp.avi -f wav - | neroaacenc -ignorelength -q 0.3 -if - -of
mp4box -aviraw video temp.avi
mp4box -add temp_video.h264:fps=29.97 -add temp.m4a -new output.mp4

You may have to tweak the last command a bit to get it to handle MPEG-4
video properly (I never use MPEG-4; I prefer AVC). The advantage to this
approach over Grozdan's is that you don't need named pipes (which AFAIK
are either difficult or impossible to make on Windows or other
non-UNIX-based systems) and there is no need for mplayer (which always
messes up my terminal on a server I use that doesn't have X, even when
it doesn't try to play video). It also seems cleaner, but that's really
more of an opinion. BTW, -oac copy works just fine as long as you're
processing the video and you use the harddup filter (unless of course
mencoder can't mux the stream; e.g. LPCM must be converted to another

More information about the MEncoder-users mailing list