
Recherche avancée
Médias (91)
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Lights in the Sky
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Head Down
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Echoplex
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Discipline
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Letting You
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (53)
-
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
Use, discuss, criticize
13 avril 2011, parTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users. -
MediaSPIP en mode privé (Intranet)
17 septembre 2013, parÀ partir de la version 0.3, un canal de MediaSPIP peut devenir privé, bloqué à toute personne non identifiée grâce au plugin "Intranet/extranet".
Le plugin Intranet/extranet, lorsqu’il est activé, permet de bloquer l’accès au canal à tout visiteur non identifié, l’empêchant d’accéder au contenu en le redirigeant systématiquement vers le formulaire d’identification.
Ce système peut être particulièrement utile pour certaines utilisations comme : Atelier de travail avec des enfants dont le contenu ne doit pas (...)
Sur d’autres sites (5220)
-
Why does File upload for moving image and Audio to tmp PHP folder work on Windows but only image upload portion works on Mac using MAMP ?
31 mai 2021, par YazdanSo according to my colleague who tested this on Windows says it works perfectly fine , but in my case when I use it on a Mac with MAMP for Moodle , the image files get uploaded to the correct destination folder without an issue whereas the audio files don't move from the tmp folder to the actual destination folder and to check if this was the case ... I just changed and gave a fixed path instead of
$fileTmpLoc
and the file made it to the correct destination. Sorry I know the first half of the code isn't the main issue but I still wanted to post the whole code so one could understand it easily, moreover I am just beginning to code so please "have a bit of patience with me" . Thanks in advance


// this file contains upload function 
// checks if the file exists in server
include("../db/database.php");
require_once(dirname(__FILE__) . '/../../../config.php');
global $IP;

$ajaxdata = $_POST['mediaUpload'];

$FILENAME = $ajaxdata[1];
$IMAGE=$ajaxdata[0];
// an array to check which category the media belongs too
$animal= array("bird","cat","dog","horse","sheep","cow","elephant","bear","giraffe","zebra");
$allowedExts = array("mp3","wav");
$temp = explode(".", $_FILES["audio"]["name"]);
$extension = end($temp);



$test = $_FILES["audio"]["type"]; 


if (
 $_FILES["audio"]["type"] == "audio/wav"||
 $_FILES["audio"]["type"] == "audio/mp3"||
 $_FILES["audio"]["type"] == "audio/mpeg"
 &&
 in_array($extension, $allowedExts)
 )
 {

 // if the name detected by object detection is present in the animal array
 // then initialize target path to animal database or to others
 if (in_array($FILENAME, $animal)) 
 { 
 $image_target_dir = "image_dir/";
 $audio_target_dir = "audio_dir/";
 } 
 else
 { 
 $image_target_dir = "other_image_dir/";
 $audio_target_dir = "other_audio_dir/";
 } 
 // Get file path
 
 $img = $IMAGE;
 // decode base64 image
 $img = str_replace('data:image/png;base64,', '', $img);
 $img = str_replace(' ', '+', $img);
 $image_data = base64_decode($img);

 //$extension = pathinfo( $_FILES["fileUpload"]["name"], PATHINFO_EXTENSION ); // jpg
 $image_extension = "png";
 $image_target_file =$image_target_dir . basename($FILENAME . "." . $image_extension);
 $image_file_upload = "http://localhost:8888/moodle310/blocks/testblock/classes/".$image_target_file;
 
 
 $audio_extension ="mp3";
 $audio_target_file= $audio_target_dir . basename($FILENAME. "." . $audio_extension) ;
 $audio_file_upload = "http://localhost:8888/moodle310/blocks/testblock/classes/".$audio_target_file;

 // file size limit
 if(($_FILES["audio"]["size"])<=51242880)
 {

 $fileName = $_FILES["audio"]["name"]; // The file name
 $fileTmpLoc = $_FILES["audio"]["tmp_name"]; // File in the PHP tmp folder
 $fileType = $_FILES["audio"]["type"]; // The type of file it is
 $fileSize = $_FILES["audio"]["size"]; // File size in bytes
 $fileErrorMsg = $_FILES["audio"]["error"]; // 0 for false... and 1 for true
 
 if (in_array($FILENAME, $animal)) 
 { 
 $sql = "INSERT INTO mdl_media_animal (animal_image_path,animal_name,animal_audio_path) VALUES ('$image_file_upload','$FILENAME','$audio_file_upload')";
 } else {
 $sql = "INSERT INTO mdl_media_others (others_image_path,others_name,others_audio_path) VALUES ('$image_file_upload','$FILENAME','$audio_file_upload')";
 }

 // if file exists
 if (file_exists($audio_target_file) || file_exists($image_target_file)) {
 echo "alert";
 } else {
 // write image file
 if (file_put_contents($image_target_file, $image_data) ) {
 // ffmpeg to write audio file
 $output = shell_exec("ffmpeg -i $fileTmpLoc -ab 160k -ac 2 -ar 44100 -vn $audio_target_file");
 echo $output;
 
 // $stmt = $conn->prepare($sql);
 $db = mysqli_connect("localhost", "root", "root", "moodle310"); 
 // echo $sql;
 if (!$db) {
 echo "nodb";
 die("Connection failed: " . mysqli_connect_error());
 }
 // echo"sucess";
 if(mysqli_query($db, $sql)){
 // if($stmt->execute()){
 echo $fileTmpLoc;
 echo "sucess"; 
 echo $output;
 }
 else {
 // echo "Error: " . $sql . "<br />" . mysqli_error($conn);
 echo "failed";
 }

 }else {
 echo "failed";
 }

 
 
 
 }
 
 // $test = "ffmpeg -i $outputfile -ab 160k -ac 2 -ar 44100 -vn bub.wav";
 } else
 {
 echo "File size exceeds 5 MB! Please try again!";
 }
}
else
{
 echo "PHP! Not a video! ";//.$extension." ".$_FILES["uploadimage"]["type"];
 }

?>



I am a student learning frontend but a project of mine requires a fair bit of backend. So forgive me if my question sounds silly.


What I meant by manually overriding it was creating another folder and a index.php file with
echo "hello"; $output = shell_exec("ffmpeg -i Elephant.mp3 -ab 160k -ac 2 -ar 44100 -vn bub.mp3"); echo $output;
so only yes in this caseElephant.mp3
was changed as the initial tmp path so in this case as suggested by Mr.CBroe the permissons shouldn't be an issue.

Okay I checked my
Apache_error.log
only to find out ffmpeg is indeed the culprit ... I had installedffmpeg
globally so I am not sure if it is an access problem but here is a snippet of the log

I checked my php logs and found out that
FFmpeg
is the culprit.
Attached is a short log file

[Mon May 31 18:11:33 2021] [notice] caught SIGTERM, shutting down
[Mon May 31 18:11:40 2021] [notice] Digest: generating secret for digest authentication ...
[Mon May 31 18:11:40 2021] [notice] Digest: done
[Mon May 31 18:11:40 2021] [notice] Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/1.0.2o PHP/7.2.10 configured -- resuming normal operations
sh: ffmpeg: command not found
sh: ffmpeg: command not found
sh: ffmpeg: command not found



-
Revision 6723e34224 : Merge "fix permissions on cpplint.py (0644->0755)" into experimental
4 mai 2013, par James ZernMerge "fix permissions on cpplint.py (0644->0755)" into experimental
-
"File doesn't exist" - streamio FFMPEG on screenshot after create method
3 mai 2013, par dodgerogers747I have videos being directly uploaded to S3 using Amazon's CORS configuration. Videos are uploaded via a dedicated S3 form, once they have been uploaded successfully the URL of the video is appended to the @video.file hidden_field via javascript and then the video saves.
I can't get this
after_save
method to work which takes a screenshot of the video and saves it to S3 via carrierwave after the video has been saved as a rails object. ( It was previously working using a carrierwave video upload instance )It errors out with
Errno::ENOENT - No such file or directory - the file 'http://bucket-name.s3.amazonaws.com/uploads/video/file/secure-random-hex/video_name.m4v' does not exist:
I have tried running this method as a class method to call it from the console but it always comes back with the same error, even though the video exists.My bucket is set to public, read and write. How come it doesn't think the file exists ?
If anyone needs more code just shout, thanks in advance.
application trace
Started POST "/videos" for 127.0.0.1 at 2013-05-03 10:48:07 -0700
Processing by VideosController#create as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"MAHxrVcmPDtVIMfDWZBwL0YnzaAaAe1PTGip5M4OVoY=", "video"=>{"user_id"=>"5", "file"=>"http://bucket-name.s3.amazonaws.com/uploads/video/file/secure-random-hex/video.m4v"}}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 5 LIMIT 1
(0.1ms) BEGIN
SQL (20.5ms) INSERT INTO `videos` (`created_at`, `file`, `question_id`, `screenshot`, `updated_at`, `user_id`) VALUES ('2013-05-03 17:48:07', 'http://teebox-network.s3.amazonaws.com/uploads/video/file/secure-random-hex/video.m4v', NULL, NULL, '2013-05-03 17:48:07', 5)
(44.0ms) ROLLBACK
Completed 500 Internal Server Error in 71ms
Errno::ENOENT - No such file or directory - the file 'http://teebox-network.s3.amazonaws.com/uploads/video/file/secure-random-hex/video.m4v' does not exist:
(gem) streamio-ffmpeg-0.9.0/lib/ffmpeg/movie.rb:10:in `initialize'
app/models/video.rb:25:in `new'
app/models/video.rb:25:in `take_screenshot'video.rb
attr_accessible :user_id, :question_id, :file, :screenshot
belongs_to :question
belongs_to :user
default_scope order('created_at DESC')
after_create :take_screenshot
mount_uploader :screenshot, ImageUploader
validates_presence_of :user_id, :file
def take_screenshot
FFMPEG.ffmpeg_binary = '/opt/local/bin/ffmpeg'
movie = FFMPEG::Movie.new("#{self.file}")
self.screenshot = movie.screenshot("#{Rails.root}/public/uploads/tmp/screenshots/#{File.basename(self.file)}.jpg", seek_time: 2 )
self.save!
endvideos/_form.html.erb
<form action="http://bucket-name.s3.amazonaws.com" data-remote="true" class="direct-upload" enctype="multipart/form-data" method="post">
<input type="hidden" />
<input type="hidden" value="ACCESS_KEY" />
<input type="hidden" value="public-read" />
<input type="hidden" />
<input type="hidden" />
<input type="hidden" value="201" />
<input type="file" />
</form>
<%= form_for @video, html: { multipart: true, id: "new_video" }, remote: true do |f| %>
<% if @video.errors.any? %>
<div>
<h2><%= pluralize(@video.errors.count, "error") %> prohibited this post from being saved:</h2>
<ul>
<% @video.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.hidden_field :user_id, value: current_user.id %>
<%= f.hidden_field :file %><br />
<% end %>ImageUploader
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
include Sprockets::Helpers::RailsHelper
include Sprockets::Helpers::IsolatedHelper
storage :fog
before :store, :remember_cache_id
after :store, :delete_tmp_dir
def cache_dir
Rails.root.join('public/uploads/tmp/')
end
def remember_cache_id(new_file)
@cache_id_was = cache_id
end
def delete_tmp_dir(new_file)
if @cache_id_was.present? && @cache_id_was =~ /\A[\d]{8}\-[\d]{4}\-[\d]+\-[\d]{4}\z/
FileUtils.rm_rf(File.join(root, cache_dir, @cache_id_was))
end
end
process resize_and_pad: [306, 150, '#000']
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def extension_white_list
%w(jpg)
# %w(ogg ogv 3gp mp4 m4v webm mov)
end