
Recherche avancée
Autres articles (67)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
Sur d’autres sites (8664)
-
Issues with video frame dropout using Accord.NET VideoFileWriter and FFMPEG
9 janvier 2018, par DavidI am testing out writing video files using the Accord.Video library. I have a WPF project created in Visual Studio 2017, and I have installed Accord.Video.FFMPEG as well as Accord.Video.VFW using Nuget, as well as their dependencies.
I have created a very simple video to test basic file output. However, I am running into some issues. My goal is to be able to output videos with a variable frame rate, because in the future I will be using this code to input images from a webcam device that will then be saved to a video file, and video from webcams typically has variable frame rates.
For now, in this example, I am not inputting video from a webcam, but rather I am generating a simple "moving box" image and outputting the frames to a video file. The box changes color every 20 frames : red, green, blue, yellow, and finally white. I also set the frame rate to be 20 fps.
When I use Accord.Video.VFW, the frame rate is correctly set, and all the frames are correctly outputted to the video file. The resulting video looks like this (see the YouTube link) : https://youtu.be/K8E9O7bJIbg
This is just a reference, however. I don’t intend on using Accord.Video.VFW because it outputs uncompressed data to an AVI file, and it doesn’t support variable frame rates. I would like to use Accord.Video.FFMPEG because it is supposed to support variable frame rates.
When I attempt to use the Accord.Video.FFMPEG library, however, the video does not result in how I would expect it to look. Here is a YouTube link : https://youtu.be/cW19yQFUsLI
As you can see, in that example, the box remains the first color for a longer amount of time than the other colors. It also never reaches the final color (white). When I inspect the video file, 100 frames were not outputted to the file. There are 69 or 73 frames typically. And the expected frame rate and duration obviously do not match up.
Here is the code that generates both these videos :
public MainWindow()
{
InitializeComponent();
Accord.Video.VFW.AVIWriter avi_writer = new Accord.Video.VFW.AVIWriter();
avi_writer.FrameRate = 20;
avi_writer.Open("test2.avi", 640, 480);
Accord.Video.FFMPEG.VideoFileWriter k = new Accord.Video.FFMPEG.VideoFileWriter();
k.FrameRate = 20;
k.Width = 640;
k.Height = 480;
k.Open("test.mp4");
for (int i = 0; i < 100; i++)
{
TimeSpan t = new TimeSpan(0, 0, 0, 0, 50 * i);
var b = new System.Drawing.Bitmap(640, 480);
var g = Graphics.FromImage(b);
var br = System.Drawing.Brushes.Blue;
if (t.TotalMilliseconds < 1000)
br = System.Drawing.Brushes.Red;
else if (t.TotalMilliseconds < 2000)
br = System.Drawing.Brushes.Green;
else if (t.TotalMilliseconds < 3000)
br = System.Drawing.Brushes.Blue;
else if (t.TotalMilliseconds < 4000)
br = System.Drawing.Brushes.Yellow;
else
br = System.Drawing.Brushes.White;
g.FillRectangle(br, 50 + i, 50, 100, 100);
System.Console.WriteLine("Frame: " + (i + 1).ToString() + ", Millis: " + t.TotalMilliseconds.ToString());
#region This is the code in question
k.WriteVideoFrame(b, t);
avi_writer.AddFrame(b);
#endregion
}
avi_writer.Close();
k.Close();
System.Console.WriteLine("Finished writing video");
}I have tried changing a few things under the assumption that maybe the "WriteVideoFrame" function isn’t able to finish in time, and so I need to slow down the program so it can complete itself. Under that assumption, I have replaced the "WriteVideoFrame" call with the following code :
Task taskA = new Task(() => k.WriteVideoFrame(b, t));
taskA.Start();
taskA.Wait();And I have tried the following code :
Task.WaitAll(
Task.Run( () =>
{
lock(syncObj)
{
k.WriteVideoFrame(b, t);
}
}
));And even just a standard call where I don’t specify a timestamp :
k.WriteVideoFrame(b);
None of these work. They all result in something similar.
Any suggestions on getting the WriteVideoFrame function to work that is a part of the Accord.Video.FFMPEG.VideoFileWriter class ?
Thanks for any and all help !
[edits below]
I have done some more investigating. I still haven’t found a good solution, but here is what I have found so far. After declaring my VideoFileWriter object, I have tried setting up some options for the video.
When I use an H264 codec with the following options, it correctly saves 100 frames at a frame-rate of 20 fps, however any normal media player (both VLC and Windows Media Player) end up playing a 10-second video instead of a 5-second video. Essentially, it seems like they play it at half-speed. Here is the code that gives that result :
k.VideoCodec = Accord.Video.FFMPEG.VideoCodec.H264;
k.VideoOptions["crf"] = "18";
k.VideoOptions["preset"] = "veryfast";
k.VideoOptions["tune"] = "zerolatency";
k.VideoOptions["x264opts"] = "no-mbtree:sliced-threads:sync-lookahead=0";Additionally, if I use an Mpeg4 codec, I get the same "half-speed" result :
k.VideoCodec = Accord.Video.FFMPEG.VideoCodec.Mpeg4;
However, if I use a WMV codec, then it correctly results in 100 frames at 20 fps, and a 5 second video that is correctly played by both media players :
k.VideoCodec = Accord.Video.FFMPEG.VideoCodec.Wmv1;
Although this is good news, this still doesn’t solve the problem because WMV doesn’t support variable frame rates. Also, this still doesn’t answer the question as to why the problem is happening in the first place.
As always, any help would be appreciated !
-
Nginx rtmp exec_push
26 décembre 2017, par Akim BenchihaI have 2 nginx instances and 1 node server with each running on separate VM.
The first instance get the rtmp stream.
The second instance is the HLS app.
The node server execute the ffmpeg script and send the combined stream to instance 2.What I want is to execute ffmpeg with exec_push from instance 1 on the node server. I tried curl but it’s not enough because he just receives the response.
Nginx config :
rtmp {
server {
listen 1935;
ping 30s;
notify_method get;
application ingest {
live on;
exec_kill_signal term;
idle_streams off;
exec_push curl -s IP:3000/$name ;
#exec_push /usr/local/bin/ffmpeg_push.sh $name ;
}
}
}NodeJS
app.get('/:name', (req, res) =>{
const testscript = exec('sh /usr/local/bin/ffmpeg_push.sh '+ req.params.name);
testscript.stdout.on('data', function(data){
console.log('\x1b[32m', data);
// sendBackInfo();
});
testscript.stderr.on('data', function(data){
console.log("\x1b[31m", data);
// triggerErrorStuff();
});
testscript.on('close', function (code){
console.log("\x1b[31m", {data: {status: 'error', code: code}});
});
})
app.listen(3000, '0.0.0.0', () => console.log("\x1b[32m", 'ok on port 3000'))Do you have any hint or idea please ?
Thank you -
Run 2 exec command in for loop with time interval of 30 seconds using TCL and FFMPEG
29 novembre 2017, par M. D. Pi want to Run 2 exec command in for loop with time interval of 30 seconds using TCL and FFMPEG
my exec command for image is :
exec ffmpeg -f dshow -benchmark -i video="Integrated Webcam" -s 1280x720 c:/test/sample_image%d.jpg
my exec command for video is :
exec ffmpeg -f dshow -benchmark -i video="Integrated Webcam" -s 1280x720 c:/test/sample_video%d.avi
i want my code to be like this :
proc a {} {
set a 1
while {$a < 10} {
after 3000
exec ffmpeg -f dshow -benchmark -i "video=Integrated Webcam" -s 1280x720 c:/test/sample_image.avi
after 3000
exec ffmpeg -f dshow -t 00:00:30 -benchmark -i "video=Integrated Webcam" -s 1280x720 c:/test/sample_video.avi
incr a
}
}
aproblem here is, after completion of first exec command, it stops its execution. that is it captures the image and stops its execution.
I also want that this process of capturing image and video should work in loop (while or foreach).
i have my present working code which execute only one exec command, that to only one. so i want this two exec command to run after one another in loop.
error report for above program :
% source c:/other/a/d.tcl
ffmpeg version N-89212-ga60b2425c3 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
libavutil 56. 2.100 / 56. 2.100
libavcodec 58. 3.105 / 58. 3.105
libavformat 58. 2.102 / 58. 2.102
libavdevice 58. 0.100 / 58. 0.100
libavfilter 7. 2.102 / 7. 2.102
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Input #0, dshow, from 'video=Logitech HD Webcam C525':
Duration: N/A, start: 90055.057000, bitrate: N/A
Stream #0:0: Video: rawvideo, bgr24, 1280x720, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
File 'c:/test/sample_20171128_111245.jpg' already exists. Overwrite ? [y/N] [dshow @ 052d4ac0] real-time buffer [Logitech HD Webcam C525] [video input] too full or near too full (181% of size: 3041280 [rtbufsize parameter])! frame dropped!
Last message repeated 886 times
Not overwriting - exiting
bench: maxrss=50856kB
[dshow @ 052d4ac0] real-time buffer [Logitech HD Webcam C525] [video input] too full or near too full (181% of size: 3041280 [rtbufsize parameter])! frame dropped!
Last message repeated 1 times
%please provide me the code as answer which will work for above problem.