
Recherche avancée
Autres articles (96)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)
Sur d’autres sites (9503)
-
FFMPEG : Add a fixed size image on a video, regardless of the video width & height (resolution)
11 mars 2017, par DrupalistThis is my code that adds an image to videos, running via PHP :
exec('ffmpeg -i input.mp4 -i logo.png -filter_complex
"[0:v][1:v] overlay=10:10" -pix_fmt yuv420p -c:a copy output.mp4');It works well but the problem is, the image is scaled down or up, up on the video resolution. For example in the following images the logo width is
50px
but videos resolution are different :and this one
How can I prevent the image from scaling down/up ?
Update
Thanks to Mulvya, he proposed these codes
ffmpeg -i input.mp4 -i logo.png -filter_complex
"[1:v][0:v]scale2ref=(W/H)*ih/8:ih/8[wm][base];[base][wm]overlay=10:10"
-pix_fmt yuv420p -c:a copy output.mp4and
ffmpeg -i input.mp4 -i logo.png -filter_complex
"[1:v][0:v]scale2ref=(W/H)*ih/8:ih/8[wm][base];[wm]setsar=1[wmsar];
[base][wmsar]overlay=10:10"
-pix_fmt yuv420p -c:a copy output.mp4that works very well, but it doesn’t keep the logo aspect ratio.
I tried this code on two videos with different resolution and this is the resultand this one
Is it possible to improve this solution ?
-
FFmpeg sws_scale crash at certain resolution
23 mai 2016, par Tamás SzobonyaI’m having a weird issue with sws_scale. The problem is, that at certain resolutions i got an Access violation reading location exception. Resolutions like 1920x1080, 1600x900 works, but 1280x720 doesn’t ? This happens in a c++ cli code which is called from c#. Every project is x64 build (no Any CPU) on a Win7 x64.
c++ cli code :
void FFmpegWrapper::Codec::E(int width, int height, IntPtr dataIn, [Out] IntPtr %dataOut)
{
int ret;
AVFrame *f, *fIn, *fOut;
f = av_frame_alloc();
fIn = av_frame_alloc();
fOut = av_frame_alloc();
fIn->format = AV_PIX_FMT_RGB24;
fIn->width = width;
fIn->height = height;
ret = av_image_alloc(fIn->data, fIn->linesize, width, height, AV_PIX_FMT_RGB24, 32);
f->format = AV_PIX_FMT_YUV420P;
f->width = width;
f->height = height;
ret = av_image_alloc(f->data, f->linesize, width, height, AV_PIX_FMT_YUV420P, 32);
fOut->format = AV_PIX_FMT_RGB24;
fOut->width = width;
fOut->height = height;
ret = av_image_alloc(fOut->data, fOut->linesize, width, height, AV_PIX_FMT_RGB24, 32);
uint8_t *data = (uint8_t*)dataIn.ToPointer();
fIn->data[0] = data;
//with or without struct no difference
/*struct */SwsContext *convertCtx = sws_getContext(width, height, AV_PIX_FMT_RGB24, width, height, AV_PIX_FMT_YUV420P, 0, NULL, NULL, NULL);
// CRASH here
sws_scale(convertCtx, fIn->data, fIn->linesize, 0, height, f->data, f->linesize);
convertCtx = sws_getContext(width, height, AV_PIX_FMT_YUV420P, width, height, AV_PIX_FMT_RGB24, 0, NULL, NULL, NULL);
sws_scale(convertCtx, f->data, f->linesize, 0, height, fOut->data, fOut->linesize);
dataOut = (IntPtr)fIn->data[0];
}And its called from c# like this :
FFmpegWrapper.Codec test = new FFmpegWrapper.Codec();
Bitmap image = new Bitmap(w, h, PixelFormat.Format24bppRgb);
// Get a screenshot from the desktop
Screen.Capture(w, h, image, PixelFormat.Format24bppRgb);
Rectangle rec = new Rectangle(0, 0, image.Width, image.Height);
BitmapData bitmapData = image.LockBits(rec, ImageLockMode.ReadWrite, image.PixelFormat);
IntPtr ptr = bitmapData.Scan0;
IntPtr testptr1;
test.E(w, h, ptr, out testptr1);
// We never reach this with 1280x720 resolution
Bitmap bmp = new Bitmap(w, h, w * 3, PixelFormat.Format24bppRgb, testptr1);
bmp.Save(@"H:\sajt1.bmp", ImageFormat.Bmp);What i don’t understand is, how can it work with certain resolutions and crash with others ?
Using 20160512-git-cd244fa-win64 version of ffmpeg.Edit :
It seems, that changing AV_PIX_FMT_RGB24 to AV_PIX_FMT_BGR24 fixes it, but I’m not sure why. I know that .Net stores the pixels in bgr, but why does wrong format crashes it ? And only at some resolutions ? -
Taking a high resolution picture with FFMPEG and Webcam
13 mai 2016, par user2088176I have a Microsoft LifeCam VX-3000 and I want to capture a single image from this video source.
I have tried DirectShow :
ffmpeg -f dshow -video_size 1280x960 -i video="Microsoft LifeCam VX-3000" -vframes 1 file.jpg
[dshow @ 01D69340] Could not set video optionsand
Microsoft WDM Image Capture :ffmpeg -f vfwcap -video_size 1280x960 -i video="Microsoft LifeCam VX-3000" -vframes 1 file.jpg
[vfwcap @ 01D79340] Could not set Video Format.If I lower the video size to 640x480, it works, but every sites tells me that 640x480 is the maximum video resolution, but the still picture maximum resolution is 1280x960. Like here
I would like to capture the image at the highest resolution possible. Is there a way to do it with FFMPEG ? What command-line options should I give it ?
Thank you very much.