Discussion:
[Libav-user] How to read the pcm file to get back the original audio mp3 file?
Ramana Jajula
2018-09-03 11:26:52 UTC
Permalink
Hi,

I have a .pcm file created by audio decoding(passing mp3 file as input).
Now I want to get back the audio mp3 file(input file of decoding.c) by
passing this .pcm file as input to the encoding.c code. How can I read the
pcm file through libav?

I used this file to create the pcm file decoding.c
<https://codepad.co/snippet/NeHLFtzR>, using the following command.

gcc -g -o decoding decoding.c -lavutil -lavformat -lavcodec -lswresample
-lz -lm

./decoding audio.mp3 output.pcm.

I want to pass ouput.pcm as input to encoding.c file to get the audio.mp3.

Thank you
Ramana Jajula
2018-09-03 11:34:55 UTC
Permalink
Hi,

I have a .pcm file created by audio decoding(passing mp3 file as input).
Now I want to get back the audio mp3 file(input file of decoding.c) by
passing this .pcm file as input to the encoding.c code. How can I read the
pcm file through libav?

I used this file to create the pcm file decoding.c
<https://codepad.co/snippet/NeHLFtzR>, using the following command.

gcc -g -o decoding decoding.c -lavutil -lavformat -lavcodec -lswresample
-lz -lm

./decoding audio.mp3 output.pcm.

I want to pass ouput.pcm as input to encoding.c file to get the audio.mp3.

Thank you
Carl Eugen Hoyos
2018-09-03 11:37:55 UTC
Permalink
Post by Ramana Jajula
I have a .pcm file created by audio decoding(passing mp3 file as input).
Now I want to get back the audio mp3 file(input file of decoding.c) by
passing this .pcm file as input to the encoding.c code.
This may be a misunderstanding, but since mp3 is (always) a lossy
codec, you cannot get the exact mp3 file back.

Carl Eugen
Ramana Jajula
2018-09-03 11:47:51 UTC
Permalink
Then What are the possible ways to get back the audio.mp3 file. (or else)
if it is impossible in case of .mp3, I will pass and decode the .mp2 file
and create a .pcm(.raw or .bin) file, will I get the mp2 file as I said in
above process?

Thank you.
Carl Eugen Hoyos
2018-09-03 11:57:09 UTC
Permalink
Post by Ramana Jajula
Then What are the possible ways to get back the audio.mp3 file. (or else)
if it is impossible in case of .mp3, I will pass and decode the .mp2 file
and create a .pcm(.raw or .bin) file, will I get the mp2 file as I said in
above process?
No, if your intention is to get back the exact same mp2 file.

(You can of course produce a similar sounding - but different -
mp2 or mp3 file for every pcm file.)

Carl Eugen
Ramana Jajula
2018-09-03 12:08:43 UTC
Permalink
Yeah, I just want to know how canI achieve that Carl. Like you said in the
brackets(to produce the file either similar sounding).

Thank you.
Nicolas George
2018-09-03 13:48:07 UTC
Permalink
Post by Ramana Jajula
Yeah, I just want to know how canI achieve that Carl. Like you said in the
brackets(to produce the file either similar sounding).
It seems to me there is something fundamental that you are
misunderstanding about audio codec.

You should try explaining what you are actually trying to achieve in the
end. Your attempts at re-creating an encoded file do not seem like a
final objective but like a misguided solution for it.

Regards,
--
Nicolas George
Ramana Jajula
2018-09-03 14:00:11 UTC
Permalink
Hi Nicolas,

I have generated .pcm(.raw or .bin) file by passing an .mp3 file as input
to this code(decoding) <https://codepad.co/snippet/NeHLFtzR>. I just want
to do the reverse operation of to get the .mp3 file as output(by passing
.pcm file as input) using this 2nd code(encoding)
<https://codepad.co/snippet/1QfOMISa>.

I am absolutely a beginner to this libavcodec programming.

Please give me a solution or suggestions or modifications to my code. I
have been working on this for past 2 months. I don't have any resources or
guide or mentor to help with this. Your help means a lot to me.

Thank you.
Ramana Jajula
2018-09-03 14:17:18 UTC
Permalink
I just want to mention that I have played the .pcm file in Audacity(by
importing) and it works absolutely correct. The 2nd code(enoding) is giving
me error. You can give me suggestions(code if possible).

Thank you.
Post by Nicolas George
Post by Ramana Jajula
Yeah, I just want to know how canI achieve that Carl. Like you said in
the
Post by Ramana Jajula
brackets(to produce the file either similar sounding).
It seems to me there is something fundamental that you are
misunderstanding about audio codec.
You should try explaining what you are actually trying to achieve in the
end. Your attempts at re-creating an encoded file do not seem like a
final objective but like a misguided solution for it.
Regards,
--
Nicolas George
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Loading...