LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-27-2005, 09:29 AM   #1
bai_design
LQ Newbie
 
Registered: Jun 2003
Location: London, Ontario
Distribution: RedHat 6/9 Slackware
Posts: 28

Rep: Reputation: 15
calling mplayer -identify via php script?


Is it possbile to call mplayer thorugh a php script?
The code I had been using is this:
Code:
$mplayer = "/usr/local/bin/mplayer -vo null -ao null -frames 0 -identify  ";
//echo "<br>Appended File:".$mplayer.$videoPath.$videofile;
$final = $mplayer."'".$videoPath.$videofile."'";
echo "<br>Final Command:".$final."<br>";
echo "<pre>";
echo $shell = system($final)."</pre>";
All information is being posted to the script from an HTML file...
I try running it this way but I keep on getting this feed pack from mplayer:
Code:
Final Command:/usr/local/bin/mplayer -vo null -ao null -frames 0 -nosound -identify '/home/jeremiah/testVideo/test.mkv'
MPlayer 1.0pre6-3.3.3 (C) 2000-2004 MPlayer Team
CPU: Intel Celeron 2/Pentium III Coppermine,Geyserville (Family: 6, Stepping: 6)
Detected cache-line size is 32 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE

Playing /home/jeremiah/testVideo/test.mkv.


Exiting... (End of file)
If I run the same command in the commandline I get desired output. Is there something that I am missing that is preventing me from achieving this?
Also is it possible to do threading in php?
 
Old 01-27-2005, 09:36 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
looks fine, what's an mkv file though? does it actaully play normally? what heppens if you run that mplayer command by itself?
 
Old 01-27-2005, 09:43 AM   #3
bai_design
LQ Newbie
 
Registered: Jun 2003
Location: London, Ontario
Distribution: RedHat 6/9 Slackware
Posts: 28

Original Poster
Rep: Reputation: 15
When I execute it in the commandline I get this:
Code:
MPlayer 1.0pre6-3.3.3 (C) 2000-2004 MPlayer Team
CPU: Intel Celeron 2/Pentium III Coppermine,Geyserville (Family: 6, Stepping: 6)
Detected cache-line size is 32 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE


77 audio & 186 video codecs
Failed to open /dev/rtc: Device or resource busy (it should be readable by the user.)
Playing /home/jeremiah/testVideo/test.mkv.
ID_VIDEO_ID=0
[mkv] Track ID 1: video (V_MS/VFW/FOURCC), -vid 0
ID_AUDIO_ID=0
ID_AID_0_LANG=eng
[mkv] Track ID 2: audio (A_AAC/MPEG4/LC/SBR), -aid 0, -alang eng
ID_AUDIO_ID=1
ID_AID_1_LANG=jpn
[mkv] Track ID 3: audio (A_AAC/MPEG4/LC/SBR), -aid 1, -alang jpn
ID_SUBTITLE_ID=0
ID_SID_0_LANG=eng
[mkv] Track ID 4: subtitles (S_TEXT/SSA), -sid 0, -slang eng
[mkv] Will play video track 1
[mkv] Will play audio track 2
Matroska file format detected.
VIDEO:  [XVID]  720x480  12bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
FAAD: compressed input bitrate missing, assuming 128kbit/s!
AUDIO: 44100 Hz, 2 ch, 16 bit (0x10), ratio: 16000->176400 (128.0 kbit)
Selected audio codec: [faad] afm:faad (FAAD AAC (MPEG2/MPEG4 Audio) decoder)
==========================================================================
ID_FILENAME=/home/jeremiah/testVideo/test.mkv
ID_VIDEO_FORMAT=XVID
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=720
ID_VIDEO_HEIGHT=480
ID_VIDEO_FPS=23.976
ID_VIDEO_ASPECT=1.7771
ID_AUDIO_CODEC=faad
ID_AUDIO_FORMAT=MP4A
ID_AUDIO_BITRATE=128000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
ID_LENGTH=1435
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm:ffmpeg (FFmpeg MPEG-4)
==========================================================================
Checking audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
AF_pre: af format: 2 bps, 2 ch, 44100 hz, little endian signed int
AF_pre: 44100Hz 2ch Signed 16-bit (Little-Endian)
AO: [null] 44100Hz 2ch Signed 16-bit (Little-Endian) (2 bps)
Building audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
Starting playback...
MKV/MKA is mastroka. Its a file container format for video/audio and I believe subtitles...
http://www.matroska.org/

When I run mplayer by itself through the script I get the same thing as the commandline, which is:
Code:
MPlayer 1.0pre6-3.3.3 (C) 2000-2004 MPlayer Team
CPU: Intel Celeron 2/Pentium III Coppermine,Geyserville (Family: 6, Stepping: 6)
Detected cache-line size is 32 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE

Usage:   mplayer [options] [url|path/]filename

Basic options: (complete list in the man page)
 -vo   select video output driver & device ('-vo help' for a list)
 -ao   select audio output driver & device ('-ao help' for a list)
 vcd://   play (S)VCD (Super Video CD) track (raw device, no mount)
 dvd://   play DVD title from device instead of plain file
 -alang/-slang    select DVD audio/subtitle language (by 2-char country code)
 -ss     seek to given (seconds or hh:mm:ss) position
 -nosound         do not play sound
 -fs              fullscreen playback (or -vm, -zoom, details in the man page)
 -x  -y     set display resolution (for use with -vm or -zoom)
 -sub       specify subtitle file to use (also see -subfps, -subdelay)
 -playlist  specify playlist file
 -vid x -aid y    select video (x) and audio (y) stream to play
 -fps x -srate y  change video (x fps) and audio (y Hz) rate
 -pp     enable postprocessing filter (details in the man page)
 -framedrop       enable frame dropping (for slow machines)

Basic keys: (complete list in the man page, also check input.conf)
 <-  or  ->       seek backward/forward 10 seconds
 up or down       seek backward/forward  1 minute
 pgup or pgdown   seek backward/forward 10 minutes
 < or >           step backward/forward in playlist
 p or SPACE       pause movie (press any key to continue)
 q or ESC         stop playing and quit program
 + or -           adjust audio delay by +/- 0.1 second
 o                cycle OSD mode:  none / seekbar / seekbar + timer
 * or /           increase or decrease PCM volume
 z or x           adjust subtitle delay by +/- 0.1 second
 r or t           adjust subtitle position up/down, also see -vf expand

 * * * SEE THE MAN PAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS * * *

Last edited by bai_design; 01-27-2005 at 09:45 AM.
 
Old 01-27-2005, 10:46 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well it certainly knows what file it's meant to be playing... i'd be thinking along the lines of output streams... presumably in the php script you're only looking at stdout, and not stderr? i wouldn't have thought the -identify data would be going to stderr, but i do this exact same thing inside my dvd ripper, acidrip (perl) and i habitually redirect stderr back into stdout in the command line.
 
Old 01-27-2005, 10:53 AM   #5
bai_design
LQ Newbie
 
Registered: Jun 2003
Location: London, Ontario
Distribution: RedHat 6/9 Slackware
Posts: 28

Original Poster
Rep: Reputation: 15
so how exactly would I capture the stderr output then?
Is there a tutorial that you can refer me too?
 
Old 01-27-2005, 11:42 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
just use "mplayer -opts file.mkv 2>&1" and both streams should appear.
 
Old 01-27-2005, 01:31 PM   #7
bai_design
LQ Newbie
 
Registered: Jun 2003
Location: London, Ontario
Distribution: RedHat 6/9 Slackware
Posts: 28

Original Poster
Rep: Reputation: 15
mplayer doesn't recognise the -opts option...
its listed as an unknown command...
 
Old 01-27-2005, 01:32 PM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
it was an example... it implies "put all your option crap here"
 
Old 01-27-2005, 01:37 PM   #9
bai_design
LQ Newbie
 
Registered: Jun 2003
Location: London, Ontario
Distribution: RedHat 6/9 Slackware
Posts: 28

Original Poster
Rep: Reputation: 15
O... well it still returns with:
Code:
Playing /home/jeremiah/testVideo/test.mkv.


Exiting... (End of file)
 
  


Reply



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
bash script calling mplayer afrodocter Programming 13 08-23-2005 10:41 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
stop executables and php that is calling it bwreath Linux - Software 1 04-01-2005 03:15 PM
calling another script to be run. sonesay Programming 2 05-23-2004 06:08 AM
Calling All Script Guru's Shinobi Linux - General 5 04-02-2003 03:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:37 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
Open Source Consulting | Domain Registration