
Recherche avancée
Autres articles (64)
-
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 (12784)
-
libavfilter/scale2ref : Add constants for the primary input
30 mai 2017, par Kevin Marklibavfilter/scale2ref : Add constants for the primary input
Variables pertaining to the main video are now available when
using the scale2ref filter. This allows, as an example, scaling a
video with another as a reference point while maintaining the
original aspect ratio of the primary/non-reference video.Consider the following graph : scale2ref=iw/6 :-1 [main][ref]
This will scale [main] to 1/6 the width of [ref] while maintaining
the aspect ratio. This works well when the AR of [ref] is equal to
the AR of [main] only. What the above filter really does is
maintain the AR of [ref] when scaling [main]. So in all non-same-AR
situations [main] will appear stretched or compressed to conform to
the same AR of the reference video. Without doing this calculation
externally there is no way to scale in reference to another input
while maintaining AR in libavfilter.To make this possible, we introduce eight new constants to be used
in the w and h expressions only in the scale2ref filter :* main_w/main_h : width/height of the main input video
* main_a : aspect ratio of the main input video
* main_sar : sample aspect ratio of the main input video
* main_dar : display aspect ratio of the main input video
* main_hsub/main_vsub : horiz/vert chroma subsample vals of main
* mdar : a shorthand alias of main_darOf course, not all of these constants are needed for maintaining the
AR, but adding additional constants in line of what is available for
in/out allows for other scaling possibilities I have not imagined.So to now scale a video to 1/6 the size of another video using the
width and maintaining its own aspect ratio you can do this :scale2ref=iw/6:ow/mdar [main][ref]
This is ideal for picture-in-picture configurations where you could
have a square or 4:3 video overlaid on a corner of a larger 16:9
feed all while keeping the scaled video in the corner at its correct
aspect ratio and always the same size relative to the larger video.I've tried to re-use as much code as possible. I could not find a way
to avoid duplication of the var_names array. It must now be kept in
sync with the other (the normal one and the scale2ref one) for
everything to work which does not seem ideal. For every new variable
introduced/removed into/from the normal scale filter one must be
added/removed to/from the scale2ref version. Suggestions on how to
avoid var_names duplication are welcome.var_values has been increased to always be large enough for the
additional scale2ref variables. I do not forsee this being a problem
as the names variable will always be the correct size. From my
understanding of av_expr_parse_and_eval it will stop processing
variables when it runs out of names even though there may be
additional (potentially uninitialized) entries in the values array.
The ideal solution here would be using a variable-length array but
that is unsupported in C90.This patch does not remove any functionality and is strictly a
feature patch. There are no API changes. Behavior does not change for
any previously valid inputs.The applicable documentation has also been updated.
Signed-off-by : Kevin Mark <kmark937@gmail.com>
Signed-off-by : Michael Niedermayer <michael@niedermayer.cc> -
Tiny node js video convert server, best way to manage the threads
23 juin 2017, par efirvidaI am developing a small server to convert videos for the web, I started with a TCP server (maybe it is not the best solution, but it is not the part of my problem right now) to which I send the path of videos to convert and then Add to a queue in a database system, in this case mysql, but I’m thinking of migrating to MongoDB when it works
var net = require('net'),
Sequelize = require('sequelize'),
async = require('async'),
JsonSocket = require('json-socket'),
ffmpeg = require('fluent-ffmpeg');
var configDB = require('./config/database.js');
var sequelize = new Sequelize(configDB.url);
var Videos = sequelize.import('app/models/video');
Videos.sync();
var port = 9838;
var server = net.createServer();
server.listen(port);
server.on('connection', function(socket) {
socket = new JsonSocket(socket);
socket.on('message', function(video) {
console.log(video.video);
db_data = {
'name': video.video,
'converted': false,
'progress': 0,
'status': 'Q',
}
Videos.create(db_data).then(function () {
socket.sendMessage('New Video Added');
}).catch(function () {
console.log('Error adding Video');
socket.sendMessage('Error adding video')
});
});
});Once I have a list of videos on the database the process begin with this code :
// Function to update the video status on the database
var databaseUpdate = function(status, callback) {
name = status.name;
delete status["name"];
Videos.update(status, {
where: {
name: name
}
}).then(function (video) {
if (typeof callback === 'function' && callback) callback();
});
}
//convert the video:
// If the video status are:
// - 'Q' for in queue
// - 'R' for running conversion
// - 'C' for complete
// - 'E' for error on the conversion proccess
function ffmpegConvert(video, output, callback)
{
var filename = video.split('/').reverse()[0].split('.')[0],
output = output + filename + '.mp4';
ffmpeg(video)
.videoCodec('libx264')
.audioCodec('libmp3lame')
.on('error', function(err) {
db_data = {
'name': video,
'status': 'E', //<- set status if error ocurre
}
databaseUpdate(db_data)
console.log('An error occurred: ' + err.message);
})
.on('end', function(stdout, stderr) {
db_data = {
'name': video,
'converted': true, //<- set status complete conversion
'status': 'C', //<- set status complete conversion
}
databaseUpdate(db_data, function(){convertVideos(1)}) // <- put a next video in the queue to convert
})
.on('progress', function(progress) {
db_data = {
'name': video,
'status': 'R', //<- set status ass running conversion
'progress': progress.percent, //<- set the video processes %
}
databaseUpdate(db_data)
})
.save(output);
}
// get videos not converted `converted: false` and with
// queque status `status: 'Q'` from the database
// the send to the ffmpegConvert function in a num of async task
var convertVideos = function(num){
Videos.findAll(
{
where: {
converted: false,
status: 'Q'
},
limit : num,
order: '"createdAt" DESC'
}
).then(function (videos) {
if (videos && videos.length){
async.each(videos,
function(item){
ffmpegConvert(item.name, output_folder )
},
function(err){
});
}
});
}
// Start vidieo conversion with threads number equal to number of cpu
threads = require('os').cpus().length,
convertVideos(threads);So at this point All works great, and all the videos on the queue are converted, but my questions are :
1 - How to put new videos to convert if they are added to the database after the first run on the server ?
I can’t put it to run the
socket.on('message', function(video) {}
because if I send a new video when the queue is not completed this going to start a new separated thread. I also think that I have to find a way to monitor the async task to see how many task are running before send new one2 - How to manage uncompleted videos if server goes down ?
If I turn off the server for some reason, the status of the current video in the database stay in ’R’ so the query to add it to the conversion prosses didn not see it, and left it corrupted.
-
ffmpeg : How to replace a series of frames with a series of image files ?
14 septembre 2020, par Arnon WeinbergGiven a video file, start and end timestamps, there is a known number of frames between those timestamps in the video file, and I have an equal number of .png files in a directory to replace them with. The .png files are sorted as 001.png ... NNN.png. How would I go about updating the video file with the replacement frames using ffmpeg ?


This is a followup to using ffmpeg to replace a single frame based on timestamp, but I'm asking about replacing multiple sequential frames based on 2 timestamps.


Presumably something like :


ffmpeg -i input.mp4 -i %3d.png -filter_complex "something including the timestamps 4.40,5.20" -c:a copy output.mp4



I would also be okay with using frame numbers instead of timestamps if that makes things easier, and it's reasonable if start and end frames must be keyframes.


Background :


Many machine learning algorithms for video processing use ffmpeg to extract specific scenes from videos based on start and end timestamps, dump them into a sequence of .png files, process them in some way (denoise, deblur, colorize, annotate, inpainting, etc), and output the results into an equal number of .png files. The output frames are usually assembled into a new video file, but I would like instead to update the source video file so as to preserve audio, unedited video, and other video properties (fps, keyframes, etc).


This approach will not work as-is for some categories of video processing algorithms. For example, interpolation results in more frames than were originally extracted, and upscaling results in higher-resolution images. As such, I would appreciate an explanation of any solution so that I can adapt it for such cases (or I will ask separate questions for those).