
Recherche avancée
Médias (1)
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
Autres articles (93)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Initialisation de MediaSPIP (préconfiguration)
20 février 2010, parLors de l’installation de MediaSPIP, celui-ci est préconfiguré pour les usages les plus fréquents.
Cette préconfiguration est réalisée par un plugin activé par défaut et non désactivable appelé MediaSPIP Init.
Ce plugin sert à préconfigurer de manière correcte chaque instance de MediaSPIP. Il doit donc être placé dans le dossier plugins-dist/ du site ou de la ferme pour être installé par défaut avant de pouvoir utiliser le site.
Dans un premier temps il active ou désactive des options de SPIP qui ne le (...)
Sur d’autres sites (6792)
-
FFMPEG Determine average color of an area of a video
12 novembre 2019, par Naved KhanI have a use case where I’d want to insert one of two watermarks - one designed for a dark-ish background, the other for a light background into a video. Let’s say that I’d want to do this on the top right corner of the video.
How do I determine the average color of the top right section of the video ? Post this, how do I determine which watermark to use by looking at the average color ?
I have a solution right now where I am taking equally spaced screenshots and then measuring the average color, but it’s excruciatingly slow, especially for longer videos.
# Calculate average color
black_distances = []
white_distances = []
movie = FFMPEG::Movie.new(video_file)
(0..movie.duration / 10).each do |second|
# extract a frame
filename = "tmp/watermark/#{SecureRandom.uuid}.jpg"
movie.screenshot filename.to_s, seek_time: second
# analyse frame for color distance
frame = MiniMagick::Image.open(filename)
frame.crop('20%x20%+80%+0')
frame.resize('1x1')
pixel = frame.get_pixels.flatten
distance_from_black = Math.sqrt(((black[0] - pixel[0])**2 + (black[1] - pixel[1])**2 + (black[2] - pixel[2])**2))
distance_from_white = Math.sqrt(((white[0] - pixel[0])**2 + (white[1] - pixel[1])**2 + (white[2] - pixel[2])**2))
black_distances.push distance_from_black
white_distances.push distance_from_white
File.delete(filename) if File.exist?(filename)
end
average_black_distance = black_distances.reduce(:+).to_f / black_distances.size
average_white_distance = white_distances.reduce(:+).to_f / white_distances.sizeI am also confused about how to use the resulting
average_black_distance
andaverage_white_distance
to determine which watermark to use. -
Is it possible to determine if a subtitle track is imaged based or text based with ffprobe
21 février 2021, par ShexI'm writing a script that burns subtitles into video files to prepare them for a personal stream I'm hosting. I'm having a hard time finding which type of subtitle is used in the file. I use ffprobe to get the files' information, and I can get stuff like the codec type, but I was wondering if there is a way to determine if a subtitle track is image based or text based. I can only think of getting a list of all possible codecs and match the codec type with this list but it would be very useful to have an info somewhere that can tell me "OK this is an image-based subtitle track", as when I burn I cannot use the same filters with ffmpeg to burn image vs. text subtitles.


-
Google Speech API - Is there a way to determine if the audio has human voice or not ?
20 décembre 2019, par stupid_smaI am making an audio filtering application at work that reads over hundreds of audio files and filters them. So, if the audio has human voice in it, it will accept it and if it does not- it will delete the audio file.
I am using ffmpeg to get the details of the audio and add other filters like size and duration and silence (though it is not very accurate in detecting silence for all audio files.)
My company asked me to try the Google Cloud Speech API to detect if the audio has any human voice in it.
So with this code, some audio files return a Transcript of spoken words in the audio file, but what I need is to determine if a human is speaking or not.
I have considered using hark.js for it but there does not seem to be enough documentation and I am short on time !
Ps. I am an intern and I’m just starting out with programming. I apologize if my question does not make sense or sounds dumb.
# Includes the autoloader for libraries installed with composer
require __DIR__ . '/vendor/autoload.php';
# Imports the Google Cloud client library
use Google\Cloud\Speech\V1\SpeechClient;
use Google\Cloud\Speech\V1\RecognitionAudio;
use Google\Cloud\Speech\V1\RecognitionConfig;
use Google\Cloud\Speech\V1\RecognitionConfig\AudioEncoding;
putenv('GOOGLE_APPLICATION_CREDENTIALS=../../credentials.json');
echo getcwd() . "<br />";
chdir('test-sounds');
echo getcwd() . "<br />";
echo shell_exec('ls -lr');
$fileList = glob('*');
foreach($fileList as $filename){
//echo $filename, '<br />';
# The name of the audio file to transcribe
$audioFile = __DIR__ . '/' . $filename;
# get contents of a file into a string
$content = file_get_contents($audioFile);
# set string as audio content
$audio = (new RecognitionAudio())
->setContent($content);
# The audio file's encoding, sample rate and language
$config = new RecognitionConfig([
'encoding' => AudioEncoding::LINEAR16,
'language_code' => 'ja-JP'
]);
# Instantiates a client
$client = new SpeechClient();
# Detects speech in the audio file
$response = $client->recognize($config, $audio);
# Print most likely transcription
foreach ($response->getResults() as $result) {
$alternatives = $result->getAlternatives();
$mostLikely = $alternatives[0];
$transcript = $mostLikely->getTranscript();
printf('<br />Transcript: %s' . PHP_EOL, $transcript . '<br />');
}
$client->close();
}
?> ```