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

adland adland123 at yahoo.com
Sun Apr 4 13:23:10 CEST 2004


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 

__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getwav.tgz
Type: application/x-tgz
Size: 1679 bytes
Desc: getwav.tgz
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-users/attachments/20040404/48c82462/attachment.bin>


More information about the MPlayer-users mailing list