What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » [split] encoding with MP4Box

[split] encoding with MP4Box
Author: Message:
Burbruee
New Member
*


Posts: 1
37 / Male / Flag
Joined: Jul 2009
O.P. RE: FFMPEG-PHP: converting videos
Hello, new member here. Found this by a search engine. :)
I'm trying to make uploading and converting on the serverside and encoding with mencoder through shell_exec work.
I also need to use MP4Box afterwards.

What I do is
1: encode with mencoder.
2: Split the video and audio with MP4Box.
3: Join the video again.

Else buffering won't work.

Anyway, I made some changes to the script posted here for h264, but some strange things are happening, or rather not happening.

The command I want to execute is "MP4Box -aviraw video file.avi"
code:
<?php
convertToMp4( "test.avi", "out" );

function convertToMp4( $input, $output ) {
    $input = escapeshellarg($input);
    $output = escapeshellarg($output);

    $command2 = "MP4Box -aviraw video $output";
    echo "$command2<br />";
    shell_exec( $command2 );
}

?>
I commented out the rest of the script for now so this is the only executed code.
I already have the menconded file in the directory.

Okay, so if I run this through my browser, the echo comes up with
code:
MP4Box -aviraw video 'out'
(out is the name of my testfile, yes it does not have an extension, and yes the name is misleading since MP4Box is asking for the input, but this is the "out" from mencoder..)
It creates no new file in the dir when run through the browser.. So it doesn't do anything at all.

However, if I were to run
code:
php convert.php

(through ssh via putty)
it all works! It demuxes the video part and out_video.h264 is created!
Why? Why does it not work in the browser?
Am I missing something? It's not a permission issue because mencoder worked through shell_exec...

Thanks for any help you may provide.
Never mind, after some work I got it working.
I'll post the solution in case somebody else may have the same problem.

I checked my error log for apache and it read
code:
sh: MP4Box: command not found

So I simply issued a 'whereis MP4Box' and found out it was located in /usr/local/bin, then in my .php I created a variable $mp4path where I put in the path.
So I use the following:
code:
$mp4path = "/usr/local/bin/"
$cmd = $mp4path . "MP4Box -aviraw video " . $output;
shell_exec( $cmd );

This post was edited on 07-01-2009 at 05:18 AM by Burbruee.
07-01-2009 05:16 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On