LinuxQuestions.org
Review your favorite Linux distribution.
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 03-10-2009, 01:02 AM   #1
lindylex
Member
 
Registered: Mar 2007
Posts: 192

Rep: Reputation: 17
Audio Processing Tool Command Line To Extract Play Length?


Does any know of a command line tool to extract the play length of many different audio file formats? I have tried sox, using the following command.

sox a2.wav -n stat

But it does not support the following formats.

.acc, wma

I thought mplayer might be able to do it but I am unsure and can't find how this might be done.

Thanks
 
Old 03-10-2009, 02:11 AM   #2
anurag_bhd
Member
 
Registered: Nov 2006
Location: Jalandhar, India
Distribution: openSuSE 11.0, Granular 1.0, Mandriva One 2009, Fedora 11
Posts: 60

Rep: Reputation: 18
mplayer does play the multimedia files well through command-line, but I doubt it could be used to just extract & display the media information of a file (metadata).
 
Old 03-10-2009, 02:13 AM   #3
anurag_bhd
Member
 
Registered: Nov 2006
Location: Jalandhar, India
Distribution: openSuSE 11.0, Granular 1.0, Mandriva One 2009, Fedora 11
Posts: 60

Rep: Reputation: 18
Have you check for whether sox's media support could be extended using some plugins or something?
 
Old 03-10-2009, 10:37 AM   #4
almatic
Member
 
Registered: Mar 2007
Distribution: Debian
Posts: 547

Rep: Reputation: 67
this will show you the length in seconds of any media file

Code:
mplayer -vo null -ao null -frames 0 -identify yourmediafile 2>/dev/null | grep ID_LENGTH | awk -F= '{print $2}'
 
Old 03-10-2009, 10:41 AM   #5
lindylex
Member
 
Registered: Mar 2007
Posts: 192

Original Poster
Rep: Reputation: 17
anurag_bhd, the closes I can get to this is to install this package "libsox-fmt-all". After reading http://sox.sourceforge.net/soxformat.html it seems like the files format are not supported. If there is another way to "extended using some plugins" I am not sure.
 
Old 03-10-2009, 10:45 AM   #6
lindylex
Member
 
Registered: Mar 2007
Posts: 192

Original Poster
Rep: Reputation: 17
almatic, wow thanks that was amazing and what I thought was possible.

Thanks, much
 
Old 03-10-2009, 10:26 PM   #7
lindylex
Member
 
Registered: Mar 2007
Posts: 192

Original Poster
Rep: Reputation: 17
almatic, I receive this as the output for my .aac file. The "ID_LENGTH" is not true it is longer than zero seconds. Any other tools or ideas how I might retrieve the play duration?

Code:
MPlayer dev-SVN-r26940
CPU: Intel(R) Xeon(TM) CPU 3.06GHz (Family: 15, Model: 2, Stepping: 7)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.

Playing Back To Basics  Modern - 01 Intro (Back To Basics).aac.
ID_VIDEO_ID=0
libavformat file format detected.
AAC file format detected.
ID_AUDIO_ID=0
ID_FILENAME=Back To Basics  Modern - 01 Intro (Back To Basics).aac
ID_DEMUXER=aac
ID_AUDIO_FORMAT=MP4A
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=0
ID_AUDIO_NCH=0
ID_LENGTH=0.00
ID_SEEKABLE=1
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
ID_AUDIO_BITRATE=128000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio) decoder)
==========================================================================
AO: [null] 44100Hz 2ch s16le (2 bytes per sample)
ID_AUDIO_CODEC=faad
Video: no video
Starting playback...


Exiting... (End of file)
[Edit]
I can use faad but I was looking for magical bullet from mplayer. Thanks for all the help.

faad -i Back\ To\ Basics\ \ Modern\ -\ 01\ Intro\ \(Back\ To\ Basics\).aac 2>&1 | grep ADTS | awk '{print int($2)}'

Last edited by lindylex; 03-11-2009 at 12:46 AM.
 
  


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
command line tool to play swf internet streams? ncsuapex Linux - Software 10 06-25-2011 02:44 AM
How do I play streaming audio from the command line? lothario Linux - Software 8 11-29-2008 12:00 PM
Command line tool for recording audio and cutting on the fly whowalks Linux - Newbie 9 11-07-2008 03:46 PM
play audio mp3 files from command line? runlevel <5 carl0ski Linux - Software 3 12-02-2004 05:58 AM
Command line tool to print length of mp3 files? J_Szucs Linux - Software 3 05-04-2004 06:01 AM

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

All times are GMT -5. The time now is 12:04 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration