LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-11-2016, 06:49 PM   #46
H.Brice
LQ Newbie
 
Registered: Sep 2016
Distribution: Zorin 9
Posts: 15

Rep: Reputation: Disabled

I just want to add that lame and ffmpeg both do a good job at converting audio files to mp3.

Here is info from a MP3 song using file command

Code:
file "Nu Shooz - I Can't Wait.mp3"
Nu Shooz - I Can't Wait.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 320 kbps, 44.1 kHz, JntStereo
Using ffmpeg
Code:
ffmpeg -i "Nu Shooz - I Can't Wait.mp3"

Input #0, mp3, from 'Nu Shooz - I Can't Wait.mp3':
  Metadata:
    encoder         : LAME 64bits version 3.99.5 (http://lame.sf.net)
    artist          : Nu Shooz
    title           : I Can't Wait
    album           : Pool Side
    TLEN            : 222366
  Duration: 00:03:42.41, start: 0.025056, bitrate: 321 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
This is a partial output. Item in Bold identifies it as a mp3 file

Lastly, mplayer identifies it as mp3 audio file.

Code:
Playing Nu Shooz - I Can't Wait.mp3
libavformat version 56.40.101 (external)
Audio only file format detected.
Clip info:
 Title: I Can't Wait
 Artist: Nu Shooz
 Album: Pool Side
 Year: 
 Comment: 
 Genre: Unknown
Load subtitles in ./
==========================================================================
Trying to force audio codec driver family libmad...
Opening audio decoder: [libmad] libmad mpeg audio decoder
AUDIO: 44100 Hz, 2 ch, s16le, 320.0 kbit/22.68% (ratio: 40004->176400)
Selected audio codec: [mad] afm: libmad (libMAD MPEG layer 1-2-3)
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
  =====  PAUSE  =====
A: 148.7 (02:28.7) of 222.0 (03:42.0)  0.9%
Mplayer is using the libMAD library. A library for mp3 playback and other mpeg audio formats.

These mp3 files play well on my smartphone when using ffmpeg or lame.

Anyway, good luck

Last edited by H.Brice; 09-11-2016 at 06:59 PM.
 
Old 09-11-2016, 07:04 PM   #47
Siljrath
Bedrock Linux Advocate
 
Registered: Nov 2004
Location: the internet
Distribution: server:Gentoo | workstation:Bedrock (hijacked:void, fetched:Gentoo,Devuan,Artix)
Posts: 218

Rep: Reputation: 65
converting from lossy tho...
... better not forget those fresh wavs are made of dirt.
 
Old 09-11-2016, 07:10 PM   #48
H.Brice
LQ Newbie
 
Registered: Sep 2016
Distribution: Zorin 9
Posts: 15

Rep: Reputation: Disabled
Fixit7

One last though, you said some mp3 files worked and others didn't. Do you remember what you did for those mp3's to work on your player? Can you replicate it again?

Lastly, is it possible that the firmware on the player dated to work on a specific set of values that the mp3 must meet?

Anyway, I hope you find a solution for the mp3 mystery.
 
Old 09-11-2016, 07:38 PM   #49
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
For those labeled as mp3s but were actually wav files, I renamed to wav and used Audacity to export to mp3.

VLC is so good, it plays any music file as opposed to stand along radio/CD players that can't play everything. :-)
 
Old 09-11-2016, 08:07 PM   #50
seasons
Member
 
Registered: Dec 2014
Distribution: siduction
Posts: 263

Rep: Reputation: 58
Quote:
I am making progress in correcting those files, but it will take quite a while.
Yeah, it can be tedious, but an ounce of prevention is worth a pound of cure. If I have to deal with mp3 format, I always run it through mp3val before allowing it into my collection. A lot of times, it ends up complaining about the tag ("garbage at end of file") and I'll just strip the tag (with mp3val -f) and use Clementine to write a new tag (when dealing with an album) or even Thunar file manager if it's a single file. mp3val is strict about where the tag is in the file.

Quote:
Originally Posted by Fixit7 View Post
I have some files that have the incorrect extension and some that Audacity did not export correctly as mp3s
Audacity certainly has its uses for editing audio, but for simple conversion from one format to another, I would stick to ffmpeg. And if you're trying to break up large mp3's into individual files, you should also avoid Audacity because it unnecessarily re-encodes and use mp3splt.

Quote:
and 4KYouTubetoMp3 goofs as well.
Ughh. It's probably doing (or at least attempting to do) AAC->mp3 conversion. There may be better tools for dealing with youtube, but due to the "legality" of it, I'm not going into detail...
 
Old 09-11-2016, 08:40 PM   #51
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Thanks for the tips.
 
Old 09-11-2016, 09:35 PM   #52
H.Brice
LQ Newbie
 
Registered: Sep 2016
Distribution: Zorin 9
Posts: 15

Rep: Reputation: Disabled
Hi Fixit7

You can use youtube-dl to extract the audio from the video and convert it to mp3. Sort of kill two birds with one stone.

Code:
youtube-dl -f22/18 -x --audio-format mp3 --audio-quality 192k "Enter youtube video URL here" -o "%(title)s.mp4"
Youtube-dl will download the video first. Then it will run ffmpeg in the backend. Once it extracts the audio and converts it to mp3, it will then delete the video file.

Note: You can also put a list of youtube video links in a file and do a batch conversion with a while loop

Code:
while read line
do
youtube-dl -f22/18 -x --audio-format mp3 --audio-quality 192k "$line" -o "%(title)s.mp4"
if [ $? != 0 ]; then
echo "$line" >> error.log
fi
done < list
list is used as example here. You can use any filename that has your youtube video links.

In case the youtube video is gone due to copyright. It will write the URL of the video into an error.log file.


Well, that's it. You must be sick of me already

Last edited by H.Brice; 09-11-2016 at 09:53 PM.
 
Old 09-11-2016, 09:55 PM   #53
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
That's another way of doing it.

But YouTube2mp3 is easier.

You just copy link in browser and paste link in YouTube2mp3.

It extracts mp3s from mp4s and you end up with just mp3s.
 
Old 09-11-2016, 10:00 PM   #54
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
The problem here is there is no mp3 in mp4, it is AAC. Bare extracting will give you AAC file, it needs to be converted to mp3.
 
Old 09-11-2016, 10:03 PM   #55
H.Brice
LQ Newbie
 
Registered: Sep 2016
Distribution: Zorin 9
Posts: 15

Rep: Reputation: Disabled
Yeah, I done that too in the past but not with YouTube2mp3. I think I used another server. There are quite a few out there.

If YouTube2mp3 works for you, that's great
 
Old 09-11-2016, 10:11 PM   #56
H.Brice
LQ Newbie
 
Registered: Sep 2016
Distribution: Zorin 9
Posts: 15

Rep: Reputation: Disabled
Quote:
Originally Posted by Emerson View Post
The problem here is there is no mp3 in mp4, it is AAC. Bare extracting will give you AAC file, it needs to be converted to mp3.
BUT...

Youtube-dl downloads the video first which is a mp4 video and the codecs are h264 and AAC.

Youtube-dl then calls ffmpeg to extract the audio from the video and then converts it to a native mp3 audio file.

I do this all the time when I want a mp3 version of the video. And the file is indeed a mp3 file after the conversion. Trust me...

Last edited by H.Brice; 09-11-2016 at 10:15 PM.
 
Old 09-12-2016, 08:27 AM   #57
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
H. Brice,

Thanks, I could not find youtube-dl, but found another add on that works.

Last edited by Fixit7; 09-12-2016 at 08:49 AM.
 
Old 09-12-2016, 10:11 AM   #58
seasons
Member
 
Registered: Dec 2014
Distribution: siduction
Posts: 263

Rep: Reputation: 58
youtube-dl is a powerful command-line program (i.e. it's not a firefox addon). You can get it in the repo, or download a local copy:
Code:
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
 
Old 09-12-2016, 01:25 PM   #59
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Thanks.

I got 170 mp3 songs onto one CD.
 
Old 09-12-2016, 01:30 PM   #60
Fixit7
Senior Member
 
Registered: Mar 2014
Location: El Lago, Texas
Distribution: Ubuntu_Mate 16.04
Posts: 1,374

Original Poster
Rep: Reputation: 169Reputation: 169
Youtubinmp3 is an addon and it is easier and does the same thing.

Command line is good too.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Conversion from WAV through CDR to MP3 w1k0 Linux - Software 1 05-21-2011 06:11 PM
need a bash script to batch convert .wav to .mp3 nass Slackware 15 06-23-2007 01:00 AM
shn to mp3/wav conversion linmix Linux - Software 3 06-15-2005 06:33 AM
mp3 to wav conversion jonfa Linux - General 11 06-27-2004 08:26 PM
mpg123 and mp3 to wav conversion knmwt15000 Linux - Newbie 7 03-24-2003 04:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration