[MPlayer-users] Re: play only first 30 seconds of a song

rwk at americom.com rwk at americom.com
Sun Apr 4 13:34:43 CEST 2004


Wow!  That's a bit of work.  I never would have guessed it would be so
difficult just to get the first 30 seconds of an mp3 file.  Thanks for
your scripts!  I will give them a try...

Best regards and thanks again,
Dick

> I wrote quick code example to allow you to do this
> it is attached below
> 
> steps: 
> create fifo
> write pcm (wav) data to fifo using mplayer
> read data from fifo in program which outputs first 
> 30 seconds to file (with the valid header) 
> rm fifo 
> kill mplayer
> 
> (steps automated in shell script)
> 
> requires: bash, python
> unpack using tar -zxvf getwav.tgz
> files: getwav.sh, getwav.py getwav.txt
> 
> usage ./getwav.sh infile outfile
>       ./getwav song.mp3 song.wav
> 
> may require some modifications to meet your
> requirements or to fix bugs.
> 
> some things are hardcoded in python script like
> 44100,2 channel (stereo), 16 bit sample size (2 bytes)
> 
> these need to be updated to match your output from
> mplayer if different
> 
> good luck 




More information about the MPlayer-users mailing list