PDA

View Full Version : Web frontend for mencoder


communist
17th December 2006, 12:34
Since I didn find something that already does this I tried it myself, some weeks ago I tried to create a php frontend for mencoder - mostly hard-coded and very simple. Since I dont have much knowledge of php/html I just wanted to ask if its possible after all to do such a thing (before trying it again). I want to copy files from a satellite receiver in the network, create streamable clips and make them available to other computers in the network from a linux box.

The whole thing would have to do the following:
- have a file browser for selecting clips (no clue how to do this)
- selectable audio/video codec (got that but then couldn go on with different options for the codecs)
- select appropriate output (streamable mov/flv or anything else that can be viewed easily, mencoder does only avi?!)

This is what I have so far, a form which then calls action.php (took me ages to throw this together):
<form action="action.php" method="post">
<p>path : <input type="text" name="path" /></p>
<p>file : <input type="text" name="file" /></p>

<p>Resolution: <select name="vres">
<option value="96:72">96x72</option>
<option value="192:144">192x144</option>
<option value="384:288">384x288</option>
</select></p>

<p>Video bitrate: <select name="vidbitrate">
<option value="64">64 kbps</option>
<option value="128">128 kbps</option>
<option value="192">192 kbps</option>
</select></p>

<p>Audio bitrate: <select name="audbitrate">
<option value="32">32 kbps</option>
<option value="48">48 kbps</option>
<option value="64">64 kbps</option>
<option value="96">96 kbps</option>
<option value="128">128 kbps</option>
</select></p>

<p>Noise Reduction: <select name="noisered">
<option value="500">0</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
</select></p>

<p><input type="submit" value="Go for it!" /></p>
</form>
<?php $path=$_POST['path'];
$file=$_POST['file'];
$vbitrate=$_POST['vidbitrate'];
$abitrate=$_POST['audbitrate'];
$vfscale=$_POST['vres'];
$nr=$_POST['noisered'];
echo "<p><b>Encoding with following parameters:</b><p>mencoder $path$file -o /vids/$file.avi -vf scale=$vfscale -oac mp3lame -lameopts cbr:br=$abitrate -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$vbitrate:nr=$nr</p></p>";
exec ("mencoder $path$file -o $path$file.avi -vf scale=$vfscale -oac mp3lame -lameopts cbr:br=$abitrate -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$vbitrate:nr=$nr > /var/www/myphp/job.txt");
echo "<p>Job finished!</p><p>For details click <a href='/myphp/job.txt'>here</a></p>";
?>

I actually wanted to post the finished version if anyone finds it usable but due to my very limited knowledge of php/html I didn get very far :|
Anyone that can help? :)

smok3
17th December 2006, 13:55
i like the idea, you could get a single path with

<input name="pathA" type="file" size="80" value=""> (no idea how to select multiple files)

i would be interested for a x264 version....

Pookie
18th December 2006, 16:30
ffmpeg-php - http://ffmpeg-php.sourceforge.net/ , mencoder's first cousin :D

Windows builds at http://groups.google.com/group/ffmpeg-php/browse_frm/thread/7734efada7b2f355/df3510343804aa02?hl=en#df3510343804aa02

I'm not saying to switch, but perhaps there are some examples for inspiration.

Sirber
18th December 2006, 16:36
your php script will timeout before mencoder ends.

add "set_time_limit(0);" above the php code