
Recherche avancée
Autres articles (52)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)
Sur d’autres sites (6219)
-
PHP shell_exec wait for script to done ? [duplicate]
6 mars 2016, par Melih BüyükbayramThis question already has an answer here :
I have a PHP script that queries a database for a list of jobs to be done and fires off other PHP scripts based on what it finds in the database (basically a process queue).
Some of the scripts that the queue runner script executes may take 30 seconds or so to finish running (convert video, resizing images, etc).
The problem is that shell_exec() in the queue runner script calls the processing scripts, but then doesn’t wait for them to finish, resulting in the queue not being completed.
Queue runner script :
#!/usr/bin/php
<?php
// Loop through database and find jobs to be done
shell_exec("nohup $command > /dev/null 2> /dev/null & echo $! &");
?>Running the job script directly from the command line works and the PDF is created.
Any ideas on how to fix this ? Or a better way to run a process queue ?
-
How to upload a transcoded file to s3 and create a link to download it
29 septembre 2022, par Dotun LongeI want to download a video after my module "creates" it by combining a picture and audio file. The output goes to my tmp folder. This works, but I don't know how to access it.


My method is to create another Paperclip attachment called "converted" and the module responsible for transcoding should also be responsible for uploading the converted video to a bucket, where I can then access it via
@upload.converted.url
.

I have no idea how to go about this, and my eyes hurt from searching. If you have a better way for me to be able to download the transcoded video without this option, I will be open to it.


# videocreatingproccessor.rb

require 'streamio-ffmpeg'
require 'fileutils'

module VideoCreatingProcessor
 def self.convert_to_video (path_to_audio_file, path_to_image_file)
 movie = FFMPEG::Movie.new(path_to_audio_file)
 options = {
 video_codec: "libx264",
 frame_rate: 60,
 resolution: "960x720",
 x264_vprofile: "high",
 x264_preset: "slow",
 pixel_format: "720p",
 audio_codec: "libfaac",
 audio_bitrate: 32,
 audio_sample_rate: 44100,
 audio_channels: 2,
 threads: 2,
 }

 woptions = { watermark: path_to_image_file, resolution: "960x720", watermark_filter: { padding_x: 10, padding_y: 10 } }

 movie.transcode("tmp/output.mp4",woptions ,options )
 end
end



# uploads_controller.rb

class UploadsController < ApplicationController
 before_action :set_upload, only: [:show, :edit, :update, :destroy]

 def index
 @uploads = Upload.all
 end

 def paudioaddress
 "https:" + @upload.audio.url
 end

 def pimageaddress
 "https:" + @upload.image.url
 end

 def show
 require "video_creating_processor"
 newvideo = VideoCreatingProcessor.convert_to_video(paudioaddress, pimageaddress)
 end

 # ....
end



-
download and fill file on fly
4 mai 2017, par Gianluca CalabriaI’m trying to create a service for a client which takes some audio chunks and concatenate them. For this I’m using FFmpeg. The user should also be able to download the result on the fly without waiting for the conversion/concatenation to finish. The idea is to "fill" the file as the process goes on. I cannot work my way around it, is it possible to do ? I’m using a RESTful service which calls a class like this one
public ReadableRepresentation serveDownloadRequest(Representation entity) throws SystemInitializationException {
InputStreamChannel inputStreamChannel;
Form reqParameters=getQuery();
try {
String parameters = readStringParameter(reqParameters, AudioCutAndJoinParameters.PARAMETERS, AudioCutAndJoinParameters.PARAMETERS_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.PARAMETERS + "=" + parameters);
String inputUri = readStringParameter(reqParameters, AudioCutAndJoinParameters.INPUT_URI, AudioCutAndJoinParameters.INPUT_URI_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.INPUT_URI + "=" + inputUri);
String markInRelative = readStringParameter(reqParameters, AudioCutAndJoinParameters.MARKIN_ID_RELATIVE, AudioCutAndJoinParameters.MARKIN_ID_RELATIVE_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.MARKIN_ID_RELATIVE + "=" + markInRelative);
String parametersString = readStringParameter(reqParameters, AudioCutAndJoinParameters.PARAMETERS_STRING, AudioCutAndJoinParameters.PARAMETERS_STRING_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.PARAMETERS_STRING + "=" + parametersString);
String cmdFolder = readStringParameter(reqParameters, AudioCutAndJoinParameters.COMMAND_FOLDER, AudioCutAndJoinParameters.COMMAND_FOLDER_MANDATORY);
trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.COMMAND_FOLDER + "=" + cmdFolder);
Map markInIdRelativeMap=JsonEntityManager.getInstance().deserializeMap(markInRelative);
Map parametersMap=JsonEntityManager.getInstance().deserializeMap(parameters);
List <string> InputUri= JsonEntityManager.getInstance().deserializeList(inputUri);
InputStream transcodeOutput = Services.getInstance().runAudioCutAndJoin(parametersMap,markInIdRelativeMap,InputUri,parametersString,cmdFolder);
inputStreamChannel = new InputStreamChannel(transcodeOutput);
ReadableRepresentation result = new ReadableRepresentation(inputStreamChannel, MediaType.AUDIO_ALL);
Disposition disp = new Disposition(Disposition.TYPE_ATTACHMENT);
disp.setFilename("test-cut.wav");
result.setDisposition(disp);
return result;
</string>I’m using the
process.getInputStream()
as return of myrunAudioCutAndJoin
but no download happens until the process of conversion/concatenation is done. Can somebody please help me out ?