Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (78)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (6353)

  • Resize videos with ffmpeg - Keep aspect ratio

    8 juin 2020, par ColinShark

    I'm trying to write a script for a telegram userbot that can convert any video/animation to a .mp4. I already have it so the script communicates and utilizes the API of cloudconvert.com.

    



    Now my problem lies within the ffmpeg command that I'm passing to CC, as I need to keep videos below 1280 pixels on either side. It doesn't matter if the final video is 720*1280 or 1280*1280 or something completely else, as long as neither of the two sides surpass 1280 pixels.

    



    Here comes the tricky part, I don't want to ruin the aspect ratio and I don't want the video to be upscaled if it's smaller than 1280.

    



    The part of code that is actually relevant is the scale portion.
This following piece will resize a video to maximum 1280 pixels in height, but doesn't take the width into account, it just keeps the ratio.

    



    -vf "scale=min'(1280,iw)':-2"

    



    Now how would I have to either adapt it or change it so it will actually resize depending on which side is greater than 1280 pixels ?

    



    I hope I'm being specific enough and I'm looking forward to your help.

    


  • c++ avformat_open_input returns empty codec, width and height

    27 février 2019, par Victor Akhlynin

    I haven’t ever used ffmpeg on my own laptop. All’s ok at work, but here I met an ugly problem : library works but helpless :)
    Ubuntu 18.04, ffmpeg 4.1 (downloaded sources, ./configure, make, sudo make install), it seems to be ok.

    Application returns :
    File /home/ahlininv/Desktop/video_example.mp4 is encodec with ’’ codec, w = 0, h = 0

    I ran it under debugger. If I set format to zero, pointer changes after calling avformat_open_input(&format, file, 0, &dict), so it works and maybe works correct.

    Maybe it plays any role that compiler says that av_register_all, avcodec_register_all are deprecated, but I thought it’s not significant problem.

    I tried to change version of ffmpeg (tried to install it with apt-get, version 3.somenumber is available), nothing changed.

    I tried to run another video file (.avi), nothing changed, too.

    Guys, help=) How to this file’s info correctly ?

    main.cpp :

    #include "filereader.h"

    int main(int argc, char** argv) {

       std::string filename = "/home/ahlininv/Desktop/video_example.mp4";

       std::string codec;
       int w, h;
       bool open_ok = get_file_info(filename.c_str(), codec, w, h);
       if (!open_ok) {
           std::cout << "Failed to open file" << "\n";
           return 1;
       }

       std::cout << "File " << filename << " is encoded with '" << codec << "' codec, w = " << w << ", h = " << h << "\n";

       return 0;
    }

    filereader.h :

    #ifndef FILEREADER_H
    #define FILEREADER_H

    #include <string>
    #include <iostream>

    extern "C" {
    #ifndef __STDC_CONSTANT_MACROS
    #define __STDC_CONSTANT_MACROS
    #endif
    #include "libavcodec/avcodec.h"
    #include <libavformat></libavformat>avformat.h>
    #include <libavutil></libavutil>avutil.h>
    }

    bool get_file_info(const char* file, std::string&amp; codec, int&amp; w, int&amp; h);

    #endif // FILEREADER_H
    </iostream></string>

    filereader.cpp

    #include "filereader.h"


    bool get_file_info(const char* file, std::string&amp; codec, int&amp; w, int&amp; h)
    {
       codec = "";
       w = h = 0;

       av_register_all();
       avcodec_register_all();

       AVDictionary* dict = 0;
       AVFormatContext* format = avformat_alloc_context();

       char errbuf[256];
       int r = avformat_open_input(&amp;format, file, 0, &amp;dict);
       if (r!=0){
           av_strerror(r, errbuf, sizeof(errbuf));
           std::cout &lt;&lt; "avformat_open_input error: " &lt;&lt; errbuf &lt;&lt; "\n";
       }

       if (r == AVERROR(EIO) || r == AVERROR(ENOEXEC) || !format)
           return false;

       for (size_t c = 0; c &lt; format->nb_streams; ++c)
       {
           if (format->streams[c]->codecpar &amp;&amp; format->streams[c]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
           {
               if (format->streams[c]->codecpar->codec_id != AV_CODEC_ID_NONE &amp;&amp;
                       format->streams[c]->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO)
               {
                   w = format->streams[c]->codecpar->width;
                   h = format->streams[c]->codecpar->height;
                   codec = avcodec_get_name(format->streams[c]->codecpar->codec_id);
               }
           }
       }
       avformat_close_input(&amp;format);
       return true;
    }

    Compile :

    g++ -o filereader main.cpp filereader.cpp -lavutil -lavformat -lavcodec -lavdevice -lz -lm -pthread -lswresample -lm -lz -I /usr/local/include/ -Wl,-rpath /usr/lib/x86_64-linux-gnu/
  • FFMPEG : How do I maintain the aspect ratio of various images used in a slideshow ?

    7 mars 2019, par Kimberly W

    I’m just starting out with FFMPEG and trying to use it to make a slideshow. Ideally, I’d like to get it where I can input an arbitrary number of images, and each image is shown for (example) 2 seconds and them moves on to the next. Each image also maintains it’s original aspect ratio and is not stretched in any way (they can of course be scaled up/down to fit the resolution of the output video).

    I started off with a basic command like the following.

    ffmpeg -r 1/9 -pattern_type glob -i "*.jpg" -c:v libx264 -y -pix_fmt yuv420p -vf scale="720:trunc(ow/a/2)*2" out.mp4

    In this example, the first image is a wide (landscape) image and some of the others are tall (portrait) images. The portrait ones get squished in output video. Also the images aren’t displayed for equal amount of times.

    A couple of problems I’ve been running into :

    1. There’s an error for width not divisible by 2, because the images can be literally any random width. To resolve that, I’ve been trying various -vf options I’ve found through googling (like the one above). They take care of the error, but don’t solve my aspect ratio issue.
    2. All the images seem to be stretch or squished to fit the dimensions of the first input image. In reality, the images are of various different dimensions (like frames in a comic book). There’s no pattern to them.

    Is there a ffmpeg command for just taking images and creating as slideshow, while preserving their original aspect ratios ?