
Recherche avancée
Médias (2)
-
Core Media Video
4 avril 2013, par
Mis à jour : Juin 2013
Langue : français
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (107)
-
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. -
Ajout d’utilisateurs manuellement par un administrateur
12 avril 2011, parL’administrateur d’un canal peut à tout moment ajouter un ou plusieurs autres utilisateurs depuis l’espace de configuration du site en choisissant le sous-menu "Gestion des utilisateurs".
Sur cette page il est possible de :
1. décider de l’inscription des utilisateurs via deux options : Accepter l’inscription de visiteurs du site public Refuser l’inscription des visiteurs
2. d’ajouter ou modifier/supprimer un utilisateur
Dans le second formulaire présent un administrateur peut ajouter, (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (14136)
-
Memory Leak in c++/cli application
10 décembre 2013, par AnkushI am passing bitmap from my c# app to c++/cli dll that add it to video.
The problem is program slowly leaking memory. I tried _CrtDumpMemoryLeaks() shows me leak of bitmap & another 40 byte leak but i am disposing bitmap.
Can anyone see memory leak, Here is code..Flow :
1) Capture screenshot by takescreenshot()
2) pass it to c++/cli function
3) dispose bitmap
lines from my c# app
Bitmap snap = takescreeshot();
vencoder.AddBitmap(snap);
snap.Dispose();
vencoder.printleak();
private static Bitmap takescreeshot()
{
System.Drawing.Bitmap bitmap = null;
System.Drawing.Graphics graphics = null;
bitmap = new Bitmap
(
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb
);
graphics = System.Drawing.Graphics.FromImage(bitmap);
graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size);
//Write TimeSpamp
Rectangle rect = new Rectangle(1166, 738, 200, 20);
String datetime= System.String.Format("{0:dd:MM:yy hh:mm:ss}",DateTime.Now);
System.Drawing.Font sysfont = new System.Drawing.Font("Times New Roman", 14, FontStyle.Bold);
graphics.DrawString(datetime, sysfont, Brushes.Red,rect);
//
Grayscale filter = new Grayscale(0.2125, 0.7154, 0.0721);
Bitmap grayImage = filter.Apply(bitmap);
//Dispose
bitmap.Dispose();
graphics.Dispose();
return grayImage;
}now in c++/cli dll
bool VideoEncoder::AddBitmap(Bitmap^ bitmap)
{
BitmapData^ bitmapData = bitmap->LockBits( System::Drawing::Rectangle( 0, 0,bitmap->Width, bitmap->Height ),ImageLockMode::ReadOnly,PixelFormat::Format8bppIndexed);
uint8_t* ptr = reinterpret_cast( static_cast( bitmapData->Scan0 ) );
uint8_t* srcData[4] = { ptr, NULL, NULL, NULL };
int srcLinesize[4] = { bitmapData->Stride, 0, 0, 0 };
pCurrentPicture = CreateFFmpegPicture(pVideoStream->codec->pix_fmt, pVideoStream->codec->width, pVideoStream->codec->height);
sws_scale(pImgConvertCtx, srcData, srcLinesize, 0, bitmap->Height, pCurrentPicture->data, pCurrentPicture->linesize );
bitmap->UnlockBits( bitmapData );
write_video_frame();
bitmapData=nullptr;
ptr=NULL;
return true;
}
AVFrame * VideoEncoder::CreateFFmpegPicture(int pix_fmt, int nWidth, int nHeight)
{
AVFrame *picture = NULL;
uint8_t *picture_buf = NULL;
int size;
picture = avcodec_alloc_frame();
if ( !picture)
{
printf("Cannot create frame\n");
return NULL;
}
size = avpicture_get_size((AVPixelFormat)pix_fmt, nWidth, nHeight);
picture_buf = (uint8_t *) av_malloc(size);
if (!picture_buf)
{
av_free(picture);
printf("Cannot allocate buffer\n");
return NULL;
}
avpicture_fill((AVPicture *)picture, picture_buf,
(AVPixelFormat)pix_fmt, nWidth, nHeight);
return picture;
}
void VideoEncoder::write_video_frame()
{
AVCodecContext* codecContext = pVideoStream->codec;
int out_size, ret = 0;
if ( pFormatContext->oformat->flags & AVFMT_RAWPICTURE )
{
printf( "raw picture must be written" );
}
else
{
out_size = avcodec_encode_video( codecContext, pVideoEncodeBuffer,nSizeVideoEncodeBuffer, pCurrentPicture );
if ( out_size > 0 )
{
AVPacket packet;
av_init_packet( &packet );
if ( codecContext->coded_frame->pts != AV_NOPTS_VALUE )
{
packet.pts = av_rescale_q( packet.pts, codecContext->time_base, pVideoStream->time_base );
}
if ( codecContext->coded_frame->pkt_dts != AV_NOPTS_VALUE )
{
packet.dts = av_rescale_q( packet.dts, codecContext->time_base, pVideoStream->time_base );
}
if ( codecContext->coded_frame->key_frame )
{
packet.flags |= AV_PKT_FLAG_KEY;
}
packet.stream_index = pVideoStream->index;
packet.data = pVideoEncodeBuffer;
packet.size = out_size;
ret = av_interleaved_write_frame( pFormatContext, &packet );
av_free_packet(&packet);
av_freep(pCurrentPicture);
}
else
{
// image was buffered
}
}
if ( ret != 0 )
{
throw gcnew Exception( "Error while writing video frame." );
}
}
void VideoEncoder::printleak()
{
printf("No of leaks: %d",_CrtDumpMemoryLeaks());
printf("\n");
} -
12 ways Matomo Analytics helps you to protect your visitor’s privacy
-
Redux : how to add subtitles to mp4 using ffmpeg ?
25 novembre 2015, par stachyraI have a tiny little example mp4 video (which unfortunately stack overflow won’t allow me to embed directly inside my question). Following the advice previously offered in this answer, I’d like to add a subtitle to the video, which will flash on the screen for 2 seconds, using an .srt file that looks like this :
1
00:00:02,000 --> 00:00:04,000
Test subtitleAs provided in the link above, I issue a command that looks like this :
ffmpeg -i small.mp4 -f srt -i small.srt -c:v copy -c:a copy -c:s mov_text small_subtitles.mp4 >& err.log
And the
err.log
file looks like this :ffmpeg version N-76950-g401c93d-tessus Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil 55. 7.100 / 55. 7.100
libavcodec 57. 15.100 / 57. 15.100
libavformat 57. 17.100 / 57. 17.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 15.100 / 6. 15.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'small.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.40.101
Duration: 00:00:10.02, start: 0.000000, bitrate: 23 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 188x112 [SAR 1:1 DAR 47:28], 17 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
Metadata:
handler_name : VideoHandler
Input #1, srt, from 'small.srt':
Duration: N/A, bitrate: N/A
Stream #1:0: Subtitle: subrip
[mp4 @ 0x7f8492848000] Codec for stream 0 does not use global headers but container format requires global headers
Output #0, mp4, to 'small_subtitles.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.17.100
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 188x112 [SAR 1:1 DAR 47:28], q=2-31, 17 kb/s, 60 fps, 60 tbr, 15360 tbn, 15360 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1: Subtitle: mov_text ([8][0][0][0] / 0x0008) (default)
Metadata:
encoder : Lavc57.15.100 mov_text
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (subrip (srt) -> mov_text (native))
Press [q] to stop, [?] for help
frame= 601 fps=0.0 q=-1.0 Lsize= 29kB time=00:00:09.96 bitrate= 24.0kbits/s
video:21kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 39.561928%The resulting output,
small_subtitles.mp4
, does not seem to have the expected subtitle present.Furthermore, the error message,
[mp4 @ 0x7f8492848000] Codec for stream 0 does not use global headers but container format requires global headers
is highlighted in bold colors when I run this at the command line without capturing the
err.log
file (which makes me think it must be a significant message), although I am unable to reproduce that special print formatting easily here.I’ve also tried this method, but with the .avi replaced by .mp4, and it seems to just fail silently—no obvious error message, but also no subtitle in the resulting video either.
Anybody have an idea how to fix this ? In particular, what does the business about global headers mean ?
I’m working on OS X and am open to hearing answers that would use other open source tools as well.