[MPlayer-users] Re: play only first 30 seconds of a song
adland
adland123 at yahoo.com
Sun Apr 4 14:06:03 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...
I had tried a few other ideas previously with limited success
mplayer has options like -edl editlist but this only works if you have video
you could also use something like -frames to limit playback to X num frames
(again video is required) also it did not give good control over length
for resulting audio file
not a problem because -audiofile allows us to play a mp3 file as audio track
for a seperate video
idea was to use length * frames _per_second = X
FYI: get value for frames per second in video file
mplayer -frames 0 -identify file.avi
Also just thought about this
you might could use the unix command dd to read the bytes from FIFO.
see man dd for more info
mkfifo MYFIFO
mplayer -ao pcm -aofile MYFIFO -vo null -vc dummy song.mp3 &
dd if=MYFIFO of=test.wav bs=1 count=X
rm MYFIFO
killall -9 mplayer
where X = 44 bytes for header + channels * bytes per sample * rate * seconds
or 44 + 2 * 2 * 44100 * 30 for 30 secs CD audio
my python program does however modify the filelength written in the wave header
to match new length for smaller duration file
good luck
More information about the MPlayer-users
mailing list