LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-15-2021, 12:59 AM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
convert command is great for images but i need to convert audio


when i need to convert the format of an image file i use the convert command. i thought it was odd to give it such a generic name. why not "convert-image"? that way someone can make such a command for other stuff.

i need to do some audio format conversion and need a non-interactive non-GUI command that works like convert does so i can build some automation scripts around it. so far all i have found are projects that want to become audio or A/V editors of the GUI nature.

anyone know of commands or programs like i nee? especially great would be a feature of understanding the format i want based on the file name extension.
Code:
convert mysound.flac mysound.mp3
but i can add that kind of thing by scripting around it. it needs to be non-interactive and non-GUI to work in a script.
 
Old 12-15-2021, 02:05 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,962

Rep: Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331
you can find a lot of solutions on the net (just look for convert flac to mp3).
 
Old 12-15-2021, 03:38 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,333
Blog Entries: 3

Rep: Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730
I would look at ffmpeg or similar.
 
Old 12-15-2021, 06:24 AM   #4
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,377

Rep: Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757Reputation: 2757
The ArchWiki has a section on scripts.
The use of FFmpeg with parallel looks nifty.
 
Old 12-15-2021, 08:12 AM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,910

Rep: Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027
There's also "sox", as long as you don't need to use aac/mp4.
 
1 members found this post helpful.
Old 12-15-2021, 08:19 AM   #6
SW64
Member
 
Registered: May 2014
Distribution: Slackware
Posts: 262

Rep: Reputation: 123Reputation: 123
sox or lame.
 
1 members found this post helpful.
Old 12-15-2021, 09:02 AM   #7
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
Examples:
Code:
ffmpeg -i input.flac -c:a libmp3lame -q:a 0 -map_metadata 0 -id3v2_version 3 -write_id3v1 1 output.mp3

ffmpeg -i input.flac -vn -c:a libmp3lame -b:a 192k output.mp3

ffmpeg -i input.flac -q:a 0 output.mp3
Or 10 other different command strings depending on what you want.

https://trac.ffmpeg.org/wiki/TitleIndex
https://ffmpeg.org/ffmpeg.html
 
2 members found this post helpful.
Old 12-15-2021, 12:22 PM   #8
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by Turbocapitalist View Post
I would look at ffmpeg or similar.
i did. that thing is utterly confusing.
 
Old 12-15-2021, 12:31 PM   #9
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by allend View Post
The ArchWiki has a section on scripts.
The use of FFmpeg with parallel looks nifty.
i hope they understand ffmpeg's options. i sure don't. i have used it, before, but via a script someone else wrote, like youtube-dl. i'll have a look and see if i can make it do WAV to FLAC. if i can do that change, then i can do just about any format it supports the same way. i have achieved video conversion to WEBM that way.

Last edited by Skaperen; 12-15-2021 at 01:09 PM.
 
Old 12-15-2021, 01:11 PM   #10
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by SW64 View Post
sox or lame.
sox looks like it will do. thanks.
 
Old 12-15-2021, 01:15 PM   #11
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
too many replies, all good ones, to answer individually. thanks everyone. looks like sox or a well scripted ffmpeg should do the job.
 
Old 12-15-2021, 07:58 PM   #12
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,003

Rep: Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629Reputation: 3629
For reference. "The convert program is a member of the imagemagick(1) suite of tools"
 
Old 12-16-2021, 04:38 PM   #13
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by jefro View Post
For reference. "The convert program is a member of the imagemagick(1) suite of tools"
right.

i would like to see things change so that command name can be used for any kind of conversion, not just images and sound. but this is a rather involved program:

Code:
lt2a/forums /home/forums 15> ldd $(which convert)
	linux-vdso.so.1 (0x00007ffcf497d000)
	libMagickCore-6.Q16.so.3 => /usr/lib/x86_64-linux-gnu/libMagickCore-6.Q16.so.3 (0x00007f52160eb000)
	libMagickWand-6.Q16.so.3 => /usr/lib/x86_64-linux-gnu/libMagickWand-6.Q16.so.3 (0x00007f5215dd0000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f52159df000)
	liblcms2.so.2 => /usr/lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007f5215787000)
	liblqr-1.so.0 => /usr/lib/x86_64-linux-gnu/liblqr-1.so.0 (0x00007f5215579000)
	libfftw3.so.3 => /usr/lib/x86_64-linux-gnu/libfftw3.so.3 (0x00007f5215177000)
	libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f5214f32000)
	libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f5214c7e000)
	libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f5214a6c000)
	libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f5214734000)
	libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f5214524000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f5214307000)
	libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f52140fd000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5213d5f000)
	libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f5213b30000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5213918000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f52136f9000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f52167b0000)
	libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f52133e2000)
	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f52131b0000)
	libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f5212f7e000)
	libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f5212d56000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5212b52000)
	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f52128e0000)
	libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f52126dc000)
	libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f52124d6000)
	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f52122c1000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f52120b9000)
lt2a/forums /home/forums 16>
 
Old 12-17-2021, 01:55 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,962

Rep: Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331Reputation: 7331
Quote:
Originally Posted by Skaperen View Post
right.

i would like to see things change so that command name can be used for any kind of conversion, not just images and sound. but this is a rather involved program:
And you can create and publish your own convert tool.
 
Old 12-17-2021, 07:56 AM   #15
mjolnir
Member
 
Registered: Apr 2003
Posts: 821

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by Skaperen View Post
too many replies, all good ones, to answer individually. thanks everyone. looks like sox or a well scripted ffmpeg should do the job.
Good deal - if you get a nice script going please post back with it. I've never before tried changing 'flac(s)' audio.
I've used something like this to 'convert' folders of .m4a files to .mp3 and .wav.
Code:
for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -ac 2 -ab 192k "${f%.*}.mp3"; done
Code:
for f in *.m4a; do ffmpeg -i "$f" -ar 8000 -acodec pcm_u8 -ac 1 "${f%.*}.wav"; done
and for single files, Margaritaville example :
Code:
ffmpeg -i Margaritaville.mp3 -acodec pcm_s16le  -ar 44100 Margaritaville1.wav
Code:
ffmpeg -i Margaritaville.mp3 -acodec pcm_u8 -ar 22050 Margaritaville.wav
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Great LinuxQuestions Great oooo snowsegun Linux - Newbie 1 02-23-2012 01:07 AM
Linux is great, Windows is great but can you live without a computer? Mr-Bisquit General 49 03-08-2010 06:26 PM
Great place, great people, and me feel great to be here rajshekarj LinuxQuestions.org Member Intro 2 10-22-2009 03:34 PM
Great audio convert script (GUI) linmix Linux - Software 0 10-18-2005 05:35 PM
Convert cd images to dvd images rcsuk Debian 2 07-11-2005 10:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:29 PM.

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