
Recherche avancée
Autres articles (49)
-
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 (...) -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
Sur d’autres sites (6152)
-
C++ Boost launching FFMPEG doesnt work, working ok via terminal
21 juin 2023, par Pit DiggerI am launching an FFMPEG process from C++ , the command is workign fine from terminal command line, but gives error when laucnhed from code. What could cause this ?


Error


[AVFilterGraph @ 0x3cfadc0] Error parsing filterchain "[0:v]split=3[v1][v2][v3];[v1]copy[v1out];[v2]scale=w=1280:h=720[v2out];[v3]scale=w=640:h=360[v3out]"
 
[AVFilterGraph @ 0x2f9fb00] Error parsing filterchain 
 
[AVFilterGraph @ 0x3cfadc0] Trailing garbage after a filter: split=3[v1][v2][v3];[v1]copy[v1out];[v2]scale=w=1280:h=720[v2out];[v3]scale=w=640:h=360[v3out]



Code


std::vector args;
args.push_back("-i"); args.push_back("input.mp4");
args.push_back("-filter_complex");
args.push_back("\"[0:v]split=3[v1][v2][v3];[v1]copy[v1out];[v2]scale=w=1280:h=720[v2out];[v3]scale=w=640:h=360[v3out]\"");

args.push_back("-map"); args.push_back("[v1out]");
args.push_back("-c:v:0"); args.push_back("libx264");
args.push_back("-x264-params"); args.push_back("\"nal-hrd=cbr:force-cfr=1\"");
args.push_back("-b:v:0"); args.push_back("1M");
args.push_back("-maxrate:v:0"); args.push_back("2M");
args.push_back("-minrate:v:0"); args.push_back("2M");
args.push_back("-bufsize:v:0"); args.push_back("2M");
args.push_back("-preset"); args.push_back("fast");
args.push_back("-g"); args.push_back("48");
args.push_back("-sc_threshold"); args.push_back("0");
args.push_back("-keyint_min"); args.push_back("48");

args.push_back("-map"); args.push_back("[v2out]");
args.push_back("-c:v:1"); args.push_back("libx264");
args.push_back("-x264-params"); args.push_back("\"nal-hrd=cbr:force-cfr=1\"");
args.push_back("-b:v:1"); args.push_back("1M");
args.push_back("-maxrate:v:1"); args.push_back("1M");
args.push_back("-minrate:v:1"); args.push_back("1M");
args.push_back("-bufsize:v:1"); args.push_back("1M");
args.push_back("-preset"); args.push_back("fast");
args.push_back("-g"); args.push_back("48");
args.push_back("-sc_threshold"); args.push_back("0");
args.push_back("-keyint_min"); args.push_back("48");

args.push_back("-map"); args.push_back("[v3out]");
args.push_back("-c:v:2"); args.push_back("libx264");
args.push_back("-x264-params"); args.push_back("\"nal-hrd=cbr:force-cfr=1\"");
args.push_back("-b:v:2"); args.push_back("500K");
args.push_back("-maxrate:v:2"); args.push_back("500K");
args.push_back("-minrate:v:2"); args.push_back("500K");
args.push_back("-bufsize:v:2"); args.push_back("500K");
args.push_back("-preset"); args.push_back("fast");
args.push_back("-g"); args.push_back("48");
args.push_back("-sc_threshold"); args.push_back("0");
args.push_back("-keyint_min"); args.push_back("48");

args.push_back("-map"); args.push_back("a:0");
args.push_back("-c:a:0"); args.push_back("aac");
args.push_back("-b:a:0"); args.push_back("96k");
args.push_back("-ac"); args.push_back("2");
args.push_back("-map"); args.push_back("a:0");
args.push_back("-c:a:1"); args.push_back("aac");
args.push_back("-b:a:1"); args.push_back("96k");
args.push_back("-ac"); args.push_back("2");
args.push_back("-map"); args.push_back("a:0");
args.push_back("-c:a:2"); args.push_back("aac");
args.push_back("-b:a:2"); args.push_back("48k");
args.push_back("-ac"); args.push_back("2");

args.push_back("-avoid_negative_ts"); args.push_back("1");
args.push_back("-f"); args.push_back("hls");
args.push_back("-hls_time"); args.push_back("6");
args.push_back("-hls_list_size"); args.push_back("15");
args.push_back("-hls_flags"); args.push_back("independent_segments");
args.push_back("-hls_segment_type"); args.push_back("mpegts");
args.push_back("-hls_segment_filename"); args.push_back("/output/stream_%v_data%02d.ts");
args.push_back("-master_pl_name"); args.push_back("index.m3u8");
args.push_back("-var_stream_map"); args.push_back("\"v:0,a:0 v:1,a:1 v:2,a:2\"");
args.push_back("/output/stream_%v.m3u8");


m_childProcess = std::make_unique(
 bp::exe = ffmpegPath,
 bp::args = args);



Command that above code builds (indented for visibility) :


ffmpeg -i input.mp4 -c copy -filter_complex "[0:v]split=3[v1][v2][v3];[v1]copy[v1out];[v2]scale=w=1280:h=720[v2out];[v3]scale=w=640:h=360[v3out]" 
-map [v1out] -c:v:0 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:0 1M -maxrate:v:0 2M -minrate:v:0 2M -bufsize:v:0 2M -preset fast -g 48 -sc_threshold 0 -keyint_min 48 
-map [v2out] -c:v:1 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:1 1M -maxrate:v:1 1M -minrate:v:1 1M -bufsize:v:1 1M -preset fast -g 48 -sc_threshold 0 -keyint_min 48 
-map [v3out] -c:v:2 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:2 500K -maxrate:v:2 500K -minrate:v:2 500K -bufsize:v:2 500K -preset fast -g 48 -sc_threshold 0 -keyint_min 48 -map a:0 -c:a:0 aac -b:a:0 96k -ac 2 
-map a:0 -c:a:1 aac -b:a:1 96k -ac 2 -map a:0 -c:a:2 aac -b:a:2 48k -ac 2 
-avoid_negative_ts 1 -f hls -hls_time 6 -hls_list_size 15 -hls_flags independent_segments -hls_segment_type mpegts -hls_segment_filename /output/stream_%v_data%02d.ts -master_pl_name index.m3u8 -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" /output/stream_%v.m3u8



-
Reason for write EPIPE error in my implementation ?
25 mai 2019, par Chrisl446I currently have a small node.js express application for uploading images using sharp & thumbnails created from .mp4 videos using simple-thumbnail package/ffmpeg.
The app works perfectly when uploading an image, the file is uploaded sharp processes it, then passes it along and it ends up in my amazon s3 bucket as expected. No errors what so ever.
However, when I upload an mp4 video that I use to create and upload a thumbnail from by using simple-thumbnails genThumbnail() function, which uses ffmpeg child process, the thumbnail uploads successully to my s3 bucket, HOWEVER my app returns an EPIPE write error and NOT the url of the uploaded files url on S3.
What is causing this and how can I fix it, considering it’s pretty much working aside from the EPIPE error that is being returned ? Thanks ahead !
The packages of concern used are as follows :
multer-s3 <- this one with the transform option, not the standard multer-s3 package
const express = require('express');
const app = express();
const aws = require('aws-sdk');
const multer = require('multer');
const multerS3 = require('multer-s3'); //github:gmenih341/multer-s3 version of multer-s3 with transform option
const sharp = require('sharp');
const genThumbnail = require('simple-thumbnail');
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Orgin, X-Requested-With, Content-Type, Accept, Authorization');
if (req.method === 'OPTIONS') {
res.header('Access-Control-Allow-Methods', 'POST');
return res.status(200).json({});
}
next();
});
let uniqueFileName;
let s3BucketName = 'bucketname';
let s3 = new aws.S3({
accessKeyId: ACCESS_KEY,
secretAccessKey: SECRET_KEY,
Bucket: s3BucketName
});
let upload = multer({
storage: multerS3({
s3: s3,
bucket: s3BucketName,
acl: 'public-read',
cacheControl: 'max-age=31536000',
contentType: multerS3.AUTO_CONTENT_TYPE,
shouldTransform: true,
transforms: [{
id: 'thumbnail',
key: function (req, file, cb) {
uniqueFileName = Date.now().toString();
cb(null, uniqueFileName + '.jpg')
},
transform: function (req, file, cb) {
if (file.mimetype == 'video/mp4') {
//When using simple-thumbnails' getThumbnail() on an mp4 video it uploads succesfully to S3 but node returns EPIPE write error
cb(null, genThumbnail(null, null, '250x?'))
} else {
//When using sharp to resize an image this works perfectly and retuns the JSON below with the files S3 URL
cb(null, sharp().jpeg())
}
}
}]
})
});
app.post('/upload', upload.array('theFile'), (req, res) => {
res.json({
fileS3Url: 'https://s3.amazonaws.com/'+ s3BucketName +'/' + uniqueFileName
});
});
app.use((req, res, next) => {
const error = new Error('Not found');
error.status = 404;
next(error);
});
app.use((error, req, res, next) => {
res.status(error.status || 500);
res.json({
error: {
message: error.message
}
});
});
module.exports = app; -
Reason for write EPIPE error in my implentation ?
18 mai 2019, par Chrisl446So I currently have a small node.js express application for uploading images using sharp & thumbnails created from .mp4 videos using simple-thumbnail package/ffmpeg.
The app works perfectly when uploading an image, the file is uploaded sharp processes it, then passes it along and it ends up in my amazon s3 bucket as expected. No errors what so ever.
However, when I upload an mp4 video that I use to create and upload a thumbnail from by using simple-thumbnails genThumbnail() function, which uses ffmpeg child process, the thumbnail uploads successully to my s3 bucket, HOWEVER my app returns an EPIPE write error and NOT the url of the uploaded files url on S3.
What is causing this and how can I fix it, considering it’s pretty much working aside from the EPIPE error that is being returned ? Thanks ahead !
The packages of concern used are as follows :
multer-s3 <- this one with the transform option, not the standard multer-s3 package
const express = require('express');
const app = express();
const aws = require('aws-sdk');
const multer = require('multer');
const multerS3 = require('multer-s3'); //github:gmenih341/multer-s3 version of multer-s3 with transform option
const sharp = require('sharp');
const genThumbnail = require('simple-thumbnail');
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Orgin, X-Requested-With, Content-Type, Accept, Authorization');
if (req.method === 'OPTIONS') {
res.header('Access-Control-Allow-Methods', 'POST');
return res.status(200).json({});
}
next();
});
let uniqueFileName;
let s3BucketName = 'bucketname';
let s3 = new aws.S3({
accessKeyId: ACCESS_KEY,
secretAccessKey: SECRET_KEY,
Bucket: s3BucketName
});
let upload = multer({
storage: multerS3({
s3: s3,
bucket: s3BucketName,
acl: 'public-read',
cacheControl: 'max-age=31536000',
contentType: multerS3.AUTO_CONTENT_TYPE,
shouldTransform: true,
transforms: [{
id: 'thumbnail',
key: function (req, file, cb) {
uniqueFileName = Date.now().toString();
cb(null, uniqueFileName + '.jpg')
},
transform: function (req, file, cb) {
if (file.mimetype == 'video/mp4') {
//When using simple-thumbnails' getThumbnail() on an mp4 video it uploads succesfully to S3 but node returns EPIPE write error
cb(null, genThumbnail(null, null, '250x?'))
} else {
//When using sharp to resize an image this works perfectly and retuns the JSON below with the files S3 URL
cb(null, sharp().jpeg())
}
}
}]
})
});
app.post('/upload', upload.array('theFile'), (req, res) => {
res.json({
fileS3Url: 'https://s3.amazonaws.com/'+ s3BucketName +'/' + uniqueFileName
});
});
app.use((req, res, next) => {
const error = new Error('Not found');
error.status = 404;
next(error);
});
app.use((error, req, res, next) => {
res.status(error.status || 500);
res.json({
error: {
message: error.message
}
});
});
module.exports = app;