Recherche avancée

Médias (3)

Mot : - Tags -/plugin

Autres articles (45)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (8539)

  • FFMPEG : Add a fixed size image on a video, regardless of the video width & height (resolution)

    11 mars 2017, par Drupalist

    This 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 :

    enter image description here

    and this one

    enter image description here

    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.mp4

    and

    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.mp4

    that 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 result

    enter image description here

    and this one

    enter image description here

    Is it possible to improve this solution ?

  • FFMPEG merge two .mp4 videos - resolution distorted

    9 juin 2016, par Misha Moryachok

    I am trying to merge two .mp4 videos, and in some cases the seconds video part is distorted in the output video. Providing an example below :
    https://www.youtube.com/watch?v=wWMNTBWJ37A

    The real video is : https://www.youtube.com/watch?v=ASio-j-Epi8

    As you can see, we added intro before the real content, however, the real content is stretched.
    In my opinion it happens because first video is 1280x720 and the second is 460x720.

    Providing commands for merging videos :

    *1st step (convert the videos from .mp4 to .ts)

    ffmpeg -i videoPathMP4 -c copy -bsf:v h264_mp4toannexb -f mpegts videoPathTS

    *2nd step (merge videos)

    ffmpeg -i "concat:$video1 | $video2" -c copy -bsf:a aac_adtstoasc $meagePathMP4

    Video output is like you saw in provided videolink on youtube.
    I also tried to change the first video resolution to be like the second video :

    ffmpeg -i inputVideo.mp4 -s 460x720 outputVideo.mp4

    However it doesn’t helped.
    Is anyone know how to solve this ?
    Thanks

  • FFmpeg sws_scale crash at certain resolution

    23 mai 2016, par Tamás Szobonya

    I’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 ?