
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (107)
-
La gestion des forums
3 novembre 2011, parSi les forums sont activés sur le site, les administrateurs ont la possibilité de les gérer depuis l’interface d’administration ou depuis l’article même dans le bloc de modification de l’article qui se trouve dans la navigation de la page.
Accès à l’interface de modération des messages
Lorsqu’il est identifié sur le site, l’administrateur peut procéder de deux manières pour gérer les forums.
S’il souhaite modifier (modérer, déclarer comme SPAM un message) les forums d’un article particulier, il a à sa (...) -
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 ;
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)
Sur d’autres sites (10853)
-
Why i'm getting strange video file when using ffmpeg and pipes to create video file in real time ?
30 juin 2015, par Brubaker HaimThe goal here is to create a compressed mp4 video file in real time.
I’m saving screenshots as bitmaps type on my hard disk.
And i want to create mp4 file and compress the mp4 video file in real time.The problem is the end the video file i get looks very strange.
This is the result : Strange Video FileThe class that i’m using the ffmpeg with arguments.
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.IO.Pipes;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using DannyGeneral;
namespace Youtube_Manager
{
class Ffmpeg
{
NamedPipeServerStream p;
String pipename = "mytestpipe";
System.Diagnostics.Process process;
string ffmpegFileName = "ffmpeg.exe";
string workingDirectory;
public Ffmpeg()
{
workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
Logger.Write("workingDirectory: " + workingDirectory);
if (!Directory.Exists(workingDirectory))
{
Directory.CreateDirectory(workingDirectory);
}
ffmpegFileName = Path.Combine(workingDirectory, ffmpegFileName);
Logger.Write("FfmpegFilename: " + ffmpegFileName);
}
public void Start(string pathFileName, int BitmapRate)
{
try
{
string outPath = pathFileName;
p = new NamedPipeServerStream(pipename, PipeDirection.Out, 1, PipeTransmissionMode.Byte);
ProcessStartInfo psi = new ProcessStartInfo();
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
psi.CreateNoWindow = false;
psi.FileName = ffmpegFileName;
psi.WorkingDirectory = workingDirectory;
psi.Arguments = @"-f rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v mpeg4 -r " + BitmapRate + " " + outPath;
//psi.Arguments = @"-framerate 1/5 -i -c:v libx264 -r 30 -pix_fmt yuv420p \\.\pipe\mytestpipe -map 0 -c:v mpeg4 -r" + BitmapRate + " " + outPath;
process = Process.Start(psi);
process.EnableRaisingEvents = false;
psi.RedirectStandardError = true;
p.WaitForConnection();
}
catch (Exception err)
{
Logger.Write("Exception Error: " + err.ToString());
}
}
public void PushFrame(Bitmap bmp)
{
try
{
int length;
// Lock the bitmap's bits.
//bmp = new Bitmap(1920, 1080);
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
//Rectangle rect = new Rectangle(0, 0, 1280, 720);
System.Drawing.Imaging.BitmapData bmpData =
bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly,
bmp.PixelFormat);
int absStride = Math.Abs(bmpData.Stride);
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Declare an array to hold the bytes of the bitmap.
//length = 3 * bmp.Width * bmp.Height;
length = absStride * bmpData.Height;
byte[] rgbValues = new byte[length];
//Marshal.Copy(ptr, rgbValues, 0, length);
int j = bmp.Height - 1;
for (int i = 0; i < bmp.Height; i++)
{
IntPtr pointer = new IntPtr(bmpData.Scan0.ToInt32() + (bmpData.Stride * j));
System.Runtime.InteropServices.Marshal.Copy(pointer, rgbValues, absStride * (bmp.Height - i - 1), absStride);
j--;
}
p.Write(rgbValues, 0, length);
bmp.UnlockBits(bmpData);
}
catch(Exception err)
{
Logger.Write("Error: " + err.ToString());
}
}
public void Close()
{
p.Close();
}
}
}Then i’m using the method PushFrame here in this class :
public Bitmap GetScreenShot(string folder, string name)
{
_screenShot = new Bitmap(GetScreen());
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
string ingName = folder + name + images.counter.ToString("D6") + ".bmp";
_screenShot.Save(ingName,System.Drawing.Imaging.ImageFormat.Bmp);
fmpeg.PushFrame(_screenShot);
_screenShot.Dispose();
return _screenShot;
}The Bitmaps on the hard disk are fine i can edit/open see them.
When using command prompt and manually type ffmpeg command it does compress and create a mp4 video file.But when using the Ffmpeg class i did with the PushFrame method it’s creating this strange video file.
This is a link for my OneDrive with 10 screenshots images files for testing :
Sample screenshot from the video file when playing the video file :
Looks very choppy. The Bitmaps on the hard disk each one is 1920x1080 and Bit depth 32But it dosen’t look like that in the video file :
This is the arguments i’m using :
psi.Arguments = @"-f rawvideo -vcodec rawvideo -pix_fmt rgb24 -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v mpeg4 -r " + BitmapRate + " " + outPath;
The video size is very small 1.24 MB
-
Why when using ffmpeg to create video file in real time the ffmpeg.exe take over 1GB of memory ?
3 juillet 2015, par Brubaker HaimThis is my class where i’m using the ffmpeg.exe.
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.IO.Pipes;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using DannyGeneral;
namespace Manager
{
public class Ffmpeg
{
NamedPipeServerStream p;
String pipename = "mytestpipe";
System.Diagnostics.Process process;
string ffmpegFileName = "ffmpeg.exe";
string workingDirectory;
public Ffmpeg()
{
workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
Logger.Write("workingDirectory: " + workingDirectory);
if (!Directory.Exists(workingDirectory))
{
Directory.CreateDirectory(workingDirectory);
}
ffmpegFileName = Path.Combine(workingDirectory, ffmpegFileName);
Logger.Write("FfmpegFilename: " + ffmpegFileName);
}
public void Start(string pathFileName, int BitmapRate)
{
try
{
string outPath = pathFileName;
p = new NamedPipeServerStream(pipename, PipeDirection.Out, 1, PipeTransmissionMode.Byte);
ProcessStartInfo psi = new ProcessStartInfo();
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
psi.CreateNoWindow = false;
psi.FileName = ffmpegFileName;
psi.WorkingDirectory = workingDirectory;
psi.Arguments = @"-f rawvideo -pix_fmt bgra -video_size 1920x1080 -i \\.\pipe\mytestpipe -c:v libx264 -crf 20 -r " + BitmapRate + " " + outPath;
process = Process.Start(psi);
process.EnableRaisingEvents = false;
psi.RedirectStandardError = true;
p.WaitForConnection();
}
catch (Exception err)
{
Logger.Write("Exception Error: " + err.ToString());
}
}
public void PushFrame(Bitmap bmp)
{
try
{
int length;
// Lock the bitmap's bits.
//bmp = new Bitmap(1920, 1080);
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
//Rectangle rect = new Rectangle(0, 0, 1280, 720);
System.Drawing.Imaging.BitmapData bmpData =
bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly,
bmp.PixelFormat);
int absStride = Math.Abs(bmpData.Stride);
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Declare an array to hold the bytes of the bitmap.
//length = 3 * bmp.Width * bmp.Height;
length = absStride * bmpData.Height;
byte[] rgbValues = new byte[length];
//Marshal.Copy(ptr, rgbValues, 0, length);
int j = bmp.Height - 1;
for (int i = 0; i < bmp.Height; i++)
{
IntPtr pointer = new IntPtr(bmpData.Scan0.ToInt32() + (bmpData.Stride * j));
System.Runtime.InteropServices.Marshal.Copy(pointer, rgbValues, absStride * (bmp.Height - i - 1), absStride);
j--;
}
p.Write(rgbValues, 0, length);
bmp.UnlockBits(bmpData);
}
catch(Exception err)
{
Logger.Write("Error: " + err.ToString());
}
}
public void Close()
{
p.Close();
}
}
}ffmpegFileName contain the ffmpeg.exe
Then i have a timer tick event in another form :
ScreenShot shot = new ScreenShot();
public static int counter = 0;
private void timer1_Tick(object sender, EventArgs e)
{
counter++;
shot.GetScreenShot(@"e:\screenshots\", "screenshot");
if (counter == 1200)
{
timer1.Stop();
ScreenShot.fmpeg.Close();
this.Close();
ScreenShotsPlayer ssp = new ScreenShotsPlayer();
ssp.Show();
}
}This timer interval set to 100ms.
So it’s taking a screenshot every 100ms.In the class ScreenShot i’m using the Ffmpeg class :
In the top :public static Ffmpeg fmpeg;
In the constructor :
fmpeg = new Ffmpeg();
fmpeg.Start(@"e:\screenshots\test.mp4", 25);Then in the GetScreenShot method i’m calling the Ffmpeg PushFrame method :
public Bitmap GetScreenShot(string folder, string name)
{
_screenShot = new Bitmap(GetScreen());
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
string ingName = folder + name + Elgato_Video_Capture.counter.ToString("D6") + ".bmp";
_screenShot.Save(ingName,System.Drawing.Imaging.ImageFormat.Bmp);
fmpeg.PushFrame(_screenShot);
_screenShot.Dispose();
return _screenShot;
}I can’t figure out why once i start the timer to take the screenshots the ffmpeg.exe eat so much memory also the hard disk is working about 53MB/s and the memory is over 90% and over 1GB.
I’m doing the memory leak somehow ?
In the ScreenShot class when i’m making an instance once for the Ffmpeg class the ffmpeg.exe is on very low memory usage and the hard disk usage is low.
The ffmpeg.exe is about only 0.1MB of memory usage.
fmpeg.Start(@"e:\screenshots\test.mp4", 25);
But then when i’m clicking the button start the timer and taking screenshots every 100ms and calling PushFrame method the ffmpeg.exe very fast after few seconds getting to over 1GB of memory usage.
EDIT
I tried this arguments :
psi.Arguments = @"-f rawvideo -pix_fmt bgra -video_size 1920x1080 -i \\.\pipe\mytestpipe -c:v libx264 -crf 20 -r 750k e:\screenshots\test.mp4";
The memory usage was about 1gb of ffmpeg.exe and cpu usage 99-100%
The hard disk was on 0 but now the cpu usage got to 100% and the memory over 1gb.And it didn’t create the video file I got this warnings/errors :
-
Evolution #2633 : Pouvoir modifier _DIR_RESTREINT_ABS
10 juillet 2015, par jluc -Pourrait on réouvrir ce ticket ?
Dans SPIP 3.1 du 15 juin environ voici la liste des occurences de ecrire que j’ai trouvé dans la dist :
squelettes-dist/robots.txt.html:11:Disallow : /ecrire/
spip_loader.php:44:define(’_SPIP_LOADER_PLUGIN_RETOUR’, "ecrire/ ?exec=admin_plugin&voir=tous") ;
spip_loader.php:923:if (@file_exists(’ecrire/inc_version.php’))
spip_loader.php:924 : define(’_SPIP_LOADER_URL_RETOUR’, "ecrire/ ?exec=accueil") ;
spip_loader.php:925 : include_once ’ecrire/inc_version.php’ ;
spip_loader.php:933 : else define(’_SPIP_LOADER_URL_RETOUR’, "ecrire/ ?exec=install") ;spip.php:14:if (!defined(’_DIR_RESTREINT_ABS’)) define(’_DIR_RESTREINT_ABS’, ’ecrire/’) ;
ecrire/inc/flock.php:607 : * $x = preg_files(’ecrire/data/’, ’[.]lock$’) ;
ecrire/public/debusquer.php:366 : if ($reg[1]==’ecrire/public’)
ecrire/inc_version.php:38 : define(’_DIR_RESTREINT_ABS’, ’ecrire/’) ;
ecrire/inc_version.php:42 : * vide si on est dans ecrire, ’ecrire/’ sinon */plugins-dist/compresseur/tests/compacte_css.php:10 : while (!is_dir($remonte."ecrire"))
plugins-dist/forum/prive/modeles/forum-actions-moderer.html:2 :[(#SETretour,[(#REM|test_espace_prive| ?[(#VALecrire/|concat#SELF|replace’./’,’’)],#SELF|ancre_urlforum#ID_FORUM)])]
plugins-dist/filtres_images/tests/_couleur_rgb2hsv.php:13 : while (!is_dir($remonte."ecrire"))
plugins-dist/filtres_images/tests/_couleur_hsv2rgb.php:13 : while (!is_dir($remonte."ecrire"))
plugins-dist/filtres_images/tests/_couleur_rgb2hsl.php:13 : while (!is_dir($remonte."ecrire"))
plugins-dist/filtres_images/tests/multiple_de_trois.php:13 : while (!is_dir($remonte."ecrire"))
plugins-dist/filtres_images/tests/couleur_extraire.php:13 : while (!is_dir($remonte."ecrire"))
plugins-dist/filtres_images/tests/_couleur_hsl2rgb.php:13 : while (!is_dir($remonte."ecrire"))
plugins-dist/textwheel/tests/tw_propre_modeles_block.php:9 : while (!is_dir($remonte."ecrire"))
plugins-dist/textwheel/tests/tw_propre_modeles_inline.php:9 : while (!is_dir($remonte."ecrire"))
plugins-dist/textwheel/tests/tw_propre_typo.php:9 : while (!is_dir($remonte."ecrire"))
plugins-dist/textwheel/tests/tw_propre.php:9 : while (!is_dir($remonte."ecrire"))
plugins-dist/porte_plume/tests/lanceur_spip.php:7:while (!is_dir($remonte."ecrire"))
plugins/spipr/zcore/v2.4.3/tests/zcore_echafaudable.php:12 : while (!is_dir($remonte."ecrire"))
plugins/auto/zcore/v2.4.5/tests/zcore_echafaudable.php:12 : while (!is_dir($remonte."ecrire"))
plugins/auto/gis/v4.26.12/tests/gis_connect_sql.php:10 : while (!is_dir($remonte."ecrire"))
config/ecran_securite.php:113 : OR @file_exists(’ecrire/inc_version.php’))
config/ecran_securite.php:259:if (strpos($_SERVER[’REQUEST_URI’],"ecrire/") !==false)