
Recherche avancée
Médias (2)
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
Autres articles (47)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Contribute to documentation
13 avril 2011Documentation is vital to the development of improved technical capabilities.
MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
To contribute, register to the project users’ mailing (...)
Sur d’autres sites (7547)
-
Passing streams from Fluent-ffmpeg to Google Cloud Storage
31 octobre 2019, par Emilio FariaIs there a way to pass a stream from Fluent-mmpeg to Google Cloud Storage ? I’m trying to allow the user to upload any kind of media (audio or video), and I want to convert it to flac before uploading it to GCS.
I’m using a few middlewares on my route, such as :
routes.post(
'/upload',
multer.single('audio'),
ConvertController.convert,
UploadController.upload,
FileController.save,
(req, res, next) => res.send('ok')
);I was able to stream from Multer to Fluent-mmpeg and save to a file using this code on ConvertController :
async convert(req, res, next) {
ffmpeg(streamifier.createReadStream(req.file.buffer))
.format('flac')
.output('outputfile.flac')
.audioChannels(1)
.on('progress', function(progress) {
console.log(progress);
})
.run();
}But I would like to use .pipe() to pass it to UploadController, where I would then upload to GCS :
class UploadController {
async upload(req, res, next) {
const gcsHelpers = require('../helpers/google-cloud-storage');
const { storage } = gcsHelpers;
const DEFAULT_BUCKET_NAME = 'my-bucket-name';
const bucketName = DEFAULT_BUCKET_NAME;
const bucket = storage.bucket(bucketName);
const fileName = `test.flac`;
const newFile = bucket.file(fileName);
newFile.createWriteStream({
metadata: {
contentType: file.mimetype
}
})
file.on('error', err => {
throw err;
});
file.on('finish', () => console.log('finished'));
}The problem is that I cannot find anywhere explaining how I can pass down a stream to the next middleware.
Is it possible ?
-
AWS Lambda for generate thumbnail save empty file
30 octobre 2019, par MilouselI need to create aws lambda for creating thumbnail from video by using ffmpeg, which is saved on S3 and this thumbnail saved into S3 too.
I downloaded ffmpeg from https://johnvansickle.com/ffmpeg/ page, set ffmpeg into nodejs file and send it into .zip. From this zip file I created ffmpeg layer. After that I connect my lambda with this ffmpeg layer. When I test it I receive Success response, but I save empty file (0 B size) into S3.
const AWS = require("aws-sdk");
const { spawn } = require("child_process");
const { createReadStream, createWriteStream } = require("fs");
const s3 = new AWS.S3();
const ffmpegPath = "/opt/nodejs/ffmpeg";
const allowedTypes = ["mov", "mpg", "mpeg", "mp4", "wmv", "avi", "webm"];
const width = process.env.WIDTH;
const height = process.env.HEIGHT;
module.exports.handler = async (event, context) => {
const srcKey = "test/0255f240-efef-11e9-862e-3949600f0ec9.mp4";
const bucket = "video.devel.abc.com";
const target = s3.getSignedUrl("getObject", {
Bucket: bucket,
Key: srcKey,
Expires: 1000
});
let fileType = "mp4";
console.log("srcKey: " + srcKey);
console.log("bucket: " + bucket);
console.log("target: " + target);
if (!fileType) {
throw new Error(`invalid file type found for key: ${srcKey}`);
}
if (allowedTypes.indexOf(fileType) === -1) {
throw new Error(`filetype: ${fileType} is not an allowed type`);
}
function createImage(seek) {
return new Promise((resolve, reject) => {
let tmpFile = createWriteStream(`/tmp/screenshot.jpg`);
const ffmpeg = spawn(ffmpegPath, [
"-ss",
seek,
"-i",
target,
"-vf",
`thumbnail,scale=${width}:${height}`,
"-qscale:v",
"2",
"-frames:v",
"1",
"-f",
"image2",
"-c:v",
"mjpeg",
"pipe:1"
]);
ffmpeg.stdout.pipe(tmpFile);
ffmpeg.on("close", function(code) {
console.log('code: ' + code);
tmpFile.end();
resolve();
});
ffmpeg.on("error", function(err) {
console.log(err);
reject();
});
});
}
function uploadToS3() {
return new Promise((resolve, reject) => {
let tmpFile = createReadStream(`/tmp/screenshot.jpg`);
let dstKey = srcKey
.replace(/\.\w+$/, `.jpg`)
.replace("test/", "test/shots/");
//const screensFile = "test/shots/";
console.log("dstKey: " + dstKey);
var params = {
Bucket: bucket,
Key: dstKey,
Body: tmpFile,
ContentType: `image/jpg`
};
s3.upload(params, function(err, data) {
if (err) {
console.log(err);
reject();
}
console.log(`successful upload to ${bucket}/${dstKey}`);
resolve();
});
});
}
await createImage(1);
await uploadToS3();
return console.log(`processed ${bucket}/${srcKey} successfully`);
};When I test it I receive these logs :
- srcKey : test/0255f240-efef-11e9-862e-3949600f0ec9.mp4
- bucket : video.devel.abc.com
- INFO processed video.devel.abc.com successfully
- code : 1
- bucket : video.devel.abc.com
- dstKey : test/shots/0255f240-efef-11e9-862e-3949600f0ec9.jpg
- successful upload to video.devel.abc.com/test/shots/0255f240-efef-11e9-862e-3949600f0ec9.jpg
- processed video.devel.abc.com/test/0255f240-efef-11e9-862e-3949600f0ec9.mp4 successfully
So file is really created, but it is empty (size is 0 B), which is not ideal.
-
FFmpeg raw video size parameter
3 novembre 2019, par Yanick SalzmannI am using libavformat in my library to read a stream of raw i420 images and transform them into an mp4 video. I’ve found CLI commands that perform this but since I am using the library in my program I need to reconstruct the same thing.
Currently the code that is having a problem is looking like this :
const auto raw_format = av_find_input_format("rawvideo");
if (raw_format == nullptr) {
log->error("Could not find RAW input parser in FFmpeg");
throw std::runtime_error("RAW not found");
}
_format_context->pb = _io_context.get();
AVDictionary *input_options = nullptr;
av_dict_set(&input_options, "framerate", std::to_string(fps).c_str(), 0);
av_dict_set(&input_options, "pix_fmt", "yuv420p", 0);
av_dict_set(&input_options, "s:v", fmt::format("{}x{}", width, height).c_str(), 0);
av_dict_set(&input_options, "size", fmt::format("{}x{}", width, height).c_str(), 0);
auto formatPtr = _format_context.get();
auto res = avformat_open_input(&formatPtr, "(memory file)", raw_format, &input_options);Finding the
rawvideo
is no problem, but it fails inavformat_open_input
with the error :[2019-11-03 15:03:22.953] [11599:11663] [ffmpeg] [error] Picture size 0x0 is invalid
I assumed the sizes are something I can insert using the input options, since in the CLI version it is passed using
-s:v 1920x1080
, however this does not seem to be true.Where do I have to specify the dimensions of my raw input stream ?