Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (48)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • 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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (6076)

  • h264 inside AVI, MP4 and "Raw" h264 streams. Different format of NAL units (or ffmpeg bug)

    24 octobre 2019, par bukkojot

    TL ;DR : I want to read raw h264 streams from AVI/MP4 files, even broken/incomplete.

    Almost every document about h264 tells me that it consists of NAL packets. Okay. Almost everywhere told to me that the packet should start with a signature like 00 00 01 or 00 00 00 01. For example, https://stackoverflow.com/a/18638298/8167678, https://stackoverflow.com/a/17625537/8167678

    The format of H.264 is that it’s made up of NAL Units, each starting
    with a start prefix of three bytes with the values 0x00, 0x00, 0x01
    and each unit has a different type depending on the value of the 4th
    byte right after these 3 starting bytes. One NAL Unit IS NOT one frame
    in the video, each frame is made up of a number of NAL Units.

    Okay.

    I downloaded random_youtube_video.mp4 and strip out one frame from it :

    ffmpeg -ss 10 -i random_youtube_video.mp4 -frames 1 -c copy pic.avi

    And got :
    hexdump of AVI
    Red part - this is part of AVI container, other - actual data.
    As you can see, here I have 00 00 24 A9 instead of 00 00 00 01

    This AVI file plays perfectly

    I do same for mp4 container :
    hexdump of mp4

    As you can see, here exact same bytes.
    This MP4 file plays perfectly

    I try to strip out raw data :
    ffmpeg -i pic.avi -c copy pic.h264
    Raw data

    This file can’t play in VLC or even ffmpeg, which produced this file, can’t parse it :
    ffmpeg error

    I downloaded mp4 stream analyzer and got :
    Analysis

    MP4Box tells me :

    Cannot find H264 start code
    Error importing pic.h264: BitStream Not Compliant

    It very hard to learn internals of h264, when nothing works.

    So, I have questions :

    1. What actual data inside mp4 ?
    2. What I must read to decode that data (I mean different annex-es)
    3. How to read stream and get decoded image (even with ffmpeg) from this "broken" raw stream ?

    UPDATE :

    It seems bug in ffmpeg :

    When I do double conversion :

            ffmpeg -ss 10 -i random_youtube_video.mp4 -frames 1 -c copy pic.mp4
            ffmpeg pic.mp4 -c copy pic.h264

    enter image description here

    But when I convert file directly :

    ffmpeg -ss 10 -i random_youtube_video.mp4 -frames 1 -c copy pic.h264
    with NALs

    I have NALs signatures and one extra NAL unit. Other bytes are same (selected).

    This is bug ?

    UPDATE

    Not, this is not bug, U must use option -bsf h264_mp4toannexb to save stream as "Annex B" format (with prefixes)

  • FFmpeg api iOS "Resource temporarily unavailable"

    8 octobre 2017, par Julius Naeumann

    I’ve spent hours trying to fix this :

    I’m trying to use the ffmpeg api on iOS. My Xcode project is building and I can call ffmpeg api functions. I am trying to write code that decodes a video (Without outputting anything for now), and I keep getting error -35 : "Resource temporarily unavailable".

    The input file is from the camera roll (.mov) and I’m using Mpeg-4 for decoding. All I’m currently doing is getting data from the file, parsing it and sending the parsed packets to the decoder. When I try to get frames, all I get is an error. Does anyone know what I’m doing wrong ?

    +(void)test: (NSString*)filename outfile:(NSString*)outfilename {

    /* register all the codecs */
    avcodec_register_all();

    AVCodec *codec;
    AVCodecParserContext *parser;
    AVCodecContext *c= NULL;
    int frame_count;
    FILE* f;
    AVFrame* frame;
    AVPacket* avpkt;
    avpkt = av_packet_alloc();
    //av_init_packet(avpkt);
    char buf[1024];

    uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
    uint8_t *data;
    size_t   data_size;

    /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
    memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);

    printf("Decode video file %s to %s\n", [filename cStringUsingEncoding:NSUTF8StringEncoding], [outfilename cStringUsingEncoding:NSUTF8StringEncoding]);
    /* find the h264 video decoder */
    codec = avcodec_find_decoder(AV_CODEC_ID_MPEG4);
    if (!codec) {
       fprintf(stderr, "Codec not found\n");
       exit(1);
    }
    c = avcodec_alloc_context3(codec);
    if (!c) {
       fprintf(stderr, "Could not allocate video codec context\n");
       exit(1);
    }
    if (codec->capabilities & AV_CODEC_CAP_TRUNCATED)
       c->flags |= AV_CODEC_FLAG_TRUNCATED; // we do not send complete frames
    /* For some codecs, such as msmpeg4 and mpeg4, width and height
    MUST be initialized there because this information is not
    available in the bitstream. */
    /* open it */
    if (avcodec_open2(c, codec, NULL) < 0) {
       fprintf(stderr, "Could not open codec\n");
       exit(1);
    }
    f = fopen([filename cStringUsingEncoding:NSUTF8StringEncoding], "rb");
    if (!f) {
       fprintf(stderr, "Could not open %s\n", [filename cStringUsingEncoding:NSUTF8StringEncoding]);
       exit(1);
    }
    frame = av_frame_alloc();
    if (!frame) {
       fprintf(stderr, "Could not allocate video frame\n");
       exit(1);
    }
    frame_count = 0;

    parser = av_parser_init(codec->id);
    if (!parser) {
       fprintf(stderr, "parser not found\n");
       exit(1);
    }

    while (!feof(f)) {
       /* read raw data from the input file */
       data_size = fread(inbuf, 1, INBUF_SIZE, f);
       if (!data_size)
           break;
       /* use the parser to split the data into frames */
       data = inbuf;
       while (data_size > 0) {
           int ret = av_parser_parse2(parser, c, &avpkt->data, &avpkt->size, data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
           if (ret < 0) {
               fprintf(stderr, "Error while parsing\n");
               exit(1);
           }
           data      += ret;
           data_size -= ret;
           if (avpkt->size){
               char buf[1024];

               ret = avcodec_send_packet(c, avpkt);
               if (ret < 0) {

                   fprintf(stderr, "Error sending a packet for decoding\n");
                   continue;
                   exit(1);
               }

               while (ret >= 0) {
                   ret = avcodec_receive_frame(c, frame);
                   if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF){
                       char e [1024];
                       av_strerror(ret, e, 1024);
                       fprintf(stderr, "Fail: %s !\n", e);
    // ~~~~~~~~ This is where my program exits ~~~~~~~~~~~~~~~~~~~~~~~~~~~
                       return;
                   }
                   else if (ret < 0) {
                       fprintf(stderr, "Error during decoding\n");
                       exit(1);
                   }
               }


           }
       }
    }
    /* some codecs, such as MPEG, transmit the I and P frame with a
    latency of one frame. You must do the following to have a
    chance to get the last frame of the video */

    fclose(f);
    avcodec_close(c);
    av_free(c);
    av_frame_free(&frame);
    printf("\n");

    }

  • How to avoid the "text relocation" error by ffmpeg library on Android x86

    16 octobre 2017, par Tank2005

    My environment is Qt 5.9 for Android on Windows 10 64bit. NDK is r10e and SDK Level is 16(Those sdks are recommended version by Qt development team).

    I built a ffmpeg 3.4 source code as .so files on Ubuntu 16.04.3 LTS. Those library has no error on ARM architecture Android. But, on x86 Emulator, "Text realocations" alart is shown like this.

    text relocations

    I rewrite configure with "disable-asm, disable-yasm" referd from this site’s old posts.

    This hereby removed some errors. But only one library has a problem.
    text relocations

    I also tried the method of deleting "strtod.o", But it seems no effect. My current build configure is that. Does anyone know a better way ?

    #!/bin/bash
    NDK=/home/my/data/ndk
    SYSROOT=$NDK/platforms/android-14/arch-x86/
    TOOLCHAIN=$NDK/linux-x86-48
    CPU=x86
    PREFIX=$(pwd)/android/x86
    PATH=$TOOLCHAIN/bin:$PATH

    function build_one
    {
    ./configure \
       --cc="$TOOLCHAIN/bin/i686-linux-android-gcc-4.8" \
       --enable-cross-compile \
       --target-os=linux \
       --arch=x86 \
       --prefix=$PREFIX \
       --enable-shared \
       --disable-static \
       --disable-avdevice \
       --disable-doc \
       --disable-encoders \
       --disable-decoders \
       --enable-decoder=h264 \
       --enable-decoder=aac \
       --disable-protocols \
       --disable-demuxers \
       --disable-muxers \
       --disable-filters \
       --disable-network \
       --disable-ffplay \
       --disable-ffmpeg \
       --disable-ffprobe \
       --disable-ffserver \
       --enable-parsers \
       --cross-prefix=i686-linux-android- \
       --enable-cross-compile \
       --target-os=linux \
       --arch=x86 \
       --disable-doc \
       --sysroot=$SYSROOT \
       --disable-x86asm -disable-yasm --enable-pic \
       --extra-cflags="-std=c99 -O3 -Wall -fpic -pipe -DANDROID -DNDEBUG -march=atom -msse3 -ffast-math -mfpmath=sse" \
       --extra-ldflags='-lm -lz -Wl,--no-undefined -Wl,-z,noexecstack' \
       $ADDITIONAL_CONFIGURE_FLAG
    make clean
    rm -f $(pwd)/compat/strtod.o
    rm -f $(pwd)/compat/strtod.d
    make
    make install
    }
    build_one