that was the easiest way for me to make it work. but thanks for the ideas.
i'd probably use all shell if i had to process too many videos,
needing to use all the cores in the LTSP lab, w/c don't have php
easily.
or if the cores are all in the web and we can't run shell easily then
all php maybe...

added some if (file_exists($finalfile)) { die...} after the
array_pop... so it can be used in batch files and run as many times in
parallel as you want the cores to be busy.

---------------------------------------------------------------------------------------------------------------------------
Explore the Bible like never before and get practical guidance into
Christian living, prophecy, and much more!
http://www.amazingfacts.org/Television/AmazingFactsPresents/tabid/77/Default.aspx




On Tue, Jan 25, 2011 at 2:27 PM, JP Loh <j.peter...@gmail.com> wrote:
> The script uses $argc though.
>
> On Tue, Jan 25, 2011 at 14:15, Michael Janapin
> <michael.jana...@gmail.com> wrote:
>> Hi Mike,
>> What you suggested can't be done through the web, right?
>>
>> I think the original script is for those who can't have shell access. The
>> php script probably assumes that file upload is allowed, and thus
>> concatenating is also through php.
>>
>> Michael Janapin
>> PBTS Baguio City
>> http://mulingsilang.wordpress.com
>> sent from my Android
>>
>> On Jan 25, 2011 2:10 PM, "Michael Tinsay" <tinsa...@yahoo.com> wrote:
>>> Here's what I do manually for .avi files (I believe I found this in
>>> ubuntuforums.org):
>>>
>>> cat video1 video2 ... > tempfile
>>> mencoder -oac copy -ovc copy -forceidx -o tempfile2 tempfile
>>>
>>> after this, you can just feed tempfile2 to ffmpeg to convert it to mp4.
>>>
>>>
>>> --- mike t.
>>>
>>>
>>>>
>>>>From: Zak Elep <zak...@gmail.com>
>>>>To: Philippine Linux Users' Group (PLUG) Technical Discussion List
>>>><plug@lists.linux.org.ph>
>>>>Sent: Tuesday, January 25, 2011 13:10:04
>>>>Subject: Re: [plug] php script to concatenate video files (to h264) using
>>>> ffmpeg
>>>>& named pipes
>>>>
>>>>
>>>>Backticks smells. :P
>>>>There's posix_mkfifo() and ffmpeg-php extension. Why not use them? :)
>>>>
>>>>On Jan 24, 2011 9:28 PM, "Winelfred G. Pasamba"
>>>> <winelfredpasa...@gmail.com>
>>>>wrote:
>>>>> <?php
>>>>> //
>>>>> // concatenate videos (using ffmpeg and named pipes)
>>>>> //
>>>>> // Winelfred G. Pasamba c2011
>>>>> //
>>>>>
>>>>> if ($argc <= 1) {
>>>>> die ("usage: php joinvideos.php video1 video2 video3 ... videoall\n");
>>>>> }
>>>>>
>>>>> $phpfile = array_shift ($argv);
>>>>> echo "# php file is: $phpfile\n";
>>>>>
>>>>> $finalfile = array_pop($argv);
>>>>> echo "# final file is: $finalfile\n";
>>>>>
>>>>> foreach ($argv as $arg) {
>>>>> echo "# Making pipe: fifo.$arg.mpg \n";
>>>>> $cmd = "mkfifo fifo.$arg.mpg\n";
>>>>> `$cmd`;
>>>>> }
>>>>>
>>>>> foreach ($argv as $arg) {
>>>>> echo "# Preparing pipe source: $arg\n";
>>>>> $cmd = "ffmpeg -i $arg -sameq -y fifo.$arg.mpg > /dev/null <
>>>>> /dev/null&\n";
>>>>> echo $cmd;
>>>>> `$cmd`;
>>>>> }
>>>>>
>>>>> $cmd = "cat ";
>>>>> foreach ($argv as $arg) {
>>>>> $cmd .= "fifo.$arg.mpg ";
>>>>> }
>>>>> //$cmd .= " | ffmpeg -f mpeg -i - -sameq -vcodec libx264 -vpre medium
>>>>> -ac 1 -ab 128k $finalfile";
>>>>> $cmd .= " | ffmpeg -f mpeg -i - -sameq -vcodec libx264 -vpre medium
>>>>>$finalfile";
>>>>> echo "# Executing: $cmd\n";
>>>>> echo $cmd."\n";
>>>>> `$cmd`;
>>>>>
>>>>> foreach ($argv as $arg) {
>>>>> echo "# Removing pipe: fifo.$arg.mpg\n";
>>>>> $cmd = "rm fifo.$arg.mpg"."\n";
>>>>> `$cmd`;
>>>>> }
>>>>>
>>>>> if someone can add more sense to this, that would be welcome :)
>>>>> _________________________________________________
>>>>> Philippine Linux Users' Group (PLUG) Mailing List
>>>>> http://lists.linux.org.ph/mailman/listinfo/plug
>>>>> Searchable Archives: http://archives.free.net.ph
>>>>
>>
>> _________________________________________________
>> Philippine Linux Users' Group (PLUG) Mailing List
>> http://lists.linux.org.ph/mailman/listinfo/plug
>> Searchable Archives: http://archives.free.net.ph
>>
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph
>
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph

Reply via email to