Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to use `mencoder` to convert MP4 videos for a Pioneer AVH-280BT head unit

How to use mencoder to convert MP4 videos for a Pioneer AVH-280BT head unit

These directions are geared toward OS X but I'm assuming this will work on Linux systems and possibly Windows machines with mplayer/mencoder installed. These directions assume basic familiarity with the terminal/command line. If you are not comfortable with that or would rather use a GUI, there are other options like this helpful page which shows how to use the DivX video converter to do this same thing.

I also assume these instructions will work on other Pioneer head units I don't happen to own, and possibly on other brands as well.

Install ffmpeg and mplayer using Homebrew

  1. If you don't have Homebrew, the OS X command-line package manager, you will need to install it using instructions found on their website. Homebrew allows you to specify that you want to build an installation from source, which you will need to do with mplayer in order to get mp3lame for mp3 audio encoding.
  2. Run brew install ffmpeg.
  3. When that's done, run brew install --build-from-source mplayer. It should take a few minutes. See Troubleshooting below if this freezes.

Format a USB drive

The manufacturer's documentation specifies that you need a FAT32-formatted USB storage device. If you don't know how to format a USB drive, just Google it. You'll probably want to use Disk Utility if you're on OS X, but every OS will have some way of doing this. There are some other file and filesystem requirements in that documentation as well, which may be of use for troubleshooting.

Use mencoder to convert your files

Cutting to the chase, here's an example of a commandline that works:

mencoder {input_file}.mp4 -o {outfile_file}.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=500:vpass=1 -ffourcc DX50 -oac mp3lame -lameopts br=192 -vf scale=720:-10,harddup

Where {input_file}.mp4 is something like adventure_time_s1e01.mp4 and {output_file}.mp4 is adventure_time_s1e01.avi. I have read that Pioneer head units don't like underscores in file names but I haven't found that to be the case.

Copy to USB

Copy your file(s) to the USB storage and connect it to the head unit. You should be able to see and hear the video little to no trouble at this point. See Troubleshooting for some tips if it doesn't work for you at this point.


I had never used mencoder before this, so I had to do a lot of Googling to figure out what I was doing. I don't know a ton about video and audio codecs either, so there was a good deal of trial-and-error involved here. Here are the mencoder options I'm using as why, as far as I can understand.

  • mencoder {input_file}.mp4 -o {output_file}.avi: Base mencoder command, giving it the input and output filenames
  • -ovc lavc: Tells mencoder to use the libavcodec video codec library
  • -lavopts: sets libavcodec options
  • vcodec=mpeg4: use mpeg4 video codec
  • vbitrate=500: sets the video bitrate to 500 Kbps; higher might work as well, but this has consistently worked for 11-minute cartoon mp4s for me.
  • vpass=1: Specifies one-pass encoding. Two-pass encoding works sometimes but not always. There is no noticeable difference on the small screen in my car anyway, though.
  • -ffourcc DX50: This is critical but I'm not sure what it does other than set ID_VIDEO_FORMAT=DX50
  • -oac mp3lame: Tells mencoder to use the mp3lame codec library for audio
  • -lameopts: Sets mp3lame options
  • br=192: Sets audio bitrate to 192 kbps but I'm not sure it works
  • -vf: Sets video options, I guess
  • scale=720:-10: Sets the horizontal resolution to 720 pixels and auto-scales the vertical resolution -- this is critical
  • harddup: Tells mencoder to include unchanged frames in the copy (e.g. there if there is no difference between frame 10 and frame 11, copy it anyway instead of using some sort of index to indicate an unchanged frame. I'm not sure how important this actually is.

Known issues

An error like this pops up for every frame while encoding:

[mpeg4 @ 0x10d7f5080]AVFrame.format is not set
[mpeg4 @ 0x10d7f5080]AVFrame.width or height is not set

It doesn't appear to cause any playback issues.


Installation problems

If brew install --build-from-source mplayer appears to freeze, as it did on my computer, you may be having troubling downloading the source. I'm not sure why curl can't do that in this circumstance, but I found that you could just run brew install -v --build-from-source mplayer and use your browser to go to the URL it shows it's trying to download from. Once you've got the file, just stick it in ~/Library/Caches/Homebrew/ and run brew install --build-from-source mplayer again.

Reading file information

If you convert a file and it doesn't work, get the file information using mplayer like this:

$ mplayer -vo null -identify -frames 0 adventure_time_s3e01.avi
MPlayer 1.3.0-4.2.1 (C) 2000-2016 MPlayer Team
Can't init Apple Remote.

Playing adventure_time_s3e01.avi.
libavformat version 57.25.100 (internal)
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO:  [DX50]  720x400  24bpp  23.976 fps  482.7 kbps (58.9 kbyte/s)
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.24.102 (internal)
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
Clip info:
 Software: MEncoder 1.3.0-4.2.1
ID_CLIP_INFO_VALUE0=MEncoder 1.3.0-4.2.1
Load subtitles in ./
Requested audio codec family [mpg123] (afm=mpg123) not available.
Enable it at compilation.
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 214.8 kbit/7.61% (ratio: 26856->352800)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
2016-07-18 07:41:20.094 mplayer[86035:13180963] 07:41:20.094 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
AO: [coreaudio] 44100Hz 2ch floatle (4 bytes per sample)
Starting playback...

Exiting... (End of file)

This is an example from a working file. When I was troubleshooting my files I would diff the output this command from a known-working file against mine to see what I was doing differently.


I hope you find this useful. The Pioneer docs are a bit skimpy so I was grateful to find anything online at all; I thought I'd put my notes up to save other people some time. Please comment if you find this helpful.

Simple script to automate conversion


function convert_file {
    echo "Encoding file .... $1"
    # remove file extension
    # reencode file
    mencoder "$1" -o "$name.avi" -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=500:vpass=1 -ffourcc DX50 -oac mp3lame -lameopts br=192 -vf scale=720:-10,harddup

find -name \*.mp4 | while read file
    convert_file "$file"
    echo "Convert done for file=$file"
Copy link

ntazana2 commented Sep 6, 2021

Very helpful, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment