
Recherche avancée
Autres articles (84)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
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 -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)
Sur d’autres sites (10282)
-
Struggling getting FFMPEG to work on Lambda function (Serverless Framework)
3 juin 2022, par Red VicI've been trying to get FFMPEG to work on my serverless framework for hours and I can't get to grasp how all this should work.


This is my JavaScript code in the handler (just for testing purposes) :


require("dotenv").config();

const ffmpegSync = (url) => {
 const ffmpeg = require("fluent-ffmpeg");
 ffmpeg.setFfprobePath("/opt/ffmpeg-layer/ffprobe");
 ffmpeg.setFfmpegPath("/opt/ffmpeg-layer/ffmpeg")

 return new Promise((resolve, reject) => {
 ffmpeg.ffprobe(url, async (err, metadata) => {
 if (err) {
 resolve(err);
 }
 console.log(metadata);
 resolve(metadata);
 });
 });
};

const ffmpegTeller = async (e, context) => {
 const AWS = require("aws-sdk");

 const s3 = new AWS.S3();
 AWS.config.update({
 accessKeyId: process.env.AWS_ACCESS_KEY,
 secretAccessKey: process.env.AWS_SECRET_KEY,
 region: "us-east-1",
 });

 const sourceBucket = e["Records"][0]["s3"]["bucket"]["name"];
 const sourceKey = e["Records"][0]["s3"]["object"]["key"];
 const signedUrlExpireSeconds = 60 * 5;

 const url = s3.getSignedUrl("getObject", {
 Bucket: sourceBucket,
 Key: sourceKey,
 Expires: signedUrlExpireSeconds,
 });

 await ffmpegSync(url).then((data) => {
 console.log(data);
 return {
 body: JSON.stringify(data),
 statusCode: 200,
 };
 });
};

module.exports = {
 ffmpegTeller,
};



serverless.yaml :


service: my-ffmpeg-api
frameworkVersion: '3'

provider:
 name: aws
 runtime: nodejs14.x
 region: us-east-1

functions:
 ffmpegTeller:
 handler: handler.ffmpegTeller
 events: 
 - s3:
 bucket: sourceBucket
 event: s3:ObjectCreated:*



package.json


{
 "dependencies": {
 "dotenv": "^16.0.1",
 "fluent-ffmpeg": "^2.1.2"
 }
}



The error I'm getting on CloudWatch when trying to use FFprobe



This is the view on the Lambda function page on AWS :




I'd really appreciate some help. I'm really going mad. Thanks in advance.


-
fluent-ffmpeg and ffmpeg-concat not cutting and merging video in Docker container
10 septembre 2021, par Keval savaniI am using react-media-recorder to record the video on ReactJS application which further sends to my NodeJS backend to cut and contact/merge video using fluent-ffmpeg and ffmpeg-concat, before merging the video I am making all the uploaded video to same size
640x360
.

NodeJS code to cut the video and make the same size
640x360
before merging, also added padding to keep the consistency of video ratio.

const allCutVideos = await Promise.all(convertVideoList.map(async (row) => {

 return await new Promise((resolve) => {

 ffmpeg(row.uploadedFile)
 .setStartTime(row.startTime)
 .setDuration(row.endTime)
 .size("640x360")
 .autopad()
 .withAudioCodec('copy')
 .on("start", function (commandLine) {
 console.log("Spawned FFmpeg with command: " + commandLine);
 })
 .on("error", function (err) {
 resolve({ ...row, status: false, message: err.message })
 })
 .on("end", function (err) {
 if (!err) {
 resolve({ ...row, status: true });
 }
 })
 .output(row.outputPath)
 .run();

 });

}));



Once I get all the video(recorded video or any mp4 which are downloaded from internet) from the above promises, I am merging it using
ffmpeg-concat
, below is the code

const contactVideoList = allCutVideos.map(row => row.status === true ? row.outputPath : null).filter(row => row);
await ContactVideos({
 output: "/app/folder/tmp/output.mp4",
 videos: contactVideoList,
 transition: {
 name: 'directionalWipe',
 duration: 500
 }
});



Here is my Dockerfile


FROM node:14
RUN mkdir /opt/prod_api
WORKDIR /opt/prod_api

RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y ffmpeg

COPY . .

RUN chmod 777 -R /opt

ENTRYPOINT ["/opt/prod_api/entrypoint.sh"]
EXPOSE 8080



On my local the above process working as expected (using
macOS
), I do not get any error while performing.

When I tried the same code using
Dockerfile
I get the below problems.

Problem 1 : I am cutting video with
fluent-ffmpeg
which is recorded throughreact-media-recorder
, I get errorTypeError: Cannot destructure property 'width' of 'scenes[0]' as it is undefined.
, and here is full ffmpeg command, here I am getting error while cutting and resizing video.

ffmpeg -ss 0 -i /opt/prod_api/assets/tmp/6b7286081d/3fb0e15881097c1aa93f8393f863e79.mp4 -y -acodec copy -filter:v scale=w='if(gt(a,1.7777777777777777),640,trunc(360*a/2)*2)':h='if(lt(a,1.7777777777777777),360,trunc(640/a/2)*2)',pad=w=640:h=360:x='if(gt(a,1.7777777777777777),0,(640-iw)/2)':y='if(lt(a,1.7777777777777777),0,(360-ih)/2)':color=black -t 12.23 /opt/prod_api/assets/tmp/6b7286081d/9b6e5551011d120289b906abd2f2b69_output.mp4



Problem 2 : After uploading any
mp4
video which is download from the internet I do get another error while performing an action usingffmpeg-concat
. Error -Failed to create OpenGL context. Please see https://github.com/stackgl/headless-gl#supported-platforms-and-nodejs-versions for compatibility. failed to create OpenGL context.
(here in this case I do not get any error while performingfluent-ffmpeg
)

Am I missing any steps in
Dockerfile
? Everything works fine in my local but getting the above problems inDocker container
. Any help would be appreciated, thank you in advance.

-
How can I schedule a YouTube livestream entirely from Linux ?
25 avril 2021, par Dale WellmanI have a setup on a Raspberry Pi (with its native camera) that uses a cronjob to start an ffmpeg session with its output streaming to YouTube. I re-use the same stream key each time, which is written into my ffmpeg scripts. This all works perfectly each week, automatically starting and stopping at the desired time.
However, each week PRIOR to that livestream, I have to "manually" go into YouTube Studio and "schedule" a new future event. This is easy enough, since it lets me "reuse" previous settings — all I have to change is the Title, date, and time. But I would love to figure out a way to automate that part of the process, as well. I assume it involves using the YouTube Data API, but I'm not well versed in API's, JSON, etc.
(I do have a strong Linux background, bash scripting skills, and general programming background.)


My final solution just needs to :


- 

- create the new scheduled event (maybe 12 hours prior to going live), with Title, Date, Time, "Unlisted" status, category, and so forth — all the usual settings I do manually within Studio
- retrieve the assigned URL for the upcoming stream (my script will then email that to me)






So, basically, I'm asking for help getting started with the API, or whatever method is capable of doing this. I would prefer to code it on the same Pi that does the ffmpeg encoding (although in a pinch, I could create the schedule from another computer, even Windows). Any examples would be great.


So far, all I have done is create my Google project, enable the YouTube Data API in the project, and create my API key. But I'm not sure where to go from there.