
Recherche avancée
Autres articles (55)
-
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 (...) -
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 (...) -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...)
Sur d’autres sites (5874)
-
How to load font in ffmpeg through google font [duplicate]
21 octobre 2020, par Konduri Sai Adityahow to load font file in FFmpeg through web google font ?. I tried to use google font in the cmd, but it seems telling that no web font found. can anyone tell me whether we can load font through google font URL


ffmpeg -i test.png -i sample1.mp4 -y -filter_complex "[1:v]scale=1230:692[scale1];[scale1]rotate=0:c=black@0:ow=rotw(0):oh=roth(0)[rotate0];[0:v][rotate0]overlay=333.61:172.85[mediaoverlayout0];color=black@0:959x137[c1];[c1]setsar=1,drawtext=fontfile='http://fonts.gstatic.com/s/opensans/v18/mem8YaGs126MiZpBA-U1UpcaXcl0Aw.ttf':text='Double click to edit':fontsize=121.19999999999999:fontcolor=#1e8bc3:line_spacing=16.916000000000007,rotate=0:ow=rotw(0):oh=roth(0):c=black@0[rottext1];[mediaoverlayout0][rottext1]overlay=x=207.52:y=271.076:shortest=1" -pix_fmt yuv420p -t 10 ok1.mp4 



Below are logs


built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndi
o --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-lib
ass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --e
nable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-l
ibvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzvbi --enable
-libzimg
 libavutil 56. 22.100 / 56. 22.100
 libavcodec 58. 35.100 / 58. 35.100
 libavformat 58. 20.100 / 58. 20.100
 libavdevice 58. 5.100 / 58. 5.100
 libavfilter 7. 40.101 / 7. 40.101
 libswscale 5. 3.100 / 5. 3.100
 libswresample 3. 3.100 / 3. 3.100
 libpostproc 55. 3.100 / 55. 3.100
Input #0, png_pipe, from 'storage/test.png':
 Duration: N/A, bitrate: N/A
 Stream #0:0: Video: png, 1 reference frame, rgba(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
[h264 @ 0x59749c0] Reinit context to 1920x1088, pix_fmt: yuv420p
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'storage/sample1.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.17.101
 Duration: 00:00:08.12, start: 0.000000, bitrate: 820 kb/s
 Stream #1:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1920x1080 (1920x1088), 578 kb/s, 25 fps, 25 
tbr, 12800 tbn, 50 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
 Metadata:
 handler_name : #Mainconcept MP4 Sound Media Handler
-y: No such file or directory
[AVIOContext @ 0x597a480] Statistics: 10601 bytes read, 0 seeks
[AVIOContext @ 0x597a040] Statistics: 156922 bytes read, 2 seeks



-
Calling ffmpeg from command line does not wait until file was fully written do hard drive
10 octobre 2020, par Stefan FalkI am currently working on a service to allower conversion of audio files. I am using
ffmpeg
under the hood and use theRuntime
in order to make the call.

After the call I read the converted file and upload it to a cloud storage.


The problem :


The problem is, that reading the file back from the drive gives me only a few bytes. After investigating, it actually has like 5 MB on the drive but
readFileToByArray()
reads only a few kb. I assume this is because the file was not completely persisted at the point where I want to read it back.

Is there any way I can make sure that
ffmpeg
is done writing to the hard drive ? It seems that the main process thatffmpeg
was running in finishes before a parallel process that is responsible for writing. Maybe ?

Below is the relevant code that converts an arbitrary file to AAC-format :


File tempFile = File.createTempFile("input-", ".tmp", new File("/tmp"));
OutputStream outStream = new FileOutputStream(tempFile);
outStream.write(bytes);

String convertedFilePath = String.format("/tmp/output-%s.aac", UUID.randomUUID().toString());

String command = String.format(
 "ffmpeg -i %s -c:a aac -b:a 256k %s",
 tempFile.getAbsolutePath(),
 convertedFilePath
);

LOGGER.debug(String.format("Converting file to AAC; Running %s", command));

Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(command);
try {
 process.waitFor(200, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
 throw new RuntimeException("Time out");
}

File convertedFile = new File(convertedFilePath);
byte[] result = FileUtils.readFileToByteArray(convertedFile);

// Upload "result" to cloud storage ..



-
Upload screenshots to google cloud storage bucket with Fluent-ffmpeg
2 janvier 2021, par aarpodsI am currently using multer to upload videos to my google storage bucket, and fluent-ffmpeg to capture thumbnails of the videos. Videos are being uploaded into the buckets correctly, but not the thumbnails from ffmpeg. How can I change the location of the thumbnails to my google storage bucket ?


Back-End Video upload


require ('dotenv').config()
const express = require('express');
const router = express.Router();
const multer = require("multer");
var ffmpeg = require('fluent-ffmpeg');
const multerGoogleStorage = require('multer-google-storage');
const { Video } = require("../models/Video");
const {User} = require("../models/User")
const { auth } = require("../middleware/auth");


var storage = multer({
 destination: function (req, file, cb) {
 cb(null, 'videos/')
 },
 filename: function (req, file, cb) {
 cb(null, `${Date.now()}_${file.originalname}`)
 },
 fileFilter: (req, file, cb) => {
 const ext = path.extname(file.originalname)
 if (ext !== '.mp4' || ext !== '.mov' || ext !== '.m3u' || ext !== '.flv' || ext !== '.avi' || ext !== '.mkv') {
 return cb(res.status(400).end('Error only videos can be uploaded'), false);
 }
 cb(null,true)
 }
})
// Set location to google storage bucket
var upload = multer({ storage: multerGoogleStorage.storageEngine() }).single("file")

router.post("/uploadfiles", (req, res) => {

 upload(req, res, err => {
 if (err) {
 return res.json({sucess: false, err})
 }
 return res.json({ success: true, filePath: res.req.file.path, fileName: res.req.file.filename})
 })
});



Back-end thumbnail upload


router.post("/thumbnail", (req, res) => {

 let thumbsFilePath = "";
 let fileDuration = "";

 ffmpeg.ffprobe(req.body.filePath, function (err, metadata) {
 console.dir(metadata);
 console.log(metadata.format.duration);

 fileDuration = metadata.format.duration;
 })


 ffmpeg(req.body.filePath)
 .on('filenames', function (filenames) {
 console.log('Will generate ' + filenames.join(', '))
 thumbsFilePath = "thumbnails/" + filenames[0];
 })
 .on('end', function () {
 console.log('Screenshots taken');
 return res.json({ success: true, thumbsFilePath: thumbsFilePath, fileDuration: fileDuration })
 })
 //Can this be uploaded to google storage?
 .screenshots({
 // Will take 3 screenshots
 count: 3,
 folder: '/thumbnails/',
 size: '320x240',
 //Names file w/o extension
 filename:'thumbnail-%b.png'
 });
});



Front-end video upload


const onDrop = (files) => {
 let formData = new FormData();
 const config = {
 header: {'content-type': 'multipart/form-data'}
 }
 console.log(files)
 formData.append("file", files[0])

 axios.post('/api/video/uploadfiles', formData, config)
 .then(response => {
 if (response.data.success) {
 let variable = {
 filePath: response.data.filePath,
 fileName: response.data.fileName
 }
 setFilePath(response.data.filePath)

 //Thumbnail
 axios.post('/api/video/thumbnail', variable)
 .then(response => {
 if (response.data.success) {
 setDuration(response.data.fileDuration)
 setThumbnail(response.data.thumbsFilePath)
 } else {
 alert("Failed to generate a thumbnail");
 }
 })

 } else {
 alert('Failed to save video to the server')
 }
 })
 }