LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-01-2013, 02:57 AM   #1
mirzasoltan
LQ Newbie
 
Registered: Oct 2010
Posts: 28

Rep: Reputation: 0
Help for mplayer


hi everyone,
i want to play a series files with mplayer but i want to play them a few seconds, for example:
file #1 is a mp3 file with 3:45 time, but i want to play it for 30seconds and after it mplayer exit automatically and exit code must be true for mplayer (it must be 0). i mean if i kill mplayer after 30 seconds with "kill" command, exit code will be 1, but mplayer did correct with mp3 file!!

anyone helppppppppp.
 
Old 05-01-2013, 03:27 AM   #2
flamelord
Member
 
Registered: Jun 2011
Distribution: Arch Linux
Posts: 151

Rep: Reputation: 34
ffmpeg has the -t and -to options which allow it to stop after a certain period of time, you could try filtering the mp3 file through ffmpeg into mplayer.
so something like

Code:
ffmpeg -i something.mp3 -to 10 -f wav -  | mplayer - -cache 8092
 
1 members found this post helpful.
Old 05-01-2013, 03:52 AM   #3
mirzasoltan
LQ Newbie
 
Registered: Oct 2010
Posts: 28

Original Poster
Rep: Reputation: 0
tanx flamelord, useful, now if i want to play mms links with mplayer, what i must do for playing just a few seconds? for example:
"mplayer mms://link: port"
i knew the way, that in .mplayer/conf can set an option for setting the play time, but i forget that option, in manual of mplayer i didnt find it. (like volume=0)
 
Old 05-01-2013, 04:03 AM   #4
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 635

Rep: Reputation: 186Reputation: 186
You can use a combination of the -ss and -endpos flags if you need to play a specified portion of a file.
The "-ss TIME" flag seeks to the specified position in the file, while the "-endpos TIME" flag specifies how much of the file will be played.
So, for example, a command line like this
Code:
mplayer -ss 0:02:00 -endpos 0:20:00 FILE
will play FILE starting from the second minute (0:02:00) for exactly 20 minutes (0:20:00), which corresponds to the 22nd minute of FILE (0:22:00).
You can also specify time by using natural numbers that are interpreted as seconds.
Regarding the return value, I guess you can wrap the mplayer command in a script and trap the kill/close signal.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MPlayer GUI (gmplayer - NOT gnome-mplayer) single instance fix... poweredbydodge Linux - Desktop 5 04-12-2011 04:34 PM
LXer: SMPlayer and GNOME Mplayer - Two Incredibly Good Mplayer Based Media Players For Ubuntu LXer Syndicated Linux News 0 07-13-2010 03:10 AM
Mplayer build: configure finds ALSA, but mplayer doesn't galle Linux - Software 5 10-13-2007 07:14 PM
Mplayer codecs - running 32bit mplayer on 64bit OS sleepyrob Linux - Software 2 08-12-2006 06:08 AM
In Kubuntu I have compiled MPlayer and it works fine, MPlayer Plug-in is not working kickass331 Linux - Newbie 10 08-11-2006 10:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration