
Recherche avancée
Autres articles (54)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (5890)
-
passing additional values to s3 event notification for lambda consumption
8 septembre 2017, par user1790300I have to write code in react-native that allows a user to upload videos to amazon s3 to be transcoded for consumption by various devices. For the processing after the upload occurs ; I am reviewing two approaches :
1) I can use Lambda with ffmpeg to handle the transcoding immediately after the uploading occurs (my fear here would be the amount of time required to transcode the videos and the effect on pricing if it takes a considerable amount of time).
2) I can have s3 pass an sns message to a rest api after the created event occurs and the rest api generate a rabbitmq message that will be processed by worker that will perform the transcoding using ffmpeg.
Option 1) seems to be the preferable option based on a completion time perspective. How concerned should I be with using 1) considering how long video transcoding might take as opposed to option 2) ?
Also, regardless, I need a way to pass additional parameters to lambda or along the sns messaging that would allow me to somehow associate the user who uploaded the video with their account. Is there a way to pass additional text-based values to s3 to pass along to lambda or along sns when the upload completes, as a caveat I plan to upload the video directly to s3 using the rest layer(found this answer here : http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html#RESTObjectPUT-responses-examples) ?
-
PHP : Convert file with FFMPEG and upload to S3 using shell_exec() and aws cli tools
18 septembre 2017, par andreaemI need a script that handle the upload of a video file from
dropzone.js
, convert tom4v
then generate 5 thumbnails using the name of file appending-(number)
to each jpg file (eg :file-1.jpg
,file-2.jpg
,file-3.jpg
etc) and finally upload to s3 using shell_script (or maybe if there is a better way to do this).Recap
- Upload file in a temp dir
- Convert file to
.m4v
- Generate 5 thumbnails from video
- Upload the converted video to Amazon S3
- Delete local video file
Here is my code, at the moment I don’t know where the file goes and nothing seems to be uploaded to Amazon S3 (doing the upload in command-line works, so the credentials are ok).
Dropzone.js
$("#dZUpload").dropzone({
url: "/ajax/admin/admin.acceptVideo.php",
maxFilesize: 200,
renameFile: new Date,
acceptedFiles: "video/*",
addRemoveLinks: true,
success: function (file, response) {
var imgName = response; file.previewElement.classList.add("dz-success");
console.log("Successfully uploaded :" + imgName);
$('#form_video').val(file);
},
error: function (file, response) {file.previewElement.classList.add("dz-error");
}
}).autoDiscover = false;
Dropzone.prototype.defaultOptions.dictRemoveFile = "Rimuovi file";
Dropzone.on("addedfile", function(file) {
var cancelLink = Dropzone.createElement('<a>Cancel upload</a>');
file.previewElement.appendChild(cancelLink);
cancelLink.addEventListener("click", function(e) {
e.preventDefault();
myDropzone.cancelUpload(file);
});
});PHP
$target_dir = "/var/www/html/example.com/web/temp/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["file"]["tmp_name"]);
if($check !== false) {
echo "File is a video - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 200000000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "mp4" && $imageFileType != "mov" && $imageFileType != "avi" && $imageFileType != "m4v" ) {
echo "Sorry, only MP4 MOV AVI M4V files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
S3Up(VideoConvert(basename( $_FILES["file"]["name"]),random_int('1','9999')));
echo "The file ". basename( $_FILES["file"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
function VideoConvert($video, $id) {
shell_exec('ffmpeg -i ' . $video . ' /var/www/html/example.com/web/temp/' . $id . '.m4v');
for ($i=0;$i <= 5;$i++) {
shell_exec('ffmpeg -i ' . $video .' -vf "select=gte(n\,' . $i .'00)" -vframes 1 ' .$id . '-' . $i. '.jpg');
}
return '/var/www/html/example.com/web/temp/' . $id . '.m4v';
}
function S3Up($video) {
shell_exec('aws s3 cp ' . $video .' s3://example-video/ --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers');
sleep(1);
//shell_exec('rm '. $video);
}Here is my error.log line relating to s3 upload :
error.log
example.mp4: No such file or directory
Traceback (most recent call last):
File "/usr/local/bin/aws", line 19, in <module>
import awscli.clidriver
File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 17, in <module>
import botocore.session
File "/usr/local/lib/python2.7/dist-packages/botocore/session.py", line 26, in <module>
import botocore.credentials
File "/usr/local/lib/python2.7/dist-packages/botocore/credentials.py", line 22, in <module>
from dateutil.parser import parse
ImportError: No module named dateutil.parser
</module></module></module></module>How can I improve this ? I’ve tried using aws php api but got some problems with credentials, cli tools don’t have.
Behavior
At the moment
dropzone.js
stop uploading at 50% if I put a file of 8 MB, php maxUploadSize directive is set to 201M, php upload temp folder is inside the site root directory and permissions set to 7777. File where uploaded if I put a smallest file of 200Kb but don’t convert and make a 0 byte file. -
Enabling libmp3lame for FFMPEG on elastic beanstalk
13 octobre 2017, par Adam SithI am trying to enable libmp3lame with FFMPEG in elastic beanstalk (Amazon Redhat Linux machine).
I am able to successfully install FFMPEG in
/ffmpeg.config
with the following script :# .ebextensions/ffmpeg.config
packages:
yum:
autoconf: []
automake: []
cmake: []
freetype-devel: []
gcc: []
gcc-c++: []
git: []
libtool: []
make: []
nasm: []
pkgconfig: []
zlib-devel: []
sources:
/usr/local/src: http://ffmpeg.org/releases/ffmpeg-3.2.tar.bz2
commands:
ffmpeg_install:
cwd: /usr/local/src/ffmpeg-3.2
command: sudo ./configure --prefix=/usr && make && make installI need to install libmp3lame however. I’ve tried to do this with an
--enable-libmp3lame
flag and the directions here. The modified script :packages:
yum:
autoconf: []
automake: []
cmake: []
freetype-devel: []
gcc: []
gcc-c++: []
git: []
libtool: []
make: []
nasm: []
pkgconfig: []
zlib-devel: []
sources:
/usr/local/src: http://ffmpeg.org/releases/ffmpeg-3.2.tar.bz2
commands:
01-install_libmp3lame:
cwd: /usr/local/src/
command: curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz && tar xzvf lame-3.99.5.tar.gz && cd lame-3.99.5 && ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm && make && make install
02-ffmpeg_install:
cwd: /usr/local/src/ffmpeg-3.2
command: sudo ./configure --enable-libmp3lame && --prefix=/usr && make && make installThis doesn’t work. Command
01-install_libmp3lame
completes. Command 02-ffmpeg_install fails because :[2017-10-12T20:55:19.324Z] INFO [24606] - [Application update app-8fe3-123456_7895@111/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild/prebuild_3_clover_platform/Command 02-ffmpeg_install] : Activity execution failed, because: ERROR: libmp3lame >= 3.98.3 not found
I have tried installing libmp3lame in /ffmpeg-3.2 and got the same issue.