BrianK Posted April 25, 2007 Share Posted April 25, 2007 Hello everyone. I'm trying to get some info from a movie file & display that info on a web page. The program that does this is called "tcprobe" and is part of the transcode suite available on Linux. So far, the only way I've gotten any output to be displayed is if I send stderr to stdout, but when I do that, I only get the first line of output. To confuse matters, if I run the php on the command line, it works like I'd expect it to. Here's a code snip: if (!exec("/usr/bin/tcprobe -i $vid 2>&1",$output,$error)){ echo "bad exec<br>\n"; echo "error: $error<br>\n"; }else{ echo "good exec<br>\n"; $count = 0; echo "<br>"; foreach ($output as $i){ echo "$count - $i<br>\n"; $count++; } } Through apache, this code will print out: good exec 0 - [tcprobe] Apple QuickTime movie file On the command line, it prints out: good exec<br> <br>0 - [tcprobe] Apple QuickTime movie file<br> 1 - [probe_mov.c] video codec=jpeg<br> 2 - [tcprobe] summary for Hummer.mov, (*) = not default, 0 = not detected<br> 3 - import frame size: -g 720x486 [720x576] (*)<br> 4 - frame rate: -f 30.000 [25.000] frc=5 (*)<br> 5 - no audio track: use "null" import module for audio<br> 6 - length: 901 frames, frame_time=33 msec, duration=0:00:30.033<br> which is what I'd like it to print out through the browser. any ideas why it works on the command line but not the browser? Quote Link to comment Share on other sites More sharing options...
btherl Posted April 26, 2007 Share Posted April 26, 2007 Ok, now that i've read the question properly That is odd. What if you try another function like shell_exec()? When you've got behaviour that doesn't make sense, sometimes a solution that doesn't make sense will work Quote Link to comment Share on other sites More sharing options...
BrianK Posted April 26, 2007 Author Share Posted April 26, 2007 Ok, now that i've read the question properly That is odd. What if you try another function like shell_exec()? When you've got behaviour that doesn't make sense, sometimes a solution that doesn't make sense will work Yeah, I tried shell_exec - same thing. I think what may be happening is that tcprobe is a wrapper (it's a compiled wrapper, but a wrapper none the less) & calls two other programs - the output is prefaced by "[name_of_program]". Somehow, maybe this is screwing it up? I believe it's getting the output from one of those but not the other two. I half solved it by using ffmpeg instead of tcprobe. tcprobe gives better info (namely frames per second) so I may experiment with it more when I get some free time. If that makes sense & anyone knows a way around it, please chime in. I'd love to get this problem solved correctly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.