CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@radha gogia • 10 Nov, 2014
I actually want to extract one audio file from a video file and then convert that audio file into text in further stage after which that text would be saved in a document .If anyone has worked on it or can provide some links ,please do so because i m searching but not getting any useful content.
@radha gogia • 10 Nov, 2014 I have imported the respective jar files but one audio clip is generated but it is of 0 bytes and i am getting this error.

[main] ERROR org.ffmpeg - [mp3 @ 04D5F8A0] Invalid audio stream. Exactly one MP3 audio stream is required.
[main] ERROR com.xuggle.xuggler - Error: could not write header for container (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:827)
@Anoop Kumar • 10 Nov, 2014 • 1 like Try this
https://www.sauronsoftware.it/projects/jave/manual.php#3.1

I just tried this and, it works perfectly fine.
Make sure you give correct path of source file.

import it.sauronsoftware.jave.InputFormatException;

public class AviToMp3 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        File source = new File("source.avi");
        File target = new File("target.mp3");
        AudioAttributes audio = new AudioAttributes();
        audio.setCodec("libmp3lame");
        audio.setBitRate(new Integer(128000));
        audio.setChannels(new Integer(2));
        audio.setSamplingRate(new Integer(44100));
        EncodingAttributes attrs = new EncodingAttributes();
        attrs.setFormat("mp3");
        attrs.setAudioAttributes(audio);
        Encoder encoder = new Encoder();
        try {
            encoder.encode(source, target, attrs);
        } catch (IllegalArgumentException | EncoderException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}
@radha gogia • 10 Nov, 2014
Anoop Kumar
Try this
https://www.sauronsoftware.it/projects/jave/manual.php#3.1

I just tried this and, it works perfectly fine.
Make sure you give correct path of source file.

import it.sauronsoftware.jave.InputFormatException;

public class AviToMp3 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        File source = new File("source.avi");
        File target = new File("target.mp3");
        AudioAttributes audio = new AudioAttributes();
        audio.setCodec("libmp3lame");
        audio.setBitRate(new Integer(128000));
        audio.setChannels(new Integer(2));
        audio.setSamplingRate(new Integer(44100));
        EncodingAttributes attrs = new EncodingAttributes();
        attrs.setFormat("mp3");
        attrs.setAudioAttributes(audio);
        Encoder encoder = new Encoder();
        try {
            encoder.encode(source, target, attrs);
        } catch (IllegalArgumentException | EncoderException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}
thanku sir ,I got the mp3 file through the code,but now the major task left is of getting the text from the mp3 file,I tried to read the file and then displayed some unknown characters on the screen by reading byte by byte,but don't know how to proceed further.Please help me out,its really urgent rght nw to complete my project.
@radha gogia • 10 Nov, 2014
radha gogia
thanku sir ,I got the mp3 file through the code,but now the major task left is of getting the text from the mp3 file,I tried to read the file and then displayed some unknown characters on the screen by reading byte by byte,but don't know how to proceed further.Please help me out,its really urgent rght nw to complete my project.
I just followed one link ,but cnt understabd it,plz visit it once.
https://stackoverflow.com/questions/7282014/convert-audio-mp3-file-to-string-and-vice-versa#
@Anoop Kumar • 10 Nov, 2014
radha gogia
getting the text from the mp3 file,
What kind of text you want to extract? Media Information?
It is there
public it.sauronsoftware.jave.MultimediaInfo getInfo(java.io.File source)
                                             throws it.sauronsoftware.jave.InputFormatException,
                                                    it.sauronsoftware.jave.EncoderException
@radha gogia • 11 Nov, 2014
Anoop Kumar
What kind of text you want to extract? Media Information?
It is there
public it.sauronsoftware.jave.MultimediaInfo getInfo(java.io.File source)
                                             throws it.sauronsoftware.jave.InputFormatException,
                                                    it.sauronsoftware.jave.EncoderException
I want to extract the lyrics from the audio file and then make a text document of those lyrics.
@Anoop Kumar • 11 Nov, 2014 If it is part of metadata then you can extact it. Otherwise are you trying to get voice recognition
See this: https://stackoverflow.com/questions/8867374/extract-lyrics-from-an-mp3
@radha gogia • 11 Nov, 2014
Anoop Kumar
If it is part of metadata then you can extact it. Otherwise are you trying to get voice recognition
See this: https://stackoverflow.com/questions/8867374/extract-lyrics-from-an-mp3
Yes ,it is a case of voice recognition only and I am trying to get the words,actually they will be extracted from a lecture audio,so firstly i have to remove noise signals and extract only the tracker voice ,also the format in which sphinx which actually works as a voice recongintion tool in java works is through microphone and i have to extract it through mp3 file so thats the major issue.
@radha gogia • 11 Nov, 2014
radha gogia
Yes ,it is a case of voice recognition only and I am trying to get the words,actually they will be extracted from a lecture audio,so firstly i have to remove noise signals and extract only the tracker voice ,also the format in which sphinx which actually works as a voice recongintion tool in java works is through microphone and i have to extract it through mp3 file so thats the major issue.
so now ,please tell what to do now??
@Anoop Kumar • 11 Nov, 2014 Honestly, I don't know about it.
I will give a shot today and let you know if I found something.
@radha gogia • 11 Nov, 2014
Anoop Kumar
Honestly, I don't know about it.
I will give a shot today and let you know if I found something.
I am trying to convert first the mp3 file now to .wav file ,and then I will try to get some text if possible.I had discussed this ques on my linkledin network and i got some solutions,so please look at it if you understand something,
https://www.linkedin.com/groups/How...=eml-group_discussion_new_comment-respond-btn
@radha gogia • 11 Nov, 2014
radha gogia
I am trying to convert first the mp3 file now to .wav file ,and then I will try to get some text if possible.I had discussed this ques on my linkledin network and i got some solutions,so please look at it if you understand something,
https://www.linkedin.com/groups/How...=eml-group_discussion_new_comment-respond-btn
And also I am getting problem converting .mp3 file into .wav file,I visited this link but I am not able to understand the comment,
https://stackoverflow.com/questions/14085199/mp3-to-wav-conversion-in-java
@Anoop Kumar • 11 Nov, 2014 • 1 like You are looking for Speech recognition system.
Are you looking for offline audio to text then I guess, it's very difficult to get desired result. You can only convert a speech (audio stream going into microphone).
You can see Java Speech API. If you are looking for streaming audio in mic to text. But still it's not very good, When even online and much sophisticated Google Now and Apple SIRI are struggling with this. If you are looking for speech to text then go for google translate or any online conversion method. See if Java Speech API works.
I see the Linkdin discussion, they are talking about converting mp3 int binary stream not in the text.
@radha gogia • 11 Nov, 2014
Anoop Kumar
You are looking for Speech recognition system.
Are you looking for offline audio to text then I guess, it's very difficult to get desired result. You can only convert a speech (audio stream going into microphone).
You can see Java Speech API. If you are looking for streaming audio in mic to text. But still it's not very good, When even online and much sophisticated Google Now and Apple SIRI are struggling with this. If you are looking for speech to text then go for google translate or any online conversion method. See if Java Speech API works.
I see the Linkdin discussion, they are talking about converting mp3 int binary stream not in the text.
Actually ,if you saw the linkdin discussion,there one person Denis talked about that we can do convert it into text if the file is wav format,he even provided with a code,I have made my mp3 file into wav file,and even sphinx in java used for speech recognition also works through micropohne and usually the voice signal of a human is taken in wav format so now can i do something becoz my audio file is a mere english video lecture and i want to just make a text document of it,so now see if wav file is of any use,see even if text document is not made,now can you think of any other utility if in any way text is not possible because in there are merely words only spoken in a lecture,so I guess something can be done.
@Anoop Kumar • 11 Nov, 2014 Sorry, No luck here.
@micheal john • 12 Nov, 2014
radha gogia
mere english
language?
@radha gogia • 12 Nov, 2014 • 1 like
Anoop Kumar
Sorry, No luck here.
Its completely fine sir,I have found ispeech and got a link for extracting text from a wave file ,already i have made a wave file and I am trying to do something,This is the link I am providing you,I am also trying ,if you get time see if you can find something.
Lets hoe for the best,and thankss anyways for your support and guideline.
@radha gogia • 12 Nov, 2014 Please sir,I when worked initially got the output mp3 file with jave-1.0 jar but now I dont know why is it raising exception,Please help me out.This the following code


import it.sauronsoftware.jave.AudioAttributes;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.EncoderException;
import it.sauronsoftware.jave.EncodingAttributes;
import it.sauronsoftware.jave.InputFormatException;
import java.io.File;

public class AviToMp3 {
public static void main(String[] args) {
File source = new File("D:\\sadda.mp4");
File target = new File("D:\\target2.mp3");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Integer(128000));
audio.setChannels(new Integer(2));
audio.setSamplingRate(new Integer(44100));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mp3");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
try {
encoder.encode(source, target, attrs);
}
catch (EncoderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}
}

This is the exception which I am getting,


it.sauronsoftware.jave.InputFormatException
at it.sauronsoftware.jave.Encoder.parseMultimediaInfo(Encoder.java:657)
at it.sauronsoftware.jave.Encoder.encode(Encoder.java:840)
at it.sauronsoftware.jave.Encoder.encode(Encoder.java:711)
at javaapplication10.AviToMp3.main(AviToMp3.java:23)
@Anoop Kumar • 12 Nov, 2014 Are you sure you ware sending Mp4 before?
Method suggest it is expecting Avi.
@radha gogia • 12 Nov, 2014
Anoop Kumar
Are you sure you ware sending Mp4 before?
Method suggest it is expecting Avi.
Sir,I got it ,It is working well with .mp4 file also,Thankss a lot for your guideline
@Anoop Kumar • 13 Nov, 2014 I can see it in evening only.
Did you able to run sample application, class is iSpeechASR?
@radha gogia • 13 Nov, 2014
Anoop Kumar
I can see it in evening only.
Did you able to run sample application, class is iSpeechASR?
Sir,i actually included the sample java file in my new java application only,but it was giving error,plz try to see it once.
@Anoop Kumar • 13 Nov, 2014 You need api key to use iSpeech from here.
https://www.ispeech.org/developers
See the code in sample
public class iSpeechAPI
{
    public static String api = "developerdemokeydeveloperdemokey"; [I][COLOR=#0000b3]//Get your API key at https://www.ispeech.org/developers[/COLOR][/I]
    public static boolean production = false; //Your API key server access, false is development and true is production
    
@radha gogia • 13 Nov, 2014
Anoop Kumar
You need api key to use iSpeech from here.
https://www.ispeech.org/developers
See the code in sample
public class iSpeechAPI
{
    public static String api = "developerdemokeydeveloperdemokey"; [I][COLOR=#0000b3]//Get your API key at https://www.ispeech.org/developers[/COLOR][/I]
    public static boolean production = false; //Your API key server access, false is development and true is production
    
sir,I have inlcuded my API key,plz see to it once ,actually i had included wrong jar file ,plz see to it once sir now when I run my program ,I am getting null pointer exception.plz visit once
Under 'Download Java SDK' they link to this file https://www.ispeech.org/downloads/ispeech-java-sdk-demo-docs-20120926.zip
With iSpeechSDK_9.26.12.jar inside. and visit once
for getting API key ,I am not getting the way to remove the null pointer exception.
@Suhas Bachhav • 18 Feb, 2015
radha gogia
sir,I have inlcuded my API key,plz see to it once ,actually i had included wrong jar file ,plz see to it once sir now when I run my program ,I am getting null pointer exception.plz visit once
Under 'Download Java SDK' they link to this file https://www.ispeech.org/downloads/ispeech-java-sdk-demo-docs-20120926.zip
With iSpeechSDK_9.26.12.jar inside. and visit once
for getting API key ,I am not getting the way to remove the null pointer exception.
H! Radha
I want source code and Libraries in Java for Converting Audio to text .... Please mail me ksb.suhas@gmail.com
@ddeepu78 • 01 Jul, 2015 I want source code and Libraries in Java for Converting Audio to text .... Please mail me ddeepu78@gmail.com
@ddeepu78 • 01 Jul, 2015 I want source code and Libraries in Java for Converting Audio to text .... Please mail me ddeepu78@gmail.com
@ddeepu78 • 01 Jul, 2015
Anoop Kumar
You need api key to use iSpeech from here.
https://www.ispeech.org/developers
See the code in sample
public class iSpeechAPI
{
    public static String api = "developerdemokeydeveloperdemokey"; [I][COLOR=#0000b3]//Get your API key at https://www.ispeech.org/developers[/COLOR][/I]
    public static boolean production = false; //Your API key server access, false is development and true is production
    
I want source code and Libraries in Java for Converting Audio to text .... Please mail me ddeepu78@gmail.com
@Anoop Kumar • 01 Jul, 2015 @ddeepu78
I don't have any library or readymade program.But I am pretty sure above solutions give worked.
If you want to look some more things. try this also.
https://stackoverflow.com/questions/31041079/how-to-extract-audio-from-video
If you are facing problem. post here. CEans will be happy to help you.
11.6k views

Related Posts

@Kaustubh Katdare · Mar 15, 2014

Stumbled upon this totally addictive game. Trust me, it does not look addictive but I bet a few moves into the game and you would have that 'never give up'...
7.7k views

@irocker · Dec 30, 2012

Hello All, I completed B.Tech(ECE) in 2010 and have been working as a Software Engineer (working on Microsoft technologies) since then in an IT company. I now want to move...
5k views

@ramachandra · Jan 11, 2010

Can you suggest me a good name for the magazine of an engineering college? The college is celebrating silver jubilee and releasing a magazine on this occasion. sanskrit names are...
11.1k views

@Pankaj Chauhan · Jul 8, 2015

i am a student of civil engg. i want to know the best book for preparing IES exam
5.3k views

@nilesh apte · May 29, 2012

Hello everyone, My name is NILESH APTE, pursuing my M.tech degree in structural engineering from VJTI mumbai, I m in my 2nd year now and I have to start with...
10.4k views