
Recherche avancée
Médias (3)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (96)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
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
Sur d’autres sites (5237)
-
FFmpeg recorded video is dark with Xvfb and chrome headless on Centos 7
15 juin 2023, par narsy4I am trying to do a video recording of headless chrome session on Centos 7 (Amazon EC2 instance) using ffmpeg. I have installed ffmpeg, Xvfb and google chrome on the machine. I started Xvfb on :99, verified the display using xdpyinfo and started chrome. However when I run the ffmpeg cmd to capture the video (no errors in ffmpeg debug logs), the output is dark with a X sign in the centre of video screen. What am I doing wrong here ? Any help is appreciated.


**Xvfb and chrome commands**
Xvfb :99 -screen 0 1920x1080x24 &
export DISPLAY=:99
google-chrome --headless --disable-gpu --no-sandbox --start-maximized --window-size=1920x1080 https://www.google.com




**FFmpeg command**
ffmpeg -video_size 1920x1080 -framerate 30 -f x11grab -i :99 -loglevel debug -pix_fmt yuv420p /tmp/video.mp4






Searched for and read a few threads on this, but couldn't get it to work.


-
Encoding audio_common messages to OPUS
14 juin 2023, par djangbahevans

I am trying to stream microphone and camera data to Amazon KVS WebRTC. I'm able to make video work using this package (adapted for noetic) however I am struggling to make audio work. I'm using the audio_capture package to get mp3 frames. I'm trying to convert this to OPUS frames before streaming to KVS, but I'm unsure how to do this. I wrote this bit of code based on the small resources I can find on using ffmpeg, but it's not working.
avcodec_fill_audio_frame
is returning -22.

#include "opus_encoder.h"

OPUSEncoder::OPUSEncoder() {
 av_register_all();
 codecContext == nullptr;
}

OPUSEncoder::~OPUSEncoder() {
 if (codecContext != nullptr) {
 avcodec_free_context(&codecContext);
 }
}

int OPUSEncoder::Initialize(int Fs, int channels) {
 AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_OPUS);
 if (!codec) {
 printf("Codec not found\n");
 return -1;
 }

 codecContext = avcodec_alloc_context3(codec);
 if (!codecContext) {
 printf("Could not allocate audio codec context\n");
 return -1;
 }

 codecContext->sample_fmt = AV_SAMPLE_FMT_S16;
 codecContext->bit_rate = 128000;
 codecContext->sample_rate = Fs;
 codecContext->channel_layout = av_get_default_channel_layout(channels);
 codecContext->channels = channels;

 if (avcodec_open2(codecContext, codec, nullptr) < 0) {
 printf("Could not open codec\n");
 return -1;
 }

 return 0;
}

int OPUSEncoder::Encode(const uint8_t *audio_data, int frameSize,
 uint8_t *out) {
 AVPacket pkt;
 av_init_packet(&pkt);
 pkt.data = nullptr;
 pkt.size = 0;

 AVFrame *frame = av_frame_alloc();
 frame->nb_samples = frameSize;
 frame->format = codecContext->sample_fmt;
 frame->channel_layout = codecContext->channel_layout;

 int ret = avcodec_fill_audio_frame(frame, codecContext->channels,
 codecContext->sample_fmt, audio_data,
 frameSize * 2, 0);
 if (ret < 0) {
 printf("Error filling audio frame: %d\n", ret);
 return -1;
 }

 ret = avcodec_send_frame(codecContext, frame);
 if (ret < 0) {
 printf("Error sending the frame to the encoder\n");
 return -1;
 }

 while (ret >= 0) {
 ret = avcodec_receive_packet(codecContext, &pkt);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
 return 0;
 } else if (ret < 0) {
 printf("Error encoding audio frame\n");
 return -1;
 }

 memcpy(out, pkt.data, pkt.size);
 out += pkt.size;
 av_packet_unref(&pkt);
 }

 av_frame_free(&frame);

 return 0;
}



-
AWS Lambda in Node JS with FFMPEG Lambda Layer
29 mars 2023, par mwcwge23I'm trying to make a Lambda that takes a video and puts a watermark image on it.
I'm using Lambda with NodeJS and FFMPEG Lambda Layer I took from here :
https://serverlessrepo.aws.amazon.com/applications/us-east-1/145266761615/ffmpeg-lambda-layer


I got these two errors and I don't have a clue what do I did wrong :
errors


Please help me :)


(by the way, if you have an easier solution to put a watermark image on video that'll also be great)


That's my code (trying to put a watermark image on a video file) :


const express = require("express");
const childProcess = require("child_process");
const path = require("path");
const fs = require("fs");
const util = require("util");
const os = require("os");
const { fileURLToPath } = require("url");
const { v4: uuidv4 } = require("uuid");
const bodyParser = require("body-parser");
const awsServerlessExpressMiddleware = require("aws-serverless-express/middleware");
const AWS = require("aws-sdk");
const workdir = os.tmpdir();

const s3 = new AWS.S3();

// declare a new express app
const app = express();
app.use(bodyParser.json());
app.use(awsServerlessExpressMiddleware.eventContext());

// Enable CORS for all methods
app.use(function (req, res, next) {
 res.header("Access-Control-Allow-Origin", "*");
 res.header("Access-Control-Allow-Headers", "*");
 next();
});

const downloadFileFromS3 = function (bucket, fileKey, filePath) {
 "use strict";
 console.log("downloading", bucket, fileKey, filePath);
 return new Promise(function (resolve, reject) {
 const file = fs.createWriteStream(filePath),
 stream = s3
 .getObject({
 Bucket: bucket,
 Key: fileKey,
 })
 .createReadStream();
 stream.on("error", reject);
 file.on("error", reject);
 file.on("finish", function () {
 console.log("downloaded", bucket, fileKey);
 resolve(filePath);
 });
 stream.pipe(file);
 });
};

const uploadFileToS3 = function (bucket, fileKey, filePath, contentType) {
 "use strict";
 console.log("uploading", bucket, fileKey, filePath);
 return s3
 .upload({
 Bucket: bucket,
 Key: fileKey,
 Body: fs.createReadStream(filePath),
 ACL: "private",
 ContentType: contentType,
 })
 .promise();
};

const spawnPromise = function (command, argsarray, envOptions) {
 return new Promise((resolve, reject) => {
 console.log("executing", command, argsarray.join(" "));
 const childProc = childProcess.spawn(
 command,
 argsarray,
 envOptions || { env: process.env, cwd: process.cwd() }
 ),
 resultBuffers = [];
 childProc.stdout.on("data", (buffer) => {
 console.log(buffer.toString());
 resultBuffers.push(buffer);
 });
 childProc.stderr.on("data", (buffer) => console.error(buffer.toString()));
 childProc.on("exit", (code, signal) => {
 console.log(`${command} completed with ${code}:${signal}`);
 if (code || signal) {
 reject(`${command} failed with ${code || signal}`);
 } else {
 resolve(Buffer.concat(resultBuffers).toString().trim());
 }
 });
 });
};

app.post("/api/addWatermark", async (req, res) => {
 try {
 const bucketName = "bucketName ";
 const uniqeName = uuidv4() + Date.now();
 const outputPath = path.join(workdir, uniqeName + ".mp4");
 const key = "file_example_MP4_480_1_5MG.mp4";
 const localFilePath = path.join(workdir, key);
 const watermarkPngKey = "watermark.png";
 const watermarkLocalFilePath = path.join(workdir, watermarkPngKey);

 downloadFileFromS3(bucketName, key, localFilePath)
 .then(() => {
 downloadFileFromS3(bucketName, watermarkPngKey, watermarkLocalFilePath)
 .then(() => {
 fs.readFile(localFilePath, (err, data) => {
 if (!err && data) {
 console.log("successsss111");
 }
 });
 fs.readFile(watermarkLocalFilePath, (err, data) => {
 if (!err && data) {
 console.log("successsss222");
 }
 });

 fs.readFile(outputPath, (err, data) => {
 if (!err && data) {
 console.log("successsss3333");
 }
 });

 spawnPromise(
 "/opt/bin/ffmpeg",
 [
 "-i",
 localFilePath,
 "-i",
 watermarkLocalFilePath,
 "-filter_complex",
 `[1]format=rgba,colorchannelmixer=aa=0.5[logo];[0][logo]overlay=5:H-h-5:format=auto,format=yuv420p`,
 "-c:a",
 "copy",
 outputPath,
 ],
 { env: process.env, cwd: workdir }
 )
 .then(() => {
 uploadFileToS3(
 bucketName,
 uniqeName + ".mp4",
 outputPath,
 "mp4"
 );
 });
 });
 });
 } catch (err) {
 console.log({ err });
 res.json({ err });
 }
});

app.listen(8136, function () {
 console.log("App started");
});

module.exports = app;