
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 (61)
-
MediaSPIP Core : La Configuration
9 novembre 2010, parMediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...) -
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. -
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...)
Sur d’autres sites (7688)
-
Video decoding using ffms2 (ffmpegsource)
21 juin 2013, par praks411I'm using ffms2 (aka FFmpegSource) for decoding video frames and display on UI based on wxWidgets.
My player works fine for low resolution video (320*240, 640*480) but for higher resolution (1080) it is very slow. I'm not able to meed the desired frame for high resolution video.
After time analysis I found that FFMS_GetFrame() frame function takes much longer time for high resolution frame.
Here are the results.
1. 320*240 FFMS_GetFrame takes 4-6ms
2. 640*480 FFMS_GetFrame takes >20ms
3. 1080*720 FFMS_GetFrame takes >40Which means that I'll never meets 30 fps requirement for 1080p frame with FFMS2. But I'm not sure if this is the case.
Please suggest what could be going wrong.void SetPosition(int64 pos)
{
uint8_t* data_ptr = NULL;
/*check if position is valid*/
if (!m_track || pos < 0 && pos > m_videoProp->NumFrames - 1)
return; // ERR_POS;
wxMilliClock_t start_wx_t = wxGetLocalTimeMillis();
long long start_t = start_wx_t.GetValue();
m_frameId = pos;
if(m_video)
{
m_frameProp = FFMS_GetFrame(m_video, m_frameId, &m_errInfo);
if(!m_frameProp) return;
if(m_frameProp)
{
m_width_ffms2 = m_frameProp->EncodedWidth;
m_height_ffms2 = m_frameProp->EncodedHeight;
}
wxMilliClock_t end_wx_t = wxGetLocalTimeMillis();
long long end_t = end_wx_t.GetValue();
long long diff_t = end_t - start_t;
wxLogDebug(wxString(wxT("Frame Grabe Millisec") + ToString(diff_t)));
//m_frameInfo = FFMS_GetFrameInfo(m_track, FFMS_TYPE_VIDEO);
/* If you want to change the output colorspace or resize the output frame size, now is the time to do it.
IMPORTANT: This step is also required to prevent resolution and colorspace changes midstream. You can
always tell a frame's original properties by examining the Encoded properties in FFMS_Frame. */
/* A -1 terminated list of the acceptable output formats (see pixfmt.h for the list of pixel formats/colorspaces).
To get the name of a given pixel format, strip the leading PIX_FMT_ and convert to lowercase. For example,
PIX_FMT_YUV420P becomes "yuv420p". */
#if 0
int pixfmt[2];
pixfmt[0] = FFMS_GetPixFmt("bgr24");
pixfmt[1] = -1;
#endif
// FFMS_SetOutputFormatV2 returns 0 on success. It Returns non-0 and sets ErrorMsg on failure.
int failure = FFMS_SetOutputFormatV2(m_video, pixfmt, m_width_ffms2, m_height_ffms2, FFMS_RESIZER_BICUBIC, &m_errInfo);
if (failure)
{
//FFMS_DestroyVideoSource(m_video);
//m_video = NULL;
return; //return ERR_POS;
}
data_ptr = m_frameProp->Data[0];
}
else
{
m_width_ffms2 = 320;
m_height_ffms2 = 240;
}
if(data_ptr)
{
memcpy(m_buf, data_ptr, 3*m_height_ffms2 * m_width_ffms2);
}
else
{
memset(m_buf, 0, 3*m_height_ffms2 * m_width_ffms2);
}
} -
Why when recording video using ffmpeg command line when playing the video it's running very fast ?
31 mai 2013, par Revuen Ben DrorThis is my code in Form1 :
private void StartRecording_Click(object sender, EventArgs e)
{
ffmp.Start("test.avi", 25);
timer1.Enabled = true;
}The timer tick event :
private void timer1_Tick(object sender, EventArgs e)
{
using (bitmap = (Bitmap)ScreenCapture.CaptureScreen(true))//(Bitmap)ScreenCapture.CaptureScreen(true))
{
ffmp.PushFrame(bitmap);
}
}Then the code in the ffmpeg class i did :
namespace ScreenVideoRecorder
{
class Ffmpeg
{
NamedPipeServerStream p;
String pipename = "mytestpipe";
byte[] b;
//int i, j;
System.Diagnostics.Process process;
//IAsyncResult ar;
public Ffmpeg()
{
}
public void Start(string FileName, int BitmapRate)
{
p = new NamedPipeServerStream(pipename, PipeDirection.Out, 1, PipeTransmissionMode.Byte);
b = new byte[1920 * 1080 * 3]; // some buffer for the r g and b of pixels of an image of size 720p
process = new System.Diagnostics.Process();
//process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.FileName = @"D:\pipetest\pipetest\ffmpegx86\ffmpeg.exe";
process.EnableRaisingEvents = false;
process.StartInfo.WorkingDirectory = @"D:\pipetest\pipetest\ffmpegx86";
process.StartInfo.Arguments = @"-f rawvideo -pix_fmt bgr0 -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v libx264 -r " + BitmapRate + " " + FileName;
process.Start();
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = false;
//ar = p.BeginWaitForConnection(EndWait,null);
p.WaitForConnection();
}
public void PushFrame(Bitmap bmp)
{
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);The ffmpeg command line is :
process.StartInfo.Arguments = @"-f rawvideo -pix_fmt bgr0 -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v libx264 -r " + BitmapRate + " " + FileName;
And i checked with a breakpoint and saw that the variable BitmapRate is 25 .
And the timer interval is 40 .So it should fit for 25 frames per seconds.
But when i'm running the video file using MPC Media Player Class everything in the video is running very fast. I mean the video is 2,326KB size the video Length is 16 seconds .And everything in the video seems to mvoe very fast if i opend a new window or dragged a window somewhere in the screen i see it moving very fast and as it i moved and did everything in real .
I see on the video file details that : length 16 seconds. 1920x1080 and 25 frames per second.
So where is the problem ? i can't figure out.
-
Why when converting avi video file to another format the first 2-3 seconds are blurry ?
13 juin 2016, par Sharon GabrielThe source file is avi. The target new file is mp4.
The first 2-3 seconds are blurry. Then after 2-3 second the whole video until the end is smooth and sharp.Another sub question is how come that 2.16 GB avi file after conversion using ffmpeg is only 1.34 MB ? It’s not part of a movie or something it’s collection of screenshots images i did in c# and then used AviFile Lib to create from them a avi video file. and yet from 2.16 GB to 1.34 MB and it keep the quality i think almost the same quality like the original avi file and the same duration 2:20 minutes.
About the blurry problem this is my code where i set the ffmpeg arguments and set the process :
private void Convert()
{
try
{
Control.CheckForIllegalCrossThreadCalls = false;
if (ComboBox1.SelectedIndex == 3)
{
strFFCMD = " -i " + (char)34 + InputFile + (char)34 + " -c:v libx264 -s 1920x1080 -pix_fmt yuv420p -qp 18 -profile high444 -c:a libvo_aacenc -b:a 128k -ar 44100 -ac 2 -y " + OutputFile;
}
psiProcInfo.FileName = exepath;
psiProcInfo.Arguments = strFFCMD;
psiProcInfo.UseShellExecute = false;
psiProcInfo.WindowStyle = ProcessWindowStyle.Hidden;
psiProcInfo.RedirectStandardError = true;
psiProcInfo.RedirectStandardOutput = true;
psiProcInfo.CreateNoWindow = true;
prcFFMPEG.StartInfo = psiProcInfo;
prcFFMPEG.Start();
ffReader = prcFFMPEG.StandardError;
do
{
if (Bgw1.CancellationPending)
{
return;
}
Button5.Enabled = true;
Button3.Enabled = false;
strFFOUT = ffReader.ReadLine();
RichTextBox1.Text = strFFOUT;
if (strFFOUT != null)
{
if (strFFOUT.Contains("frame="))
{
currentFramestr = strFFOUT.Substring(7, 6).Trim();
Regex rx = new Regex(@"^\d+");
Match m = rx.Match(currentFramestr);
if (m.Success)
{
currentFrameInt = System.Convert.ToInt32(m.Value);
}
}
}
string percentage = ((double)ProgressBar1.Value / (double)ProgressBar1.Maximum * 100.0).ToString();
textBox3.Text = ProgressBar1.Value.ToString();
ProgressBar1.Maximum = FCount + 1;
ProgressBar1.Value = (currentFrameInt);
Label12.Text = "Current Encoded Frame: " + currentFrameInt;
Label11.Text = percentage;
} while (!(prcFFMPEG.HasExited || string.IsNullOrEmpty(strFFOUT)));
}
catch(Exception err)
{
string errors = err.ToString();
}
}psiProcInfo is ProcessStartInfo
prcFFMPEG is Process
And this is how it looks like when i play the target the new created converted video file the mp4 the first seconds :
Duration : 00:02:20
Width : 1920 Height : 1080
Data Rate and Total Rate both : 80kbps
Frame rate : 2 frames/second
This is the output of the ffmpeg console while converting the file.
ffmpeg version 2.8.git Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 11.100 / 55. 11.100
libavcodec 57. 17.100 / 57. 17.100
libavformat 57. 20.100 / 57. 20.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 21.100 / 6. 21.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[avi @ 00000147a882b660] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avi, from 'C:\temp\video\new.avi':
Duration: 00:02:20.50, start: 0.000000, bitrate: 132710 kb/s
Stream #0:0: Video: rawvideo, bgra, 1920x1080, 2 fps, 2 tbr, 2 tbn, 2 tbc
Please use -profile:a or -profile:v, -profile is ambiguous
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (C:\temp\video\5.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[libx264 @ 00000147a882c820] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 00000147a882c820] profile High, level 4.0
[libx264 @ 00000147a882c820] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=2 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=18 ip_ratio=1.40 pb_ratio=1.30 aq=0
Output #0, mp4, to 'C:\temp\video\5.mp4':
Metadata:
encoder : Lavf57.20.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=-1--1, 2 fps, 16384 tbn, 2 tbc
Metadata:
encoder : Lavc57.17.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 8 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
frame= 15 fps= 14 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
frame= 21 fps= 13 q=18.0 size= 92kB time=00:00:00.00 bitrate=N/A speed= 0x
frame= 30 fps= 14 q=18.0 size= 141kB time=00:00:04.50 bitrate= 257.3kbits/s speed=2.03x
frame= 37 fps= 13 q=20.0 size= 164kB time=00:00:08.00 bitrate= 167.6kbits/s speed=2.82x
frame= 46 fps= 14 q=18.0 size= 185kB time=00:00:12.50 bitrate= 121.0kbits/s speed= 3.7x
frame= 51 fps= 13 q=19.0 size= 194kB time=00:00:15.00 bitrate= 106.1kbits/s speed=3.87x
frame= 58 fps= 13 q=18.0 size= 210kB time=00:00:18.50 bitrate= 93.2kbits/s speed=4.19x
frame= 65 fps= 13 q=20.0 size= 224kB time=00:00:22.00 bitrate= 83.6kbits/s speed=4.46x
frame= 71 fps= 13 q=19.0 size= 238kB time=00:00:25.00 bitrate= 78.1kbits/s speed=4.56x
frame= 78 fps= 13 q=18.0 size= 253kB time=00:00:28.50 bitrate= 72.6kbits/s speed=4.75x
frame= 83 fps= 13 q=19.0 size= 265kB time=00:00:31.00 bitrate= 70.0kbits/s speed= 4.7x
frame= 89 fps= 12 q=20.0 size= 280kB time=00:00:34.00 bitrate= 67.4kbits/s speed=4.73x
frame= 95 fps= 12 q=19.0 size= 291kB time=00:00:37.00 bitrate= 64.5kbits/s speed=4.73x
frame= 102 fps= 12 q=18.0 size= 308kB time=00:00:40.50 bitrate= 62.3kbits/s speed=4.84x
frame= 107 fps= 12 q=19.0 size= 317kB time=00:00:43.00 bitrate= 60.4kbits/s speed=4.82x
frame= 115 fps= 12 q=19.0 size= 336kB time=00:00:47.00 bitrate= 58.6kbits/s speed=4.96x
frame= 123 fps= 12 q=20.0 size= 354kB time=00:00:51.00 bitrate= 56.8kbits/s speed=5.09x
frame= 132 fps= 12 q=20.0 size= 371kB time=00:00:55.50 bitrate= 54.8kbits/s speed=5.25x
frame= 139 fps= 13 q=20.0 size= 392kB time=00:00:59.00 bitrate= 54.5kbits/s speed=5.32x
frame= 146 fps= 13 q=19.0 size= 408kB time=00:01:02.50 bitrate= 53.5kbits/s speed=5.37x
frame= 150 fps= 12 q=20.0 size= 417kB time=00:01:04.50 bitrate= 52.9kbits/s speed=5.28x
frame= 155 fps= 12 q=18.0 size= 428kB time=00:01:07.00 bitrate= 52.4kbits/s speed=5.25x
frame= 161 fps= 12 q=20.0 size= 441kB time=00:01:10.00 bitrate= 51.6kbits/s speed=5.26x
frame= 167 fps= 12 q=19.0 size= 462kB time=00:01:13.00 bitrate= 51.9kbits/s speed=5.29x
frame= 174 fps= 12 q=20.0 size= 483kB time=00:01:16.50 bitrate= 51.7kbits/s speed=5.33x
frame= 181 fps= 12 q=18.0 size= 614kB time=00:01:20.00 bitrate= 62.8kbits/s speed=5.36x
frame= 187 fps= 12 q=20.0 size= 763kB time=00:01:23.00 bitrate= 75.3kbits/s speed=5.35x
frame= 193 fps= 12 q=19.0 size= 852kB time=00:01:26.00 bitrate= 81.2kbits/s speed=5.36x
frame= 199 fps= 12 q=18.0 size= 865kB time=00:01:29.00 bitrate= 79.6kbits/s speed=5.37x
frame= 206 fps= 12 q=20.0 size= 932kB time=00:01:32.50 bitrate= 82.6kbits/s speed=5.39x
frame= 211 fps= 12 q=20.0 size= 943kB time=00:01:35.00 bitrate= 81.3kbits/s speed=5.38x
frame= 217 fps= 12 q=18.0 size= 1007kB time=00:01:38.00 bitrate= 84.1kbits/s speed=5.38x
frame= 223 fps= 12 q=20.0 size= 1175kB time=00:01:41.00 bitrate= 95.3kbits/s speed=5.38x
frame= 230 fps= 12 q=20.0 size= 1195kB time=00:01:44.50 bitrate= 93.7kbits/s speed=5.42x
frame= 235 fps= 12 q=18.0 size= 1205kB time=00:01:47.00 bitrate= 92.3kbits/s speed= 5.4x
frame= 241 fps= 12 q=20.0 size= 1222kB time=00:01:50.00 bitrate= 91.0kbits/s speed= 5.4x
frame= 247 fps= 12 q=19.0 size= 1232kB time=00:01:53.00 bitrate= 89.3kbits/s speed=5.39x
frame= 255 fps= 12 q=19.0 size= 1252kB time=00:01:57.00 bitrate= 87.7kbits/s speed=5.45x
frame= 260 fps= 12 q=20.0 size= 1274kB time=00:01:59.50 bitrate= 87.3kbits/s speed=5.44x
frame= 267 fps= 12 q=20.0 size= 1287kB time=00:02:03.00 bitrate= 85.7kbits/s speed=5.45x
frame= 272 fps= 12 q=18.0 size= 1304kB time=00:02:05.50 bitrate= 85.1kbits/s speed=5.43x
frame= 278 fps= 12 q=20.0 size= 1314kB time=00:02:08.50 bitrate= 83.8kbits/s speed=5.41x
frame= 281 fps= 12 q=-1.0 Lsize= 1376kB time=00:02:19.50 bitrate= 80.8kbits/s speed=5.76x
video:1372kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.299861%
[libx264 @ 00000147a882c820] frame I:2 Avg QP:15.00 size: 98930
[libx264 @ 00000147a882c820] frame P:80 Avg QP:18.00 size: 7068