
Recherche avancée
Autres articles (74)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation"
Sur d’autres sites (7068)
-
How to pipe multiple images, being created in parallel with an index, to ffmpeg so that it can match the speed of image creation ?
23 septembre 2020, par vishwas.mittalWe've a system that spews out 4-channel
png
images frame-by-frame (we control the output format of these images as well, so we can use something else as long as it supports transparency). Right now, we're waiting for all the images and then encoding them withffmpeg
into awebm
video file withvp8
(libvpx
encoder). But we now want to pipeline these images to FFmpeg to encode into the WebM video simultaneously as the images are being spewed out so that we don't wait forffmpeg
to encode all the images afterwards.

This is the current command, in python syntax :


['/usr/bin/ffmpeg', '-hide_banner', '-y', '-loglevel', 'info', '-f', 'rawvideo', '-pix_fmt', 'bgra', '-s', '1573x900', '-framerate', '30', '-i', '-', '-i', 'audio.wav', '-c:v', 'libvpx', '-b:v', '0', '-crf', '30', '-tile-columns', '2', '-quality', 'good', '-speed', '4', '-threads', '16', '-auto-alt-ref', '0', '-g', '300000', '-map', '0:v:0', '-map', '1:a:0', '-shortest', 'video.webm']
# for ease of read:
# /usr/bin/ffmpeg -hide_banner -y -loglevel info -f rawvideo -pix_fmt bgra -s 1573x900 -framerate 30 -i - -i audio.wav -c:v libvpx -b:v 0 -crf 30 -tile-columns 2 -quality good -speed 4 -threads 16 -auto-alt-ref 0 -g 300000 -map 0:v:0 -map 1:a:0 -shortest video.webm

proc = subprocess.Popen(args, stdin=subprocess.PIPE)



Here is a sample example of passing the image to FFMPEG proc stdin as :


# wait for the next frame to get ready
for frame_path in frame_path_list:
 while not os.path.exists(frame_path):
 time.sleep(0.25)
 frame = cv2.imread(frame_path, cv2.IMREAD_UNCHANGED)
 
 # put the frame in stdin so that it gets ready
 proc.stdin.write(frame.astype(np.uint8).tobytes())



The current speed of this process is 0.135x which is a huge bottleneck for us. Earlier when we were taking input as
-pattern_type glob -i images/*.png
we were getting around 1x-1.2x for this on a single core. So, our conclusion is that we're getting bottlenecked by stdin and hence are looking for ways to pass input through multiple sources or somehow helpffmpeg
to parallelize this effort - a few options that we're thinking of :

- 

- Somehow feed it to different pipes and make ffmpeg read from them.
- Append a new image to ffmpeg without re-encoding the whole video, but we didn't find a way to do this with giving input images directly.






But we haven't been able to get either of these working, open to any other solutions as well. Will really appreciate the help on this. Thanks !


-
ffmpeg record video from image pipe with constant framerate
4 janvier 2023, par MichaelI'm trying to record a lossless video with ffmpeg, feeding it image data through standard input.


The process is started like this (C#) :


string inputArgs = "-y -f image2pipe -pix_fmt yuyv422 -i -";
string outputArgs = "-r 20 -c:v libx264 -crf 0 -pix_fmt yuv422p -preset ultrafast C:\\temp\\out.mp4";

process = new Process
{
 StartInfo =
 {
 FileName = "ffmpeg.exe",
 Arguments = $"{inputArgs} {outputArgs}",
 UseShellExecute = false,
 CreateNoWindow = true,
 RedirectStandardInput = true
 }
};

process.Start();



The above works, but I have a problem with framerate. The rate I'm feeding images to ffmpeg is different over time, but I need ffmpeg to keep output rate constant. According to ffmpeg documentation, if set like this "-r 20" it should "duplicate or drop input frames to achieve constant output frame rate fps". But it doesn't. If I feed the images to the ffmpeg too slow, I'm getting fast playing video and vice versa.


Am I providing wrong arguments ? Or it's somehow has to deal with ffmpeg getting images from Standard Input ?


I tried these options in the output settings block : "vsync" (setting it to 1) and "fps_mode" (setting it to cfr). "vsync" doesn't have any effect, with "fps_mode" nothing works (video not recorded at all).


-
C# Pipe images to FFmpeg as they are rendered
22 mars 2020, par LiftPizzasI’ve looked all over and everything I’ve found is how to use already-generated images. I think the below code taken from this (Create video from a growing image sequence using FFMPEG) is really close to what I need, but I need to be able to send one image at a time as each one is rendered, which might take several seconds to minutes, and will be taking place in a different function instead of inline like this one does.
static void Main()
{
//Async main method
AsyncMain().GetAwaiter().GetResult();
}
static async Task AsyncMain()
{
Console.WriteLine("Press any key to quit prematurely.");
var maintask = RunFFMPEG();
var readtask = Task.Run(() => Console.Read());
await Task.WhenAny(maintask, readtask);
}
static async Task RunFFMPEG()
{
await Task.Run(() =>
{
const int fps = 30;
const string outfile = "out.mp4";
const string args = "-y -framerate {0} -f image2pipe -i - -r {0} -c:v libx264 -movflags +faststart -pix_fmt yuv420p -crf 19 -preset veryslow {1}";
const string dir = @"C:\testrender\";
const string pattern = "{0}.png";
const string path = dir + pattern;
const int startNum = 0;
const int endNum = 100;
var pinf = new ProcessStartInfo("ffmpeg", string.Format(args, fps, outfile));
pinf.UseShellExecute = false;
pinf.RedirectStandardInput = true;
pinf.WorkingDirectory = dir;
Console.WriteLine("Starting ffmpeg...");
var proc = Process.Start(pinf);
using (var stream = new BinaryWriter(proc.StandardInput.BaseStream))
{
for (var i = startNum; i < endNum; i++)
{
//"D4" turns 5 to 0005 - change depending on pattern of input files
var file = string.Format(path, i.ToString("D4"));
System.Threading.SpinWait.SpinUntil(() => File.Exists(file) && CanReadFile(file));
Console.WriteLine("Found file: " + file);
stream.Write(File.ReadAllBytes(file));
// I don't have input files, I will have bitmaps at the end of an OpenGL render function.
}
}
proc.WaitForExit();
Console.WriteLine("Closed ffmpeg.");
});
bool CanReadFile(string file)
{
//Needs to be able to read file
FileStream fs = null;
try
{
fs = File.OpenRead(file);
return true;
}
catch (IOException)
{
return false;
}
finally
{
if (fs != null)
fs.Close();
}
}
}