Recherche avancée

Médias (1)

Mot : - Tags -/getid3

Autres articles (78)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (8508)

  • Not able to link ffmpeg library in cython package

    12 août 2020, par Sagar Donadkar

    I am using cython package to call Cpp API and in my cpp code i am using ffmpeg library when i try to build my code i got and linking issue
In header file add include ffmpeg header file to call ffmpeg library function

    


    header file&#xA;#ifndef RECTANGLE_H&#xA;#define RECTANGLE_H&#xA;#include <iostream>&#xA;&#xA;extern "C"&#xA;{&#xA;    #include "libavformat/avformat.h"&#xA;    #include "libavutil/dict.h"&#xA;}&#xA;&#xA;using namespace std;&#xA;&#xA;namespace shapes &#xA;{&#xA;    class Rectangle {&#xA;        public:&#xA;            int x0, y0, x1, y1;&#xA;            Rectangle();&#xA;            Rectangle(int x0, int y0, int x1, int y1);&#xA;            ~Rectangle();&#xA;            int getArea();&#xA;            int ffmpegFile();&#xA;            void getSize(int* width, int* height);&#xA;            void move(int dx, int dy);&#xA;    };&#xA;}&#xA;&#xA;#endif&#xA;</iostream>

    &#xA;

    Rectangle.Cpp file in ffmpegFile() i am using ffmpeg example code to test ffmpeg my code where i call mostly ffmpeg API

    &#xA;

    &#xA;#include <iostream>&#xA;#include "Rectangle.hpp"&#xA;&#xA;namespace shapes {&#xA;    &#xA;&#xA;    // Default constructor&#xA;    Rectangle::Rectangle () {}&#xA;&#xA;    // Overloaded constructor&#xA;    Rectangle::Rectangle (int x0, int y0, int x1, int y1) {&#xA;        this->x0 = x0;&#xA;        this->y0 = y0;&#xA;        this->x1 = x1;&#xA;        this->y1 = y1;&#xA;    }&#xA;&#xA;    // Destructor&#xA;    Rectangle::~Rectangle () {}&#xA;&#xA;    // Return the area of the rectangle&#xA;    int Rectangle::getArea () {&#xA;        return 10;&#xA;    }&#xA;&#xA;    // Get the size of the rectangle.&#xA;    // Put the size in the pointer args&#xA;    void Rectangle::getSize (int *width, int *height) {&#xA;        (*width) = x1 - x0;&#xA;        (*height) = y1 - y0;&#xA;    }&#xA;&#xA;    // Move the rectangle by dx dy&#xA;    void Rectangle::move (int dx, int dy) {&#xA;        this->x0 &#x2B;= dx;&#xA;        this->y0 &#x2B;= dy;&#xA;        this->x1 &#x2B;= dx;&#xA;        this->y1 &#x2B;= dy;&#xA;    }&#xA;    int Rectangle::ffmpegFile()&#xA;    {&#xA;        AVFormatContext *fmt_ctx = NULL;&#xA;        AVDictionaryEntry *tag = NULL;&#xA;        int ret = 0;&#xA;        char* filename = "D:\\Discovery.mp4";&#xA;&#xA;        if ((ret = avformat_open_input(&amp;fmt_ctx, filename, NULL, NULL)))&#xA;            return ret;&#xA;&#xA;        if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) &lt; 0) {&#xA;            av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");&#xA;            return ret;&#xA;        }&#xA;&#xA;        while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))&#xA;            printf("%s=%s\n", tag->key, tag->value);&#xA;&#xA;        avformat_close_input(&amp;fmt_ctx);&#xA;        return ret;&#xA;    }&#xA;}&#xA;</iostream>

    &#xA;

    Rectangle.pxd file declaration for cpp file function and variable

    &#xA;

    cdef extern from "Rectangle.cpp":&#xA;    pass&#xA;cdef extern from "Rectangle.hpp" namespace "shapes":&#xA;    cdef cppclass Rectangle:&#xA;        Rectangle() except &#x2B;&#xA;        Rectangle(int, int, int, int) except &#x2B;&#xA;        int x0, y0, x1, y1&#xA;        int getArea()&#xA;        void getSize(int* width, int* height)&#xA;        void move(int, int)&#xA;        int ffmpegFile()&#xA;

    &#xA;

    rect.pyx file i am calling cpp API form pyx file

    &#xA;

    # distutils: language = c&#x2B;&#x2B;&#xA;&#xA;from Rectangle cimport Rectangle&#xA;&#xA;cdef class PyRectangle:&#xA;    cdef Rectangle c_rect  # Hold a C&#x2B;&#x2B; instance which we&#x27;re wrapping&#xA;&#xA;    def __cinit__(self, int x0, int y0, int x1, int y1):&#xA;        self.c_rect = Rectangle(x0, y0, x1, y1)&#xA;&#xA;    def get_area(self):&#xA;        return self.c_rect.getArea()&#xA;&#xA;    def get_size(self):&#xA;        cdef int width, height&#xA;        self.c_rect.getSize(&amp;width, &amp;height)&#xA;        return width, height&#xA;&#xA;    def move(self):&#xA;        print(self.c_rect.ffmpegFile())&#xA;

    &#xA;

    setup.py&#xA;I provided pyx file and ffmpeg library path as well as include path

    &#xA;

    from setuptools import setup,Extension&#xA;from Cython.Build import cythonize &#xA;&#xA;&#xA;directives={&#x27;linetrace&#x27;:False, &#x27;language_level&#x27;:3}&#xA;&#xA;setup(name = &#x27;superfastcode&#x27;, version = &#x27;1.0&#x27;,&#xA;    description = &#x27;Python Package with superfastcode C&#x2B;&#x2B; extension&#x27;,&#xA;    ext_modules=cythonize([&#xA;    Extension(&#xA;        &#x27;demo&#x27;,["rect.pyx"],&#xA;        include_dirs=[&#x27;ffmpeg\\include&#x27;],)&#xA;        library_dirs=["ffmpeg\\lib"],&#xA;        libraries=["avcodec","avformat","avutil","swscale","avdevice","avfilter","postproc","swresample"]),&#xA;        &#xA;]))&#xA;

    &#xA;

    getting below error

    &#xA;

    PS D:\SiVUE\Backend\Cython\demo> python setup.py build_ext --inplace&#xA;Compiling rect.pyx because it depends on .\Rectangle.pxd.&#xA;[1/1] Cythonizing rect.pyx&#xA;C:\python3.8\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive &#x27;language_level&#x27; not set, using 2 for now (Py2). This will change in a later release! File: D:\SiVUE\Backend\Cython\demo\rect.pyx&#xA;  tree = Parsing.p_module(s, pxd, full_module_name)&#xA;running build_ext&#xA;building &#x27;demo&#x27; extension&#xA;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I. -Iffmpeg\include -IC:\python3.8\include -IC:\python3.8\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tprect.cpp /Fobuild\temp.win32-3.8\Release\rect.obj&#xA;rect.cpp&#xA;C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:ffmpeg\lib /LIBPATH:C:\python3.8\libs /LIBPATH:C:\python3.8\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.18362.0\um\x86" avcodec.lib avformat.lib avutil.lib swscale.lib avdevice.lib avfilter.lib postproc.lib swresample.lib /EXPORT:PyInit_demo build\temp.win32-3.8\Release\rect.obj /OUT:build\lib.win32-3.8\demo.cp38-win32.pyd /IMPLIB:build\temp.win32-3.8\Release\demo.cp38-win32.lib&#xA;   Creating library build\temp.win32-3.8\Release\demo.cp38-win32.lib and object build\temp.win32-3.8\Release\demo.cp38-win32.exp&#xA;rect.obj : error LNK2001: unresolved external symbol _avformat_open_input&#xA;rect.obj : error LNK2001: unresolved external symbol _av_log&#xA;rect.obj : error LNK2001: unresolved external symbol _avformat_close_input&#xA;rect.obj : error LNK2001: unresolved external symbol _avformat_find_stream_info&#xA;rect.obj : error LNK2001: unresolved external symbol _av_dict_get&#xA;build\lib.win32-3.8\demo.cp38-win32.pyd : fatal error LNK1120: 5 unresolved externals&#xA;error: command &#x27;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x86\\link.exe&#x27; failed with exit status 1120&#xA;

    &#xA;

    Thank You

    &#xA;

  • probing individual klv streams for specific signature/header

    17 juin 2019, par J Heyman

    Currently, the software I support processes the different streams within a video container (.ts, .mp4, .mpg, etc) without any issues as long as there is only one(1) type of each codec stream.

    I’ve recently encountered a video sample that actually contains three(3) identified AV_CODE_ID_SMPTE_KLV streams. As I loop through the three streams, one of them is the stream I need.
    I haven’t been able to figure out an easy way to do the specific query I need (check for known header bytes in the stream).

       ...
       for (i = 0; i &lt; nb_streams; i++) {
          int real_stream_index = program ? program[i] : i;
          AVStream *st          = ic->streams[real_stream_index];
          AVCodecParameters *par = st->codecpar;
          if (par->codec_type != type)
             continue;
          if (id != AV_CODEC_ID_NONE) {
             if (par->codec_id != id)
                continue;
          }
          if (wanted_stream_nb >= 0 &amp;&amp; real_stream_index != wanted_stream_nb)
             continue;
          if (type == AVMEDIA_TYPE_AUDIO &amp;&amp; !(par->channels &amp;&amp; par->sample_rate))
             continue;
          disposition = !(st->disposition &amp; (AV_DISPOSITION_HEARING_IMPAIRED | AV_DISPOSITION_VISUAL_IMPAIRED));
          count = st->codec_info_nb_frames;
          bitrate = par->bit_rate;
          multiframe = FFMIN(5, count);
          if ((best_disposition >  disposition) ||
              (best_disposition == disposition &amp;&amp; best_multiframe >  multiframe) ||
              (best_disposition == disposition &amp;&amp; best_multiframe == multiframe &amp;&amp; best_bitrate >  bitrate) ||
              (best_disposition == disposition &amp;&amp; best_multiframe == multiframe &amp;&amp; best_bitrate == bitrate &amp;&amp; best_count >= count))
             continue;
          best_disposition = disposition;
          best_count   = count;
          best_bitrate = bitrate;
          best_multiframe = multiframe;
          ret          = real_stream_index;

    My thought was to add another || to the complex if{} above, but I haven’t been able to figure out how to do the comparison I need (looking for the header bytes).

    I’ve looked into existing documentation, and thought that accessing the probe_data structure within the AVStream contained within the AVFormatContext structure would give me the first few bytes of the stream. No such luck, as the probe_data structure is empty even though we’ve done a probe on the file itself.

    fprintf(stderr, "Filename: %s\t buf_size: %d\n", st-> probe_data.filename, st-> probe_data.buf_size);
  • Extract individual frames from video and pipe them to StandardOutput in FFmpeg

    13 novembre 2019, par Nicke Manarin

    I’m trying to extract frames from a video using FFmpeg. But instead of letting FFmpeg write the files to disk, I’m trying to get the frames directly from StandardOutput.

    I’m not sure if it’s feasible. I’m expecting to get each frame individually as they get decoded by reading and waiting until all frames are extracted.

    With the current code, I think that I’m getting all frames at once.


    Command

    ffmpeg -i "C:\video.mp4" -r 30 -ss 00:00:10.000 -to 00:01:20.000 -hide_banner -c:v png -f image2pipe -

    Code

    var start = TimeSpan.FromMilliseconds(SelectionSlider.LowerValue);
    var end = TimeSpan.FromMilliseconds(SelectionSlider.UpperValue);

    var info = new ProcessStartInfo(UserSettings.All.FfmpegLocation)
    {
       Arguments = $" -i \"{VideoPath}\" -r {fps} -ss {start:hh\\:mm\\:ss\\.fff} " +
           "-to {end:hh\\:mm\\:ss\\.fff} -hide_banner -c:v png -f image2pipe -",
       CreateNoWindow = true,
       ErrorDialog = false,
       UseShellExecute = false,
       RedirectStandardError = true,
       RedirectStandardOutput = true
    };

    var process = new Process();
    process.StartInfo = info;
    process.Start();

    while (!process.StandardOutput.EndOfStream)
    {
       if (_cancelled)
       {
           process.Kill();
           return;
       }

       //This returns me the entire byte array, of all frames.
       var bytes = default(byte[]);
       using (var memstream = new MemoryStream())
       {
           process.StandardOutput.BaseStream.CopyTo(memstream);
           bytes = memstream.ToArray();
       }
    }

    I also tried to use process.BeginOutputReadLine() and wait for each frame in OutputDataReceived. But it returns parts of each frame, like the 10 first bytes, than other 50 bytes, it’s erratic.

    Is there any way to get the frames separately via the output stream ?