[FFmpeg-trac] #1258(FFmpeg:new): Codec support request : MPEG Multichannel Audio

FFmpeg trac at avcodec.org
Sat Apr 28 13:40:38 CEST 2012


#1258: Codec support request : MPEG Multichannel Audio
-------------------------------------+-------------------------------------
             Reporter:  aquarat      |                    Owner:
                 Type:  enhancement  |                   Status:  new
             Priority:  normal       |                Component:  FFmpeg
              Version:  unspecified  |               Resolution:
             Keywords:  mpeg         |               Blocked By:
  mctoolame multichannel             |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by aquarat):

 I've included mctoolamed-01a.tgz, which is also available on Sourceforge.
 I've also included my modified version of the code "lamedecoder"... my C++
 skills are really bad, so I've highlighted the changes I've made below. I
 also tried modifying the code to change the output file names depending on
 the input file name... but yeah, C skills are lacking.

 To compile mctoolamed on Debian you need to change the architecture in the
 Makefile. I changed it to "core2" to get it to run on my Core-based
 machine (Intel Xeon).

 I had to modify part of the code to get it to handle 4 channel files :
 in audio_write.c : I modified the soundfile array

    Original :
 {{{
 char soundfile[MTYPES][MAXCHANNELS][256] = {
   {"left.wav", "right.wav", "centre.wav", "left_surround.wav",
 "right_surround.wav"},
   {"left.wav", "right.wav", "centre.wav", "lfe_this_may_not_play.wav",
 "left_surround.wav", "right_surround.wav"}
 };
 }}}

    Revised :
 {{{
 char soundfile[MTYPES][MAXCHANNELS][256] = {
   {"left.wav", "right.wav", "centre.wav", "left_surround.wav",
 "right_surround.wav"},
   {"left.wav", "right.wav", "centre.wav", "lfe_this_may_not_play.wav",
 "left_surround.wav", "right_surround.wav"},
   {"left.wav", "right.wav", "rearleft.wav", "rearright.wav"}
 };
 }}}

 The "waveheader" array has the sample rate flag set for 44.1kHz. If left
 unchanged the resulting files will play back slower than they should.

 Modification to handle 4 channels :

    Original :

 {{{
 void init_audio_outputs(int numchan) {
   int i,j;
   int type=-1;

   numchannels = numchan; // Set the global var for later on.
   if (numchan == 5)
     type = 0;
   if (numchan == 6)
     type = 1;
   if (soundfile>=0) {
     fprintf(stderr,"initialising %i output files\n",numchannels);
     for (i=0;i<numchannels;i++) {
       if ( (audioout[i] = fopen(soundfile[type][i], "w")) == NULL ) {
         fprintf(stderr,"Error opening %s for
 output\n",soundfile[type][i]);
         exit(99);
       }
       /* Write a really dodgy wave header */
       /* Fix this to write the proper sampling frequency */
       for (j=0;j<WAVEHEADERSIZE;j++)
         fputc(wave_header[j], audioout[i]);
     }
   }
 }
 }}}

    Revised :

 {{{
 void init_audio_outputs(int numchan) {
   int i,j;
   int type=-1;

   numchannels = numchan; // Set the global var for later on.
   if (numchan == 5)
     type = 0;
   if (numchan == 6)
     type = 1;
   if (numchan == 4)
     type = 2;
   if (soundfile>=0) {
     fprintf(stderr,"initialising %i output files\n",numchannels);
     for (i=0;i<numchannels;i++) {
       if ( (audioout[i] = fopen(soundfile[type][i], "w")) == NULL ) {
         fprintf(stderr,"Error opening %s for
 output\n",soundfile[type][i]);
         exit(99);
       }
       /* Write a really dodgy wave header */
       /* Fix this to write the proper sampling frequency */
       for (j=0;j<WAVEHEADERSIZE;j++)
         fputc(wave_header[j], audioout[i]);
     }
   }
 }
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1258#comment:1>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list