
Recherche avancée
Autres articles (50)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
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 ) (...)
Sur d’autres sites (10425)
-
FFmpeg memory growing in avcodec_decode_video2
21 juillet 2015, par Wendy PanI am using C# to call the ffmpeg lib.
I use the example code to decode an video in the MP4 format.However, I found out that the memory grows a lot (like 10MB), when I called the avcodec_decode_video2 function.
The memory keeps growing until I called the avcodec_close(&CodecContext) function.
I suppose the reason may be that AVCodecContext alloc 10MB data during the call of avcodec_decode_video2 function. And this memory will not be released until the AVCodecContext is closed.
I do not know if I am right.
Main codes are in the following.
private bool readNextBuffer(int index)
{
/// Read frames into buffer
//m_codecContext->refcounted_frames = 0;
int frameNumber = 0;
FrameBuffer[index].Clear();
GC.Collect();
while (frameNumber < m_bufferSize)
{
AVPacket Packet; /// vedio packet
AVPacket* pPacket = &Packet;
//AVFrame* pDecodedFrame = FFmpegInvoke.avcodec_alloc_frame();
AVFrame* pDecodedFrame = FFmpegInvoke.av_frame_alloc();
if (FFmpegInvoke.av_read_frame(m_pFormatContext, pPacket) < 0)
{
Console.WriteLine("The end of the vedio.");
break;
}
if (pPacket->stream_index == pStream->index)
{
/// Decode vedio frame
int gotPicture = 0;
int size = FFmpegInvoke.avcodec_decode_video2(m_codecContext, pDecodedFrame, &gotPicture, pPacket);
if (size < 0)
{
Console.WriteLine("End of the vedio.");
//throw new Exception(string.Format("Error while decoding frame {0}", frameNumber));
break;
}
if (gotPicture == 1)
{
/// Allocate an AVFrame structure
if (convertFrame(pDecodedFrame, index))
{
frameNumber++;
}
else
{
Console.WriteLine("Error: convert failed.");
}
}
}
FFmpegInvoke.av_frame_free(&pDecodedFrame);
FFmpegInvoke.av_free_packet(pPacket);
GC.Collect();
}
nowFrameIndex = 0;
return FrameBuffer.Count > 0 ? true : false;
} -
How to play mp4 video file with HTML5 video tag on iOS (iPhone and iPad) ?
22 avril 2015, par MokielasI want to display HTML5 video to my users using the video tag. For Firefox, Chrome and Opera WEBM works as expected. In Safari on Windows and Mac my MP4 version works, too. The only problem I’m experiencing is, that it won’t play on iPad and iPhone (Safari of course).
Create video
The MP4 (h.264 + acc-lc) is converted like this (with profile : baseline and level 3.0 for maximum compatibility with iOS) :
- Stream #0:0(eng) : Video : h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x352, 198 kb/s, 17 fps, 17 tbr, 17408 tbn, 34 tbc (default)
- Stream #0:1(eng) : Audio : aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 56 kb/s (default)
Edit : Whole ffprobe output (slight changes in bitrate etc. to the above mentioned) :
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.30.100
Duration: 00:01:00.05, start: 0.046440, bitrate: 289 kb/s
Stream #0:0(eng): Video: h264 (Constrained Baseline)
(avc1 /0x31637661), yuv420p, 640x352, 198 kb/s, 25 fps, 25 tbr,
12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 85 kb/s (default)
Metadata:
handler_name : SoundHandlerI found various requirements for iOS devices like this and this, also someone mentioned to add the yuv420p pixel format when converting.
In fact the ffmpeg cmd looks like this :
ffmpeg -i __inputfile__ -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -b:v 200K -r 17 -bt 800K -c:a libfdk_aac -b:a 85k -ar 44100 -y __outputfile_lowversion__.mp4
Display video
With Modernizr I detect which format is "supported" and add it to the
src
or thevideo
tag. Last thing is adding the right MIME type. For mp4 I addtype="video/mp4"
. The full code for thevideo
tag is :<video class="p-video" preload="auto" autoplay="" type="video/mp4" src="http://full.url/to/video_low.mp4"></video>
I tried various ways : own implementation with own interface, controls and stuff from browser vendors and video.js just to check whether i’m too studip for this. All work in the environments listed above except for iPhone and iPad.
I read this article on Video on the web, especially this part and only serve the "right" file with the "right" type without a
poster
attribute set.My Apache has
AddType video/mp4 mp4 m4v f4v f4p
AddType video/ogg ogv
AddType video/webm webmAnd byte-ranges are enabled. This is needed to get partial content from the server.
Has anyone a clue what’s going on there ? Thanks in advance !
Edit : Safari and Chrome both throw
MEDIA_ERR_SRC_NOT_SUPPORTED
Error on iPad. There must be an issue with the encoding. -
Process is not exiting ffmpeg.exe only for the command which detects the silences from a video
20 juillet 2015, par Jitender KumarThe job of the method
ExecuteCommandSync
is to detect the silences from a video and return the output as string but when I run this code it never bring the value ofproc.HasExited
astrue
. If I forcefully drag the debugger to the lineresult =proc.StandardOutput.ReadToEnd()
then it never exit the
ffmpeg.exe
so as a result control never returns back.Although the same method is working fine for a different command like creating an audio file from a video. In this case
proc.HasExited
also returns false but it also generates the audio file successfully.public static string ExecuteCommandSync(string fileName, int timeoutMilliseconds)
{
string result = String.Empty;
string workingDirectory = Directory.GetCurrentDirectory();
try
{
string command = string.Format("ffmpeg -i {0} -af silencedetect=noise=-20dB:d=0.2 -f null -", "\"" + fileName + "\"");
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);
procStartInfo.WorkingDirectory = workingDirectory;
procStartInfo.RedirectStandardOutput = true;
procStartInfo.RedirectStandardError = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = false;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
proc.WaitForExit(timeoutMilliseconds);
// Get the output into a string
if (proc.HasExited)
{
if (!proc.StandardOutput.EndOfStream)
{
result = proc.StandardOutput.ReadToEnd();
}
else if (!proc.StandardError.EndOfStream)
{
result = "Error:: " + proc.StandardError.ReadToEnd();
}
}
}
catch (Exception)
{
throw;
}
return result;
}So please advice.