[MEncoder-users] [BUGREPORT][minor] Incorrect setting of MP3 bitrate identification tag

The Wanderer inverseparadox at comcast.net
Thu Nov 24 04:03:05 CET 2005


I've been doing a fair bit of fiddling around with various encodings of
a particular file recently (one of the set of MP4 files for which there
are standing bugs), and I've noticed something unusual. I've reproduced
it here with a completely unrelated input file, just because. There is a 
fairly sizable snip in the middle, but all it contains is more "Skipping 
frame!" and status lines.

==
wanderer at pegasus:/tmp$ mencoder -oac mp3lame -lameopts preset=medium 
-ovc copy /home/pub/video/Music\ Videos/Indifferent\ Productions\ -\ 
Stop\ The\ Rock\?.avi -o /tmp/test-bitrate-mislabeling.avi
MEncoder dev-CVS-051118-14:29-3.3.5 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Sempron/Athlon MP/XP Thoroughbred; Duron 
Applebred (Family: 6, Stepping: 0)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE

success: format: 0  data: 0x0 - 0x392e000
AVI file format detected.
VIDEO:  [DIVX]  480x352  24bpp  29.970 fps  1993.2 kbps (243.3 kbyte/s)
[V] filefmt:3  fourcc:0x58564944  size:480x352  fps:29.97  ftime:=0.0334
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 160.0 kbit/11.34% (ratio: 20000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
videocodec: framecopy (480x352 24bpp fourcc=58564944)
Building audio filter chain for 44100Hz/2ch/s16le -> 0Hz/0ch/??...

preset=medium

MP3 audio selected
Building audio filter chain for 44100Hz/2ch/s16le -> 44100Hz/2ch/s16le...
Writing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not 
writing vprp header.
ODML: Aspect information not (yet?) available or unspecified, not 
writing vprp header.
Pos:   0.8s     23f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.068 [0:159]
Skipping frame!
Pos:   4.9s    147f ( 2%) 38.13fps Trem:   3min  56mb  A-V:0.069 [1776:151]
<<<SNIP>>>
Broken frame at 0x439400

Skipping frame!
Pos: 221.3s   6639f (100%) 38.76fps Trem:   0min  55mb  A-V:0.056 [1994:123]
Writing AVI index...
Fixing AVI header...
ODML: Aspect information not (yet?) available or unspecified, not 
writing vprp header.

Video stream: 1994.337 kbit/s  (249292 B/s)  size: 55165337 bytes 
221.288 secs  6639 frames

Audio stream:  123.522 kbit/s  (15440 B/s)  size: 3415458 bytes  221.205 
secs
==

Note that the audio bitrate is reported as 123.522 kbps. However, when I
run '-identify' on the output file:

==
wanderer at pegasus:/tmp$ mplayer -identify -frames 0 
/tmp/test-bitrate-mislabeling.avi
MPlayer dev-CVS-051118-14:29-3.3.5 (C) 2000-2005 MPlayer Team
CPU: Advanced Micro Devices Sempron/Athlon MP/XP Thoroughbred; Duron 
Applebred (Family: 6, Stepping: 0)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE


Playing /tmp/test-bitrate-mislabeling.avi.
AVI file format detected.
ID_VIDEO_ID=0
ID_AUDIO_ID=1
VIDEO:  [DIVX]  480x352  24bpp  29.970 fps  1994.3 kbps (243.4 kbyte/s)
Clip info:
  Software: MEncoder dev-CVS-051118-14:29-3.3.5
ID_CLIP_INFO_NAME0=Software
ID_CLIP_INFO_VALUE0=MEncoder dev-CVS-051118-14:29-3.3.5
ID_CLIP_INFO_N=1
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 32.0 kbit/2.27% (ratio: 4000->176400)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
ID_FILENAME=/tmp/test-bitrate-mislabeling.avi
ID_DEMUXER=avi
ID_VIDEO_FORMAT=DIVX
ID_VIDEO_BITRATE=1994336
ID_VIDEO_WIDTH=480
ID_VIDEO_HEIGHT=352
ID_VIDEO_FPS=29.970
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_CODEC=mp3
ID_AUDIO_FORMAT=85
ID_AUDIO_BITRATE=32000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
ID_LENGTH=221.29
==========================================================================
Trying to force video codec driver family ffmpeg...
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
ID_VIDEO_CODEC=ffodivx
Building audio filter chain for 44100Hz/2ch/s16le -> 0Hz/0ch/??...
alsa-init: 1 soundcard found, using: default
alsa: 44100 Hz/2 channels/4 bpf/60208 bytes buffer/Signed 16 bit Little 
Endian
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Building audio filter chain for 44100Hz/2ch/s16le -> 44100Hz/2ch/s16le...
Starting playback...

alsa-uninit: pcm closed

Exiting... (End of file)
==

Note the ID_AUDIO_BITRATE of 32000. The interesting thing is that I get
this same value on that line no matter what -lameopts I use, and no
matter what input file I use (among the few I've tried), even though the
MEncoder run reports the output audio as being of a considerably higher
actual bitrate. The output file can still be played without hiccups,and
(to within my limited ability to judge) has sound quality commensurate
with what you'd expect from the higher bitrate, but the incorrect
-identify information is still wrong.

The value is calculated (in various places) as (1000/8) * muxer->size /
muxer->timer; the latter is calculated in muxer_write_chunk from
muxer->h.dwLength * muxer->h.dwScale / muxer->h.dwRate (none of which
variables are things I understand well enough to make it worth tracking
them down farther), and as far as I've been able to figure out (although
it obviously isn't true) the former is never modified from its initial
value of 0.

Also: I can, and would like to, put this into the Bugzilla as well as
sending it here - but I have no clue what component I should file it
under; the code trail jumps from one source file to another all over the
place, and even if I could figure out which parts were significant, none
of them seem to have a corresponding entry in the components list. Any
ideas?

-- 
       The Wanderer

Warning: Simply because I argue an issue does not mean I agree with any
side of it.

Secrecy is the beginning of tyranny.




More information about the MEncoder-users mailing list