MP3 Encoding using JMF

Hi all,
I was wondering if I anyone could give me some advice on how to change .wav files into .mp3 files using JMF. I've been trying to make Sun's Transcode program work ( from JMF Solutions ) but it keeps refusing to do that particular action, and complains about bad sampling rates.
Any help would be appreciated,
Vicki

In short, write a C++ class that calls a Linux MP3 encoder. Your java app passes the filename and the C++ class passes that to the encoder that then returns info about the encoding process to the C++ class that then passes it to the java class. You might even find a linux ecoder that works with java...Just hava a look on google or something
Could be tough.
US101

Similar Messages

  • Is it possible to play mp3 without using JMF or JLayer??

    hi,
    i wan to play mp3 without using JMF or JLayer as just like .wav file.
    If it is possible then anyone plz tell me how it can b done..please..
    thnx.
    Edited by: samratsinghal on Sep 11, 2009 10:21 AM

    JavaSound does not have the functionality to play MP3 files.
    That said, if you want to do it without using a library to decode the MP3 file for you, then you need to write your own MP3 decoder.

  • Layered encoding using JMF

    Hi, I'm trying to build and aplication to transmit video and audio using RTP with the posibility of change the quality of data.
    I want to split the data in several streams (layers), and if a user wants to increment the quality, he'll join various of this streams.
    Is there a way to do this using JMF?
    Thanks!

    In short, write a C++ class that calls a Linux MP3 encoder. Your java app passes the filename and the C++ class passes that to the encoder that then returns info about the encoding process to the C++ class that then passes it to the java class. You might even find a linux ecoder that works with java...Just hava a look on google or something
    Could be tough.
    US101

  • OGG/MP3 encoding

    Hi,
    I'm a CS student making my final project.
    As part of my project I need to implement an OGG/MP3 live streamer (preferably OGG).
    Meaning, I need to accept a live feed from an audio input device, encode it on-the-fly to OGG and send the chunk via UDP.
    The project needs to be compiled in java so tools like Edcast etc. cannot be used.
    I have come across VorbisSPI, Jorbis, Jroar, Jlayer and more and have tested them for decoding OGG and was very pleased with the results.
    But I have yet to find a way to implement on-the-fly encoding, and more importantly basic OGG encoding.
    Would appreciate any help whatsoever.
    Best Regards,
    Liran

    captfoss wrote:
    mookmook wrote:
    But I have yet to find a way to implement on-the-fly encoding, and more importantly basic OGG encoding.Ummmm, if you open a file / line as an AudioInputStream / TargetDataLine, you can just call "read" on it and get the byte-level data. The byte-level data is just the series of PCM samples, so if you want to do on-the-fly encoding, then it's just a matter of reading from an AIS/TDL, doing the encoding, and then writing it out to an OGG file (with the associated file header, of course).
    Alternately, JMF has a relatively easy way to expand its list of available codecs, and you could just write an OGG codec and you'd be able to use JMF to do OGG encoding.Thanks for your response.
    However I did not fully understand your suggestion.
    Yes, I can read the PCM data from the line input without trouble.
    But I'm not sure how do you want me to encode? use an external encoder? if I do that how can I access the encoded data afterwards, I have an OGG file but I'll have tons of these that need to be streamed one after the other(each in declared buffer size), is that possible to do without having the sound cut-off in between the transfer of the files? or should I use a streamer (like the Jroar) and feed it with the files and it should handle the multiple files continously?
    The other option sounds better to me but than I have to write the codec.
    Is it something that is easily done? can you point me to the right direction in this matter?
    Where can I start with building the OGG codec?
    Thanks a lot!

  • Restoring MediaSource 3.30.21 MP3 encoding functionality in MediaSource 5, in Vi

    I own the Zen Sleek Touch Photo. I have been for the last year or two been using MediaSource 3.30.2
    I read from Creative that I could retain MP3 encoding functionality in MediaSource 5 as long as I
    kept MediaSource 3.30.2 installed. This is fine all except for the problem that I can't successfully
    install MediaSource 3.30.2 in Vista automatically. However, I am fully capable of manually installing
    whichever piece of MediaSource 3.30.2 that flags MediaSource 5.
    There are only a few directorys and places in the registry that MediaSource 3.30.2 installs to.
    I'd like to know which file or registry string, or combination MediaSource 5 looks for, for the
    encoding functionality.

    gblackwo wrote:
    Well, I gave up trying to get mediasource5 to work, and let me encode mp3s. So I found it easier to hack mediasource 3 to install into vista 64bit. It works.
    To enable MP3 encoding in MediaSource v5 you need to buy the Creative MP3 Audio Pack. http://buy.soundblaster.com/_creativ...FX685ASKJBLYY2 The pack includes the MP3 plug-in (composed of 2 files), so you are wasting your time trying to enable it in the Registry.

  • MP3 encoder VBR Options doesn't work anymore

    Hi everyone !
    I always used iTunes mp3 encoder to rip my CD's with the VBR option ON and it worked fine until now.
    Indeed since 10.3 the VBR option doesn't seem to be working no more : the output is a CBR mp3 file either I tick or not the VBR option box !
    Does anyone have the same problem ? Is there a way to solve this issue ?
    Thank you

    We can't know. You have not provided any system info or other useful technical details.
    Mylenium

  • Playing a wav file (byte array) using JMF

    Hi,
    I want to play a wav file in form of a byte array using JMF. I have 2 classes, MyDataSource and MyPullBufferStream. MyDataSource class is inherited from PullStreamDataSource, and MyPullBufferStream is derived from PullBufferStream. When I run the following piece of code, I got an error saying "EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c9108b2, pid=3800, tid=1111". Any idea what might be the problem? Thanks.
    File file = new File(filename);
    byte[] data = FileUtils.readFileToByteArray(file);
    MyDataSource ds = new MyDataSource(data);
    ds.connect();
    try
        player = Manager.createPlayer(ds);
    catch (NoPlayerException e)
        e.printStackTrace();
    if (player != null)
         this.filename = filename;
         JMFrame jmframe = new JMFrame(player, filename);
        desktop.add(jmframe);
    import java.io.IOException;
    import javax.media.Time;
    import javax.media.protocol.PullBufferDataSource;
    import javax.media.protocol.PullBufferStream;
    public class MyDataSource extends PullBufferDataSource
        protected Object[] controls = new Object[0];
        protected boolean started = false;
        protected String contentType = "raw";
        protected boolean connected = false;
        protected Time duration = DURATION_UNKNOWN;
        protected PullBufferStream[] streams = null;
        protected PullBufferStream stream = null;
        protected final byte[] data;
        public MyDataSource(final byte[] data)
            this.data = data;
        public String getContentType()
            if (!connected)
                System.err.println("Error: DataSource not connected");
                return null;
            return contentType;
        public void connect() throws IOException
            if (connected)
                return;
            stream = new MyPullBufferStream(data);
            streams = new MyPullBufferStream[1];
            streams[0] = this.stream;
            connected = true;
        public void disconnect()
            try
                if (started)
                    stop();
            catch (IOException e)
            connected = false;
        public void start() throws IOException
            // we need to throw error if connect() has not been called
            if (!connected)
                throw new java.lang.Error(
                        "DataSource must be connected before it can be started");
            if (started)
                return;
            started = true;
        public void stop() throws IOException
            if (!connected || !started)
                return;
            started = false;
        public Object[] getControls()
            return controls;
        public Object getControl(String controlType)
            try
                Class cls = Class.forName(controlType);
                Object cs[] = getControls();
                for (int i = 0; i < cs.length; i++)
                    if (cls.isInstance(cs))
    return cs[i];
    return null;
    catch (Exception e)
    // no such controlType or such control
    return null;
    public Time getDuration()
    return duration;
    public PullBufferStream[] getStreams()
    if (streams == null)
    streams = new MyPullBufferStream[1];
    stream = streams[0] = new MyPullBufferStream(data);
    return streams;
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import javax.media.Buffer;
    import javax.media.Control;
    import javax.media.Format;
    import javax.media.format.AudioFormat;
    import javax.media.protocol.ContentDescriptor;
    import javax.media.protocol.PullBufferStream;
    public class MyPullBufferStream implements PullBufferStream
    private static final int BLOCK_SIZE = 500;
    protected final ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW);
    protected AudioFormat audioFormat = new AudioFormat(AudioFormat.GSM_MS, 8000.0, 8, 1,
    Format.NOT_SPECIFIED, AudioFormat.SIGNED, 8, Format.NOT_SPECIFIED,
    Format.byteArray);
    private int seqNo = 0;
    private final byte[] data;
    private final ByteArrayInputStream bais;
    protected Control[] controls = new Control[0];
    public MyPullBufferStream(final byte[] data)
    this.data = data;
    bais = new ByteArrayInputStream(data);
    public Format getFormat()
    return audioFormat;
    public void read(Buffer buffer) throws IOException
    synchronized (this)
    Object outdata = buffer.getData();
    if (outdata == null || !(outdata.getClass() == Format.byteArray)
    || ((byte[]) outdata).length < BLOCK_SIZE)
    outdata = new byte[BLOCK_SIZE];
    buffer.setData(outdata);
    byte[] data = (byte[])buffer.getData();
    int bytes = bais.read(data);
    buffer.setData(data);
    buffer.setFormat(audioFormat);
    buffer.setTimeStamp(System.currentTimeMillis());
    buffer.setSequenceNumber(seqNo);
    buffer.setLength(BLOCK_SIZE);
    buffer.setFlags(0);
    buffer.setHeader(null);
    seqNo++;
    public boolean willReadBlock()
    return bais.available() > 0;
    public boolean endOfStream()
    return willReadBlock();
    public ContentDescriptor getContentDescriptor()
    return cd;
    public long getContentLength()
    return (long)data.length;
    public Object getControl(String controlType)
    try
    Class cls = Class.forName(controlType);
    Object cs[] = getControls();
    for (int i = 0; i < cs.length; i++)
    if (cls.isInstance(cs[i]))
    return cs[i];
    return null;
    catch (Exception e)
    // no such controlType or such control
    return null;
    public Object[] getControls()
    return controls;

    Here's some additional information. After making the following changes to MyPullBufferStream class, I can play a wav file with gsm-ms encoding with one issue: the wav file is played many times faster.
    protected AudioFormat audioFormat = new AudioFormat(AudioFormat.GSM, 8000.0, 8, 1,
                Format.NOT_SPECIFIED, AudioFormat.SIGNED, 8, Format.NOT_SPECIFIED,
                Format.byteArray);
    // put the entire byte array into the buffer in one shot instead of
    // giving a portion of it multiple times
    public void read(Buffer buffer) throws IOException
            synchronized (this)
                Object outdata = buffer.getData();
                if (outdata == null || !(outdata.getClass() == Format.byteArray)
                        || ((byte[]) outdata).length < BLOCK_SIZE)
                    outdata = new byte[BLOCK_SIZE];
                    buffer.setData(outdata);
                buffer.setLength(this.data.length);
                buffer.setOffset(0);
                buffer.setFormat(audioFormat);
                buffer.setData(this.data);
                seqNo++;
        }

  • Artifacts in mp3 encoding

    I have been using itunes to encode audio recordings to mp3 for years but recently I have started to get artifacts appearing in the recordings. It looks like it is some kind of cross talk from one channel to the other (eg left to right) If there is speech on the left channel there is some faint twittering on the right. In the aiff version there is nothing, the twittering only appears after encoding to mp3. I usually encode to 128Kbps stereo. Any ideas on what is happening?

    Is this truly something that has suddenly started happening or have you just started listening to tracks with true stereo isolation? Very few stereo recordings truly have all of one signal coming through one channel an nothing through the other.
    In the mp3 encoder settings try toggling between joint stereo and normal. Part of mp3 space saving assumes that much of what is coming out one channel is similar to the what is coming out the other. It is redundant to preserve this separately so channels share some audio signal which can be stored jointly. I have zero familiarity with the encoding but am throwing out the suggestion that maybe in the case where you really have complete channel separation perhaps this joint method is allowing something to leak through to the other since it works on the principal that both channels do have similar information. "Normal" stores the two channels separately but also takes up more room because of redundant information storage.

  • New Drivers loose MP3 encoding.... You want me to pay for it

    Hey,
    Recently formatted my computer and reinstalled with the latest drivers for my sound card using the auto update service.
    (Audigy 2 zs)
    Was supprised to find the latest MediaSource 5 has lost the ability to encode MP3 Format. Was a bit bewildered to find that i'm supposed to pay extra?to have the privilage of having my MP3 encoding ability back.
    Whats the story. This card was clearly sold as having this ability and now its been taken away and im told its got to be payed for to get it back. Just a?bit confused, sorry if this has already been posted.

    To get the MP3 encode feature back. You need to install "Creative MediaSource Player/Organizer 3.30.2" software first which will add the MP3 encode feature. Then install the latest MediaSource 5 Player/Organizer software.
    Next uninstall the "Creative MediaSource Player/Organizer 3.30.2" and the MP3 encode feature will remain in the latest MediaSource 5 Player/Organizer software.
    The "Creative MediaSource Player/Organizer 3.30.2" software can be downloaded from the creative download webpage.
    If you can't find the download, Follow these steps :
    ) Go to the creative support webpage.
    2) Select "Sound Blaster".
    3) Scroll down to the bottom of the webpage and select "If your product is not listed above, please click here".
    4) Select your product "Audigy", "Audigy ZS" click next.
    5) In the "manual selection" (on the bottom of the webpage), Select "Windows XP" click "Submit".
    6) The "Creative MediaSource Player/Organizer 3.30.2" software will be listed under "Application" on page 2.
    Goodluck!

  • Problem with  M-JPEG by using JMF and JPEGCodec .

    Hi, there,
    I want to implement a M-JPEG using JMF and JPEGCodec, is that possible?(I already been trapped)
    My problem is I have a video clip which is a AVI file, the video format is following:
    Video format: RGB, 160x120, FrameRate=14.9, Length=57600, 24-bit, Masks=3:2:1, P
    ixelStride=3, LineStride=480, Flipped.
    I already convered a frame to an Image object(video format with JPEG and CVID doesn't work) ,
    I can also convert this Image back as a Buffer, It works fine with me .But to use JPEGCodec( provided by com.sun.image.codec.jpeg ) I need to convert an Image to a BufferedImage, I use the following defination:
    BufferedImage   bImage = new BufferedImage(frameImage.getWidth(null), frameImage.getHeigh(null),BufferedImage.TYPE_INT_RGB); It seems work, But when I use JPEGImageEncoder to encoder this bImage and save as a jpg file,
    everything is black .
    I also need to cast BufferedImage to an Image: frameImage = (Image) bImage; then I convert frameImage back to Buffer.My video clip still running , but every frame now became black .
    can someone help me? thanks in advance.

    I solved this problem . But I met a new problem.
    I converted the above video clip into a JPEG and I want to create a DataSink for it. the messege is:
    Video format: JPEG, 160x120, FrameRate=12.0, Length=3574
    - set content descriptor to: AVI
    - set track format to: JPEG
    Cannot transcode any track to: JPEG
    Cannot create the DataSink: javax.media.NoDataSinkException: Cannot find a DataS
    ink for: com.sun.media.multiplexer.RawBufferMux$RawBufferDataSource@2b7eea
    Transcoding failedHope some Java Experts can help me.
    Regards.

  • ITuned mp3 Encoder Problem

    Whenever I encode songs, I do so in mp3 format (very universal). I encode at 256 kpbs. However, one time I accidently did a 192 kbps encoding, but it sounded like a 112 kbps endcoding. Then I did a 112 kbps, and I was right. Then I brough up Nero so I could view the frequency range. it was worse than the 112 kbps... what is up with that. it cut off at about 12 khz on 192.... it cut off at about 12.5 or 13 khz with 112. Then I did a 256 encoding of the same song, and it cut off at about 15khz, which was about 128 kbps normally. Then I looked at previously encoded songs using this same iTunes that I just did (6.0.2.23), and at 256 they were fine, were normal. I did that one about 2 days ago. Then I viewed songs i imported yesterday. It had those bad effect tat it does now, cutting off at 16 khz and sounding like a 128 - 160 kbps. This has NEVER happened to me before on any otehr iTunes. I was wondering if this was a glitch or is fixed in the new 6.0.3 one that was released about 3 days ago. Thanks. I appreciate any feedback.
    ROB C

    I solved the problem.
    ITunes preferences are stored in a hidden directory here:
    C:\Documents and Settings\Username\Programdata\Apple Computer\ITunes\iTunes.pref
    (Programdata might be called something else in the English version of XP, I have the Norwegian version...)
    Close ITunes.
    Open this file in a text editor that can handle binary files, for example Textpad (www.textpad.com).
    Remove the two lines starting with keys
    iTunes.exe:MP3 Encoder:Custom
    iTunes.exe:MP3 Encoder
    Start ITunes. Set your desired import bitrate.
    It should now be saved - and be picked up again next time you open your preferences.
    Actually it was saved all the time, but something corrupts this file disabling ITunes from picking up the correct mp3 encoder settings. I guess the 160kb/s setting is the default showing up when no settings are present.
    Hope this works for others having this problem as well!
    Regards,
    Vidar

  • Logic/iTunes MP3 Encoder & Soundcheck Phenomenon

    I'm noticing something weird happening when listening to either the CDs I import or the tracks I bounce from Logic on my iPod when soundcheck is enabled.
    When I directly choose a song to listen to, the volume is decreased a whole lot, but if I choose the immediately previous song and click "next" or "skip track" into the song, it'll be blasting very loud. If I click "previous track" from the next song into it, it'll still play very soft. Now, I'm wondering why this is happening only with my iTunes imports and my bounces from Logic and not other tracks. They play loud and fine everywhere else (CDs, web players, etc). Is it a setting in Apple's Mp3 encoder? Can anyone help me understand what's going on with what seems to be sorcery? Thanks.

    the only thing I can think of is the clicking "next" or "skip track" skips the ID3 tag for some reason, perhaps clicking skip or next purposely does not read from the beginning of the file so as to avoid a click or pop.
    The Sonar w/LAME encoder does not include ID3 info so there's no normalization.
    Another example of possibly doing a bit too much for the user. You don't want to use Sound Check anyway, why would you want everything at or close to the same volume?   
    Sound Check - Sound Check is a feature of iTunes, that can be used on the iPod, that normalizes the volume of the songs in your iTunes library. Because songs are recorded at different volumes and with different technologies over time, the volume that they play back at can be different. Sound Check scans your iTunes library and attempts to bring the volume of all songs in it into rough equivalence. It does this by scanning the playback volume of songs in the library and adjusting the "normalization information" ID3 tag for the song.
    Sound Check does not actually change the volume of the orignal song.
    Sound Check can be used with iPod playback as well. As long as it is enabled in iTunes, the Sound Check-enhanced songs will transfer to the iPod and play at a roughly equal volume.
    Sound Check can be applied to MP3, AAC, WAV, and AIFF files.

  • Cannot change settings from AAC to MP3 encoder although able to do so on another computer

    I am frustrated as I am able to change my settings on ITunes 10 on my desktop computer, but when I downloaded ITunes10 on my notebook, I was not able to change the same settings from AAC to MP3 encoder although I clicked ok. It keeps reverting to AAC, and I am not able to rightclick my music file, as I can do on my desktop, to create a smaller mp3....
    I also noticed that other checkmarks, i.e. checking "podcast" under general preferences under source revert back to unchecked when I get out.
    What to do?
    Thanks so much,
    Anita

    andreafromspringfield gardens wrote:
    And what does "in the Enterprise" mean?
    In a school / business / corporate environment. Used for a large deployement of iPads.
    http://www.apple.com/support/ipad/enterprise/

  • I have itunes songs that I wish were mp3 (for use on a SD Card)

    Can they be changed in Itunes, or so I have to start over?
    Also, I assume that there is a column available in Itunes to sort protected vs. unprotected.
    Many thanks

    One way of sorting could be creating a smart playlist with this rule
    <Playlist> <is not> <Purchased>
    Of course that would exclude the iTunes plus songs also
    There are probably other ways but thats what I can think of right now
    As for changing the songs to mp3 go to iTunes Preferences>Advanced>Importing and set Import using *mp3 encoder* then select all the songs in the new playlist and right click then *convert selection to mp3*.

  • Streaming Audio using JMF

    I am trying to create a application that uses streaming audio and would be an internet radio with a server that will stream songs and a client that can listen to the stream. How can I stream audio, specifically mp3 files, using the JMF?

    I am in a similar project.
    I found JMF does not provide enough support for stream.
    I can't split a stream into some packets and transfer them to another peer.

Maybe you are looking for