Recherche avancée

Médias (1)

Mot : - Tags -/ticket

Autres articles (94)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The 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 (...)

  • 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

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

Sur d’autres sites (6555)

  • How does ffmpeg extract audio data from mp3 files ?

    13 août 2022, par aszswaz

    In the ffmpeg documentation, an example of mp2 decoding is given. I try to apply this to mp3 :

    


    #define SOURCE_FILE "ignore/audio01.mp3"
#define TARGET_FILE "ignore/target-audio01.pcm"
#define AUDIO_INBUF_SIZE 20480
#define AUDIO_REFILL_THRESH 4096
#define av_perr(errnum) \
    char av_err_buff[AV_ERROR_MAX_STRING_SIZE]; \
    av_strerror(errnum, (char *) &av_err_buff, AV_ERROR_MAX_STRING_SIZE); \
    fprintf(stderr, "\033[91m%s\033[0m\n", av_err_buff);

static int decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile) {
    int ret, i, j;
    int data_size;

    ret = avcodec_send_packet(dec_ctx, pkt);
    if (ret < 0) {
        av_perr(ret);
        return EXIT_FAILURE;
    }

    while (ret >= 0) {
        ret = avcodec_receive_frame(dec_ctx, frame);
        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
            break;
        } else if (ret < 0) {
            av_perr(ret);
            return EXIT_FAILURE;
        }
        data_size = av_get_bytes_per_sample(dec_ctx->sample_fmt);
        if (data_size < 0) {
            av_perr(data_size);
            return EXIT_FAILURE;
        }
        for (i = 0; i < frame->nb_samples; i++) {
            for (j = 0; j < dec_ctx->channels; j++) {
                fwrite(frame->data[j] + data_size * i, 1, data_size, outfile);
            }
        }
    }

    return EXIT_SUCCESS;
}

#define IS_NULL_PTR(ptr, message) \
    if (!ptr) { \
        fprintf(stderr, "\033[91m%s\033[0m\n", message); \
        goto FINALLY; \
    }
#define av_perr(errnum) \
    char av_err_buff[AV_ERROR_MAX_STRING_SIZE]; \
    av_strerror(errnum, (char *) &av_err_buff, AV_ERROR_MAX_STRING_SIZE); \
    fprintf(stderr, "\033[91m%s\033[0m\n", av_err_buff);

int main(int argc, char **argv) {
    const AVCodec *codec;
    AVCodecContext *c = nullptr;
    AVCodecParserContext *parser = nullptr;
    enum AVSampleFormat sfmt;

    int ret = 0, len = 0, n_channels = 0;
    FILE *source_file = nullptr, *target_file = nullptr;
    const char *fmt = nullptr;
    uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
    uint8_t *data = nullptr;
    size_t data_size = 0;
    AVPacket *pkt = nullptr;
    AVFrame *decode_frame = nullptr;

    ...

    data = inbuf;
    data_size = fread(inbuf, 1, AUDIO_INBUF_SIZE, source_file);
    while (data_size > 0) {
        ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size, data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
        if (ret < 0) {
            fprintf(stderr, "\033[91mError while parsing\033[0m\n");
            goto FINALLY;
        }
        data += ret;
        data_size -= ret;
        if (pkt->size && decode(c, pkt, decode_frame, target_file)) goto FINALLY;

        if (data_size < AUDIO_REFILL_THRESH) {
            memmove(inbuf, data, data_size);
            data = inbuf;
            len = fread(data + data_size, 1, AUDIO_INBUF_SIZE - data_size, source_file);
            if (len > 0) data_size += len;
        }
    }
    ...
}


    


    I get these errors :

    


    [mp3float @ 0x55c51ac63440] Header missing
Invalid data found when processing input


    


    Here is the version of the ffmpeg library :

    


    libavutil      57. 17.100 / 57. 17.100
libavcodec     59. 18.100 / 59. 18.100
libavformat    59. 16.100 / 59. 16.100
libavdevice    59.  4.100 / 59.  4.100
libavfilter     8. 24.100 /  8. 24.100
libswscale      6.  4.100 /  6.  4.100
libswresample   4.  3.100 /  4.  3.100
libpostproc    56.  3.100 / 56.  3.100


    


    I guess this is due to the fundamental difference in the data format of the mp3 and mp2 frames, but I can't find a way to decode the mp3.

    


    What is the essential difference between the audio formats of mp3 and mp2 ? Also, what can I do to properly handle mp3 audio ?

    


  • Merge commit ’6a10142faa1cca8ba2bfe51b970754f62d60f320’

    5 juillet 2013, par Michael Niedermayer
    Merge commit ’6a10142faa1cca8ba2bfe51b970754f62d60f320’
    

    * commit ’6a10142faa1cca8ba2bfe51b970754f62d60f320’ :
    indeo : reject negative array indexes

    Conflicts :
    libavcodec/ivi_common.c

    See : 93927eb334dce961603645dd4ed9772bb2400cc4, a93c7ca6ef625188c9ec088c2e75f731b78c9923

    Merged-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavcodec/ivi_common.c
  • configure : simplify bigendian check

    27 mars 2024, par J. Dekker
    configure : simplify bigendian check
    

    The preferred way to use LTO is —enable-lto but often times packagers
    still end up with -flto in cflags for various reasons. Using grep
    on binary object files is brittle and relies on specific object
    representation, which in the case of LLVM bitcode, debug information or
    other intermediary formats can fail silently.

    This patch changes the check to a more commonly used define for GCC
    style compilers. More checks may be needed to cover other potential
    compilers that don't use the __BYTE_ORDER__ define.

    Signed-off-by : J. Dekker <jdek@itanimul.li>

    • [DH] configure