Recherche avancée

Médias (91)

Autres articles (112)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (9716)

  • 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 avformat_write_header always returns 0

    24 octobre 2015, par gabe.roze

    We’ve asked a freelancer to build a video encoder with FFMPeg for iOS but there is a bug and the freelancer is no longer available. I very inexperienced in FFMpeg and video encoding and am trying to debug this error.

    From what I understand, we’re attempting to create an output file and create a header for it however, avformat_write_header is always less than zero. If I comment it out, it does not work

    - (BOOL) writeHeaderWithError:(NSError *__autoreleasing *)error {
       AVDictionary *options = NULL;

       // Write header for output file
       int writeHeaderValue = avformat_write_header(self.formatContext, &amp;options);
       if (writeHeaderValue &lt; 0) {
           if (error != NULL) {
               *error = [FFUtilities errorForAVError:writeHeaderValue];
           }
           av_dict_free(&amp;options);
           return NO;
       }
       av_dict_free(&amp;options);
       return YES;
    }

    Below is some relevant code of how we instantiate a FFOutputFile

       - (AVFormatContext*) formatContextForOutputPath:(NSString*)outputPath options:(NSDictionary*)options {
       AVFormatContext *outputFormatContext = NULL;
       NSString *outputFormatString = [options objectForKey:kFFmpegOutputFormatKey];

       int openOutputValue = avformat_alloc_output_context2(&amp;outputFormatContext, NULL, [outputFormatString UTF8String], [outputPath UTF8String]);
       if (openOutputValue &lt; 0) {
           avformat_free_context(outputFormatContext);
           return nil;
       }
       return outputFormatContext;
    }

    - (void) addOutputStream:(FFOutputStream*)outputStream {
       [self.streams addObject:outputStream];
    }

    - (id) initWithPath:(NSString *)path options:(NSDictionary *)options {
       if (self = [super initWithPath:path options:options]) {
           self.formatContext = [self formatContextForOutputPath:path options:options];
           self.streams = [NSMutableArray array];
           self.bitstreamFilters = [NSMutableSet set];
       }
       return self;
    }
  • FFMpeg avformat_write_header always returns < 0

    7 mai 2024, par gabe.roze

    We've asked a freelancer to build a video encoder with FFMPeg for iOS but there is a bug and the freelancer is no longer available. I very inexperienced in FFMpeg and video encoding and am trying to debug this error.

    &#xA;&#xA;

    From what I understand, we're attempting to create an output file and create a header for it however, avformat_write_header is always less than zero. If I comment it out, it does not work

    &#xA;&#xA;

    - (BOOL) writeHeaderWithError:(NSError *__autoreleasing *)error {&#xA;    AVDictionary *options = NULL;&#xA;&#xA;    // Write header for output file&#xA;    int writeHeaderValue = avformat_write_header(self.formatContext, &amp;options);&#xA;    if (writeHeaderValue &lt; 0) {&#xA;        if (error != NULL) {&#xA;            *error = [FFUtilities errorForAVError:writeHeaderValue];&#xA;        }&#xA;        av_dict_free(&amp;options);&#xA;        return NO;&#xA;    }&#xA;    av_dict_free(&amp;options);&#xA;    return YES;&#xA;}&#xA;

    &#xA;&#xA;

    Below is some relevant code of how we instantiate a FFOutputFile

    &#xA;&#xA;

        - (AVFormatContext*) formatContextForOutputPath:(NSString*)outputPath options:(NSDictionary*)options {&#xA;    AVFormatContext *outputFormatContext = NULL;&#xA;    NSString *outputFormatString = [options objectForKey:kFFmpegOutputFormatKey];&#xA;&#xA;    int openOutputValue = avformat_alloc_output_context2(&amp;outputFormatContext, NULL, [outputFormatString UTF8String], [outputPath UTF8String]);&#xA;    if (openOutputValue &lt; 0) {&#xA;        avformat_free_context(outputFormatContext);&#xA;        return nil;&#xA;    }&#xA;    return outputFormatContext;&#xA;}&#xA;&#xA;- (void) addOutputStream:(FFOutputStream*)outputStream {&#xA;    [self.streams addObject:outputStream];&#xA;}&#xA;&#xA;- (id) initWithPath:(NSString *)path options:(NSDictionary *)options {&#xA;    if (self = [super initWithPath:path options:options]) {&#xA;        self.formatContext = [self formatContextForOutputPath:path options:options];&#xA;        self.streams = [NSMutableArray array];&#xA;        self.bitstreamFilters = [NSMutableSet set];&#xA;    }&#xA;    return self;&#xA;}&#xA;

    &#xA;