[MPlayer-users] Using mplayer with mp3 files for reading specific portions of the audio file

Krzysztof Duchnowski amidk75 at gmail.com
Thu Jan 16 14:45:32 CET 2014


On 16.01.2014 13:45, Bogdan Cristea wrote:
> Hi

> I am using mplayer as audio module in a Digital Talking Book player on 
> Linux. For this player I need to read mp3 files with a specific time 
> offset and for a specific duration. Currently I run mplayer with the 
> following options:

> mplayer -slave -really-quiet audioFile.mp3 -ss beginTimeS -endpos 
> endTimeS -hr-mp3-seek

> However, as already specified in the documentation, the specified 
> durations are not precisely respected, thus there is a small overlap 
> between successive audio sections. Is there a way to have a more precise 
> mp3 playback ?

start relative to beginning, stop relative to start:
sox audioFile.mp3 -d trim "=$beginTimeS" "$endTimeS"

start relative to beginning, stop relative to beginning:
sox audioFile.mp3 -d trim "=$beginTimeS" "=$endTimeS"

start relative to previous possition (since no previous, then from
beginning), stop relative to end:
sox audioFile.mp3 -d trim "$beginTimeS" "-$endTimeS"

trim possitions format:
time - "hh:mm:ss.frac" ("1:28:32.50" or "30.25")
sound frames - "NNNNNNs" ("8000s")

You can use more trim arguments, like two 15 sec play every 30 sec:
sox audioFile.mp3 -d trim "30" "15" "15" "15"
for relative start and stop, or:
sox audioFile.mp3 -d trim "30" "15" "=60" "15"
for starts counted from beginning, and stops relative to starts

-- 
Krzysztof 'DK75' Duchnowski
GetFirefox - http://www.getfirefox.net/
Konfiguracja UTF-8 dla czytników - http://evil.pl/pip/utf/


More information about the MPlayer-users mailing list