📜 ⬆️ ⬇️

Own youtube

The web has divorced quite a lot of video hosting sites like youtube. So one provincial provider wanted to do such a thing. On one side, this is correct, because almost all providers in small cities have thick internal channels (10-100-1000 megabits) and thin external channels (5-10-20 megabits), so we must strive to make it inside You can use more popular resources - at least to optimize the load on the external channel, if not to attract customers.

The task is set, the amount specified is to be done. The option “write your own” is swept away immediately - long, tedious, and I don’t even consider myself a programmer. Although, if you want, then no one bothers: playing clips - JW Player , downloading files - in your favorite language is implemented without question, video transcoding - depends on the chosen platform (mencoder is anywhere). But I do not like to reinvent the wheel, but I prefer to use ready-made solutions, so I went to Google. The search brought several options, both free and paid (from 10 euros and above), but first decided to try the most popular of the free options - phpmotion .


')
The machine for the server itself is not yet very powerful, but I decided that for the first time enough (Core 2 Quad Q9400, 4GB RAM, 250GB in RAID1 for the system and 4 * 1TB for the data). Since the script prefers to work under Linux, Linux was raised (the installation of windows was considered, but due to the preferences of the script, Linux was left).

System requirements for server software:
- PHP 4.3 and above (including support of CLI)
- MySQL database server
- LAME MP3 Encoder
- Libogg + Libvorbis
- Mencoder and also Mplayer
- FFMpeg-PHP
- GD Library 2 or higher
- CGI-BIN
- Be able to run background processes

PHP settings:
- open_basedir = (no value)
- upload_max_filesize = 100M
- post_max_size = 100M
- max_execution_time = 1500
- session.gc_maxlifetime = 14000
- safe_mode = off
- Thread saftery = disabled
- enable_dl = On

In principle, it can work on some hosting, but for complete happiness it is better to have a separate server, there will be less problems.

All required programs are in almost any Linux distribution. If not, you can download and install. In my case, Linux was Debian 5.0, for some things (lame, something else) I had to connect an additional debian-multimedia repository.

Currently there are two versions of phpmotion, v2 and v3 (recently given the status of "stable"). First, I put v2 (at that time, v3 was still beta), then v3. Remained on v3 - somewhat more buggy, but the functionality pays off. Bugs are fixed, there is a support forum, bugtracker. New builds come out about once every 10 days. With the latest version, the support of non-Latin characters was brought to mind (Russians, at least with hieroglyphs, they say, still have some problems).

You can download it here: phpmotion.com/content/view/1/180 (go through the download link, registration on the forum is required). Well, or if too lazy to register, then tyts ;)
Occasionally they ban Russian IPs on their forum (although the support shouts “Your IP is not in the banlist”), so you have to go there through anonymouse.org
Updates live here: wiki.phpmotion.com/Updates . It makes sense to go there more often - updates are not always marked on the forum.

Installation is simple: wiki.phpmotion.com/InstallingV3
1) Create a database, user and password
2) Download the script and upload it to the server. Distributed folders should be downloaded as binary, but I preferred to unpack the archive directly on the server.
3) 755 per / cgi-bin with subfolders
4) Go to www.yourdomain.com/setup and follow the instructions. They will offer to set rights to several more folders, check for the availability of necessary programs, etc.
5) At the end of the installation, delete the / setup folder

Possible problem: the script is not open-source, it is encoded, run through a loader, which works as a PHP extension. If it does not start, you should slip it into the folder with php extensions to the server. Take in / phpshield the desired binary and put it in extension_dir, specified in php.ini. In the same Debian, the default extension_dir = "./", which is why I played a couple of hours with different versions of the loader.

Possible problem 2: script error during file upload. Usually - problems with the line breaks in pearl barley scripts. dos2unix /cgi-bin/*.pl

Settings: most of them live at www.yourdomain.com/siteadmin , but part (maximum file size, valid file types) - in pm-files in the / cgi-bin folder - separately for video and for audio.

There is no official Russian version (and other national ones) yet, so everyone translates for himself. There are no language files support yet, so you have to change /lang/english.php

At the moment my site is in the status of public testing, slowly translate the interface into Russian. In general, users are satisfied. There are some incomprehensible problems with some files, out of 160 files 4 pieces were not recoded at all, a couple of them after the second download.

On my site I will not give a walk, it is in the internal network of the provider. But the possibilities and (default) appearance can be found here: v3beta.phpmotion.net

There will be questions - ask.

Source: https://habr.com/ru/post/61134/


All Articles