[FFmpeg-trac] #4954(avformat:new): joint stereo indicator missing from mp3 headers

FFmpeg trac at avcodec.org
Wed Oct 21 23:02:17 CEST 2015

#4954: joint stereo indicator missing from mp3 headers
             Reporter:  pico4743     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avformat     |                  Version:  git-
             Keywords:  mp3          |  master
  joint_stereo header                |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 Summary of the bug:
 mp3 header files created by ffmpeg do not specify a channel mode of
 joint_stereo when joint_stereo is performed by libmp3lame.

 libmp3lame provides a switch (-joint_stereo) to select either joint_stereo
 or plain stereo. The interface to lame works correctly so that the audio
 frames are fine, but ffmpeg doesn't use the lame library to write the mp3

 Instead libavformat/mp3enc.c sets the channel mode to either MONO or
 STEREO based on how many channels there are.

     switch (codec->channels) {
     case 1:  channels = MPA_MONO;
     case 2:  channels = MPA_STEREO;
     default: av_log(s, AV_LOG_WARNING, "Unsupported number of channels, "
                     "not writing Xing header.\n");
              return -1;


     header |= channels << 6;


 MPA_JSTEREO should be used when appropriate.  The repair doesn't seem
 simple, but I'd be willing to help if someone wants to discuss approaches.

 How to reproduce:
 use a version with libmp3lame enabled
 % ffmpeg -i input.mp3 -joint_stereo 1 output.mp3
 The relevant bits of the output.mp3 header will be 0 == MPA_STEREO
 ffmpeg version -- git master fb4d350

Ticket URL: <https://trac.ffmpeg.org/ticket/4954>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list