[MEncoder-users] Don't get big-endian output with s16be

Grant Edwards grante at visi.com
Sun Jan 7 07:29:19 CET 2007


I'm trying to encode video files for playback on a Sandisk
Sansa e200 series MP3/Video player using mencoder 1.0rc1-3.4.6.

Here's the command I'm using:

mencoder -ovc lavc -lavcopts vcodec=mjpeg:vbitrate=150:vhq \
         -vf rotate=1,scale=160:208 -ofps 15 -ffourcc mjpb \
         -oac pcm -srate 11025 -format s16be \
         -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frame$
         $1 -o $2

The video plays on the Sandisk, but the colors are broken
because the Sandisk expects YUV422P and the above produces
YUV420P (I think), but I'm ignoring that for the moment.

However, the audio doesn't play at all.  The problem is that
the file produced above always contains little-endian sound
data even though I've requested "-format s16be". The resulting
file is always show by mplayer as s16le (the ID string is
"sowt" instead of "twos"). So, the Sandisk refuses to play the
sound.  If I use a hex-editor on the .mov file and change
"sowt" to "twos", then the Sandisk plays audio, but it's just
white noise (because the data is still in little-endian format
instead of big endian as idicated by the fudged "twos" string).

Here's what mplayer -identify says about the file produced by
the mencoder command show above:

     Playing test.mov.
     ISO: File Type Major Brand: Original QuickTime
     Quicktime/MOV file format detected.
     ID_VIDEO_ID=0
     ID_AUDIO_ID=1
     VIDEO:  [mjpb]  160x208  24bpp  15.000 fps    0.0 kbps ( 0.0
     kbyte/s)
     ID_FILENAME=test.mov
     ID_DEMUXER=mov
     ID_VIDEO_FORMAT=mjpb
     ID_VIDEO_BITRATE=0
     ID_VIDEO_WIDTH=160
     ID_VIDEO_HEIGHT=208
     ID_VIDEO_FPS=15.000
     ID_VIDEO_ASPECT=0.0000
>>>  ID_AUDIO_FORMAT=sowt
     ID_AUDIO_BITRATE=0
     ID_AUDIO_RATE=11025
     ID_AUDIO_NCH=2
     ID_LENGTH=5.60
     ==========================================================================
     Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
     Selected video codec: [ffmjpegb] vfm: ffmpeg (FFmpeg MJPEG-B
     decoder)
     ==========================================================================
     ID_VIDEO_CODEC=ffmjpegb
     ==========================================================================
     Opening audio decoder: [pcm] Uncompressed PCM audio decoder
>>>  AUDIO: 11025 Hz, 2 ch, s16le, 352.8 kbit/100.00% (ratio:
     44100->44100)
     ID_AUDIO_BITRATE=352800
     ID_AUDIO_RATE=11025
     ID_AUDIO_NCH=2
     Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
     ==========================================================================
     AO: [oss] 11025Hz 2ch s16le (2 bytes per sample)
     ID_AUDIO_CODEC=pcm
     Starting playback...

I get the exact same results with "-format s16le" and "-format s16be".

How do I get s16be output?

-- 
Grant Edwards
grante at visi.com





More information about the MEncoder-users mailing list