LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   converting videos to mp3 ? (http://www.linuxquestions.org/questions/linux-general-1/converting-videos-to-mp3-891239/)

dEnDrOn 07-12-2011 03:36 AM

converting videos to mp3 ?
 
i know that this a kiddish thing but i still find it a bit annoying that i can't really figure out the procedure.
I've mostly mp4/flv media files,i need to convert them to mp3 to put in my mp3 player but at the same time i like to adjust the mp3 bitrate to save space and maintain quality sometimes.
How do i actually do that in Linux.
Is there any GUI program that performs the job for me quickly ?

cascade9 07-12-2011 03:52 AM

I'm prettys sure that soundkonverter (Qt) or soundconverter (GTK) will do it. Not a great way though, IIRC both programs will convert the video stream to audio, then run that through a ripper. Since the audio on those files types is already compressed into a lossy format, any extra conversions will reduce the sound quality.

A better way is to check the .flv or .mp4 file and see what audio codec is inside. If its MP3, just strip the video, leaving you with an unconverted original .mp3 file. The only way I know to strip the video is with the command line though.

If its .aac (or similar)...honestly, in most cases it would be easy to find the file in .mp3 format, and its going to sound better than a lossy->lossy conversion.

H_TeXMeX_H 07-12-2011 04:19 AM

Here's what I would do:

Code:

ffmpeg -i 'The IT Crowd - Series 3 - Episode 4 The Internet.mp4' -acodec libmp3lame -ab 160k -ar 44100 -ac 2 out.mp3

dEnDrOn 07-12-2011 04:24 AM

Quote:

Originally Posted by cascade9 (Post 4412373)
A better way is to check the .flv or .mp4 file and see what audio codec is inside. If its MP3, just strip the video, leaving you with an unconverted original .mp3 file.


my mp4 videos have MPEG-4 AAC audio

dEnDrOn 07-12-2011 04:25 AM

Quote:

Originally Posted by H_TeXMeX_H (Post 4412394)
Here's what I would do:

Code:

ffmpeg -i 'The IT Crowd - Series 3 - Episode 4 The Internet.mp4' -acodec libmp3lame -ab 160k -ar 44100 -ac 2 out.mp3

i guess 160k is bitrate here ?

H_TeXMeX_H 07-12-2011 04:27 AM

Yes, that is the bitrate. It is a good bitrate in that bitrates over this do not provide a huge improvement in quality, but do increase the size of the file.

dEnDrOn 07-12-2011 04:39 AM

Quote:

Originally Posted by cascade9 (Post 4412373)
I'm prettys sure that soundkonverter (Qt) or soundconverter (GTK) will do it.

it seems that soundconverter has no option to configure output bitrate.

dEnDrOn 07-12-2011 04:53 AM

i was trying to understand the command provided and also read man page for the same.
this i what i got:
1) -ab is to set bitrate
2) -ac is to set output channels
3) -ar is to set frequency

please rectify me if i miss something !

But i' not getting what this is for :
1) -acodec
2) libmp3lame

cascade9 07-12-2011 05:04 AM

Quote:

Originally Posted by H_TeXMeX_H (Post 4412406)
Yes, that is the bitrate. It is a good bitrate in that bitrates over this do not provide a huge improvement in quality, but do increase the size of the file.

I disagree with the 160K idea, IMO 160K MP3s are a little bit better than the sound of a goat pissing in a tin....

But thats besides the point. Most .flv videos are using 128k or less MP3 encoding. Transcoding a MP3 from a smaller bitrate to a bigger bitrate will not help sound quality at all. Transcoding them at all will hurt sound quality.

Theres a few ways to strip the video (or dump the audio) from .flv and .mp4/m4v here-

http://www.linuxquestions.org/questi...-video-508026/

Its a much, much better idea than transcoding lossy files.

Quote:

Originally Posted by dEnDrOn (Post 4412415)
it seems that soundconverter has no option to configure output bitrate.

I thought it does? Maybe I was wrong, its been a while since I've used soundconverter, I'm more likely to use soundkonverter.

Quote:

Originally Posted by dEnDrOn (Post 4412401)
my mp4 videos have MPEG-4 AAC audio

You can keep the .aac audio stripped from a video file if you want.

I prefer not to have .aac files on my HDD at all, and I cant think of any file I wanted in MP3 that I couldnt find in MP3 if I tried.

dEnDrOn 07-12-2011 05:09 AM

i think i'd use FFmpeg,but for now i'm searching for answers to two of my questions...
one is this and other is:
How to convert multiple files using FFmpeg ?

H_TeXMeX_H 07-12-2011 05:46 AM

Quote:

Originally Posted by dEnDrOn (Post 4412422)
i was trying to understand the command provided and also read man page for the same.
this i what i got:
1) -ab is to set bitrate
2) -ac is to set output channels
3) -ar is to set frequency

please rectify me if i miss something !

But i' not getting what this is for :
1) -acodec
2) libmp3lame

-acodec means use the following audio codec. libmp3lame is the audio codec = mp3 via lame encoder.

Quote:

Originally Posted by dEnDrOn (Post 4412439)
i think i'd use FFmpeg,but for now i'm searching for answers to two of my questions...
one is this and other is:
How to convert multiple files using FFmpeg ?

You can do this to convert multiple files:

Code:

for i in *.mp4; do ffmpeg -i "$i" -acodec libmp3lame -ab 160k -ar 44100 -ac 2 "$(basename "$i" .mp4).mp3"; done
basename is a command that cuts off extensions, and I use it to cut off .mp4 and replace it with .mp3.

dEnDrOn 07-12-2011 05:53 AM

thanks cascade9 & H_TeXMeX_H......:hattip::hattip:
i'm using FFmpeg now for conversions !!

H_TeXMeX_H 07-12-2011 06:03 AM

Quote:

Originally Posted by cascade9 (Post 4412437)
I disagree with the 160K idea, IMO 160K MP3s are a little bit better than the sound of a goat pissing in a tin....

But thats besides the point. Most .flv videos are using 128k or less MP3 encoding. Transcoding a MP3 from a smaller bitrate to a bigger bitrate will not help soudn quality at all. Transcoding them at all will hurt soudn quality.

We're talking about mp4 files here that come standard with 128k AAC audio. This transcodes well to 160k mp3.

cascade9 07-12-2011 06:16 AM

Quote:

Originally Posted by H_TeXMeX_H (Post 4412477)
We're talking about mp4 files here that come standard with 128k AAC audio. This transcodes well to 160k mp3.

Wow, I didnt even notice my typos till quoted. At least I was consistant with my use of 'soudn'. LOL

Sure, it will transcode...but you can transcode lossy-> lossless if you really want.

Just because it will transcode, doesnt mean it should be transocded. The output .mp3 will be worse sounding than the same sized MP3 ripped from a lossless or CD source, and also worse sounding than the original .acc file as well.

dEnDrOn 07-12-2011 06:26 AM

can someone please tell how to normalize mp3 volume automatically ?


All times are GMT -5. The time now is 01:11 PM.