LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Audio Processing Tool Command Line To Extract Play Length? (https://www.linuxquestions.org/questions/linux-software-2/audio-processing-tool-command-line-to-extract-play-length-710401/)

lindylex 03-10-2009 12:02 AM

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

anurag_bhd 03-10-2009 01:11 AM

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).

anurag_bhd 03-10-2009 01:13 AM

Have you check for whether sox's media support could be extended using some plugins or something?

almatic 03-10-2009 09:37 AM

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}'

lindylex 03-10-2009 09:41 AM

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.

lindylex 03-10-2009 09:45 AM

almatic, wow thanks that was amazing and what I thought was possible.

Thanks, much

lindylex 03-10-2009 09:26 PM

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)}'


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