Recherche avancée

Médias (91)

Autres articles (97)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • 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.

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (10389)

  • x86 : dct-test : fix compilation for prores

    14 mars 2015, par Christophe Gisquet
    x86 : dct-test : fix compilation for prores
    

    When the decoder is deactivated, the x86-optimized versions are
    not compiled, resulting in a link error.

    The C version is unaffected, as it is part of the idctdsp
    subsystem.

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

    • [DH] libavcodec/x86/dct-test.c
  • Revision f061968213 : test/ : remove some unnecessary extern "C"s Change-Id : I57a94d2f9e26a872a20d805a

    18 janvier 2014, par James Zern

    Changed Paths :
     Modify /test/codec_factory.h


     Modify /test/idct8x8_test.cc


     Modify /test/idct_test.cc


     Modify /test/pp_filter_test.cc


     Modify /test/sad_test.cc


     Modify /test/sixtap_predict_test.cc


     Modify /test/test_vector_test.cc


     Modify /test/tile_independence_test.cc


     Modify /test/vp8_fdct4x4_test.cc



    test/ : remove some unnecessary extern "C"s

    Change-Id : I57a94d2f9e26a872a20d805a506855a20e61c356

  • FFMpeg Coding in C : Encoder returns EOF at first interaction. Encoder not opened correctly ? [closed]

    26 février, par Davidhohey

    as I'm fairly new to FFMpeg Programming and C in general, the code looks like a mess.

    &#xA;

    I have smashed my head against a wall trying to get this code to work for about a week.

    &#xA;

    int decode_encode_pipeline(AVFormatContext *Input_Format_Context, AVFormatContext *Output_Format_Context, int *streams_list){&#xA;&#xA;    const AVCodec *DECodec, *ENCodec;&#xA;    AVCodecContext *DECodecContext = NULL, *ENCodecContext = NULL;&#xA;    AVCodecParameters *CodecParameters = NULL;&#xA;    AVDictionary *opts = NULL;&#xA;    AVPacket *Packet;&#xA;    AVFrame *Frame;&#xA;    int check;&#xA;&#xA;    Packet = av_packet_alloc();&#xA;    if(!Packet){&#xA;    &#xA;        printf("\nFehler bei Allocating Packet");&#xA;    &#xA;        return 0;&#xA;    &#xA;    }&#xA;&#xA;    Frame = av_frame_alloc();&#xA;    if(!Frame){&#xA;    &#xA;        printf("\nFehler bei Allocating Frame");&#xA;    &#xA;        return 0;&#xA;    &#xA;    }&#xA;&#xA;    CodecParameters = Input_Format_Context->streams[Packet->stream_index]->codecpar;&#xA;    if(!CodecParameters){&#xA;&#xA;        printf("\nCodecParameters konnte nicht erstellt oder zugewiesen werden.");&#xA;&#xA;    }&#xA;&#xA;    DECodec = avcodec_find_decoder(CodecParameters->codec_id);&#xA;    if(!DECodec){&#xA;    &#xA;        printf("\nCodec nicht gefunden");&#xA;    &#xA;        return 0;&#xA;    &#xA;    }&#xA;&#xA;    DECodecContext = avcodec_alloc_context3(DECodec);&#xA;    if (!DECodecContext){&#xA;    &#xA;        printf("\nFehler bei Allocating CodecContext");&#xA;    &#xA;        return 0;&#xA;    &#xA;    }&#xA;&#xA;    ENCodec = avcodec_find_encoder(CodecParameters->codec_id);&#xA;    if(!DECodec){&#xA;    &#xA;        printf("\nCodec nicht gefunden");&#xA;    &#xA;        return 0;&#xA;    &#xA;    }&#xA;&#xA;    ENCodecContext = avcodec_alloc_context3(ENCodec);&#xA;    if (!ENCodecContext){&#xA;    &#xA;        printf("\nFehler bei Allocating CodecContext");&#xA;    &#xA;        return 0;&#xA;    &#xA;    }&#xA;&#xA;    check = avformat_write_header(Output_Format_Context, &amp;opts);&#xA;    if(check &lt; 0){&#xA;&#xA;        printf("\nFehler beim &#xD6;ffnen des Output Files.");&#xA;        &#xA;        return 1;&#xA;&#xA;    }&#xA;&#xA;    avcodec_parameters_to_context(DECodecContext, CodecParameters);&#xA;    avcodec_parameters_to_context(ENCodecContext, CodecParameters);&#xA;&#xA;    ENCodecContext->width = DECodecContext->width;&#xA;    ENCodecContext->height = DECodecContext->height;&#xA;    ENCodecContext->bit_rate = DECodecContext->bit_rate;&#xA;    ENCodecContext->time_base = (AVRational){1, 30};&#xA;    ENCodecContext->framerate = DECodecContext->framerate;&#xA;    ENCodecContext->gop_size = DECodecContext->gop_size;&#xA;    ENCodecContext->max_b_frames = DECodecContext->max_b_frames;&#xA;    ENCodecContext->pix_fmt = DECodecContext->pix_fmt;&#xA;    if(ENCodec->id == AV_CODEC_ID_H264){&#xA;&#xA;        av_opt_set(ENCodecContext->priv_data, "preset", "slow", 0);&#xA;&#xA;    }&#xA;&#xA;    check = avcodec_open2(DECodecContext, DECodec, NULL);&#xA;    if(check &lt; 0){&#xA;    &#xA;        printf("\nFehler bei &#xD6;ffnen von DECodec");&#xA;    &#xA;        return 1;&#xA;    &#xA;    }&#xA;&#xA;    check = avcodec_open2(ENCodecContext, ENCodec, NULL);&#xA;    if(check &lt; 0){&#xA;    &#xA;        printf("\nFehler bei &#xD6;ffnen von ENCodec");&#xA;    &#xA;        return 1;&#xA;    &#xA;    }&#xA;&#xA;    while(1){&#xA;    &#xA;        check = av_read_frame(Input_Format_Context, Packet);&#xA;        if(check &lt; 0){&#xA;        &#xA;            break;&#xA;        &#xA;        }&#xA;&#xA;        AVStream *in_stream, *out_stream;&#xA;&#xA;        in_stream  = Input_Format_Context->streams[Packet->stream_index];&#xA;        out_stream = Output_Format_Context->streams[Packet->stream_index];&#xA;&#xA;        if(in_stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &amp;&amp; Packet->stream_index == streams_list[Packet->stream_index]){&#xA;&#xA;            check = avcodec_send_packet(DECodecContext, Packet);&#xA;            if(check &lt; 0){&#xA;&#xA;                printf("\nFehler bei Encoding");&#xA;&#xA;                return 1;&#xA;&#xA;            }&#xA;&#xA;            AVPacket *EncodedPacket;&#xA;            EncodedPacket = av_packet_alloc();&#xA;            if(!EncodedPacket){&#xA;        &#xA;                printf("\nFehler bei Allocating Packet");&#xA;        &#xA;                return 1;&#xA;        &#xA;            }&#xA;&#xA;            /*While Loop Decoding*/&#xA;            while(check >= 0){&#xA;    &#xA;                check = avcodec_receive_frame(DECodecContext, Frame);&#xA;                if(check == AVERROR(EAGAIN)){&#xA;        &#xA;                    continue;&#xA;        &#xA;                }else if(check == AVERROR_EOF){&#xA;                    &#xA;                    break;&#xA;                    &#xA;                }else if(check &lt; 0){&#xA;        &#xA;                    printf("\nFehler bei Decoding");&#xA;        &#xA;                    return 1;&#xA;        &#xA;                }&#xA;&#xA;                /*Convert Colorspace*/&#xA;                struct SwsContext *SwsContexttoRGB = sws_getContext(Frame->width, Frame->height, Frame->format, Frame->width, Frame->height, AV_PIX_FMT_RGB24, SWS_BILINEAR, NULL, NULL, NULL);&#xA;                struct SwsContext *SwsContexttoOriginal = sws_getContext(Frame->width, Frame->height, AV_PIX_FMT_RGB24, Frame->width, Frame->height, Frame->format, SWS_BILINEAR, NULL, NULL, NULL);&#xA;                if(!SwsContexttoRGB || !SwsContexttoOriginal){&#xA;&#xA;                    printf("\nSwsContext konnte nicht bef&#xFC;llt werden.");&#xA;&#xA;                    return 1;&#xA;&#xA;                }   &#xA;&#xA;                if(Frame->linesize &lt; 0){&#xA;&#xA;                    printf("\nFehler: linesize ist negativ und nicht kompatibel\n");&#xA;&#xA;                    return 1;&#xA;&#xA;                }&#xA;&#xA;                AVFrame *RGBFrame;&#xA;                RGBFrame = av_frame_alloc();&#xA;                if(!RGBFrame){&#xA;&#xA;                    printf("\nFehler bei der Reservierung f&#xFC;r den RGBFrame");&#xA;&#xA;                    return 1;&#xA;&#xA;                }&#xA;                /*&#xA;                int number_bytes = av_image_get_buffer_size(AV_PIX_FMT_RGB24, Frame->width, Frame->height, 1);&#xA;                if(number_bytes &lt; 0){&#xA;&#xA;                    printf("\nFehler bei der Berechnung der benoetigten Bytes fuer Konvertierung");&#xA;&#xA;                    return 1;&#xA;&#xA;                }&#xA;                &#xA;                uint8_t *rgb_buffer = (uint8_t *)av_malloc(number_bytes*sizeof(uint8_t));&#xA;                if(rgb_buffer == NULL){&#xA;&#xA;                    printf("\nFehler bei der Reservierung f&#xFC;r den RGBBuffer");&#xA;&#xA;                    return 1;&#xA;&#xA;                }&#xA;&#xA;                check = av_image_fill_arrays(RGBFrame->data, RGBFrame->linesize, rgb_buffer, AV_PIX_FMT_RGB24, Frame->width, Frame->height, 1);&#xA;                if(check &lt; 0){&#xA;&#xA;                    printf("\nFehler bei der Zuweisung der RGB Daten");&#xA;&#xA;                    return 1;&#xA;&#xA;                }*/&#xA;&#xA;                //sws_scale(SwsContexttoRGB, (const uint8_t * const *)Frame->data, Frame->linesize, 0, Frame->height, RGBFrame->data, RGBFrame->linesize);&#xA;                sws_scale_frame(SwsContexttoRGB, Frame, RGBFrame);&#xA;                printf("\nIch habe die Daten zu RGB konvertiert.");&#xA;&#xA;                //sws_scale(SwsContexttoOriginal, (const uint8_t * const *)RGBFrame->data, RGBFrame->linesize, 0, Frame->height, Frame->data, Frame->linesize);&#xA;                sws_scale_frame(SwsContexttoOriginal, RGBFrame, Frame);&#xA;                printf("\nIch habe die Daten zur&#xFC;ck ins Original konvertiert.");&#xA;&#xA;                Frame->format = ENCodecContext->pix_fmt;&#xA;                Frame->width  = ENCodecContext->width;&#xA;                Frame->height = ENCodecContext->height;&#xA;                &#xA;                check = av_frame_get_buffer(Frame, 0);&#xA;                if(check &lt; 0){&#xA;        &#xA;                    printf("\nFehler bei Allocating Frame Buffer");&#xA;        &#xA;                    return 1;&#xA;        &#xA;                }&#xA;&#xA;                /* Encoding */&#xA;                check = av_frame_make_writable(Frame);&#xA;                if(check &lt; 0){&#xA;&#xA;                    printf("\nFehler bei Make Frame Writable");&#xA;&#xA;                    return 1;&#xA;&#xA;                }&#xA;&#xA;                encode(ENCodecContext, Frame, EncodedPacket, Output_Format_Context);&#xA;&#xA;                sws_freeContext(SwsContexttoRGB);&#xA;                sws_freeContext(SwsContexttoOriginal);&#xA;                av_frame_free(&amp;RGBFrame);&#xA;                //av_free(rgb_buffer);&#xA;&#xA;            }&#xA;&#xA;            /* Flushing Encoder */&#xA;            encode(ENCodecContext, NULL, EncodedPacket, Output_Format_Context);&#xA;&#xA;            //avcodec_flush_buffers(DECodecContext);&#xA;            //avcodec_flush_buffers(ENCodecContext);&#xA;&#xA;            av_packet_free(&amp;EncodedPacket);&#xA;&#xA;        }else{&#xA;&#xA;            av_interleaved_write_frame(Output_Format_Context, Packet);&#xA;&#xA;        }&#xA;&#xA;    }&#xA;&#xA;    av_write_trailer(Output_Format_Context); &#xA;&#xA;    /* Memory Free */&#xA;    avcodec_free_context(&amp;DECodecContext);&#xA;    avcodec_free_context(&amp;ENCodecContext);&#xA;    avcodec_parameters_free(&amp;CodecParameters);&#xA;    av_frame_free(&amp;Frame);&#xA;    av_packet_free(&amp;Packet);&#xA;&#xA;    return 0;&#xA;&#xA;}&#xA;&#xA;

    &#xA;

    The function encode looks as follows :

    &#xA;

    static void encode(AVCodecContext *ENCodecContext, AVFrame *Frame, AVPacket *EncodedPacket, AVFormatContext *Output_Format_Context){&#xA;&#xA;    int check;&#xA;&#xA;&#xA;&#xA;    check = avcodec_send_frame(ENCodecContext, Frame);&#xA;    if(check == AVERROR(EAGAIN)){&#xA;        printf("\nEAGAIN");&#xA;    } &#xA;    if(check == AVERROR_EOF){&#xA;        printf("\nEOF");&#xA;    }&#xA;    if(check == AVERROR(EINVAL)){&#xA;        printf("\nEINVAL");&#xA;    }&#xA;    if(check == AVERROR(ENOMEM)){&#xA;        printf("\nENOMEM");&#xA;    }&#xA;    if(check &lt; 0){&#xA;&#xA;        printf("\nFehler bei Encoding Send Frame. Check = %d", check);&#xA;&#xA;        return;&#xA;&#xA;    }&#xA;&#xA;    while(check >= 0){&#xA;&#xA;        check = avcodec_receive_packet(ENCodecContext, EncodedPacket);&#xA;        if(check == AVERROR(EAGAIN) || check == AVERROR_EOF){&#xA;&#xA;            return;&#xA;&#xA;        }else if(check &lt; 0){&#xA;&#xA;            printf("\nFehler bei Encoding");&#xA;&#xA;            return;&#xA;&#xA;        }&#xA;&#xA;        if (av_interleaved_write_frame(Output_Format_Context, EncodedPacket) &lt; 0) {&#xA;&#xA;            printf("\nFehler beim Muxen des Paketes.");&#xA;            break;&#xA;&#xA;        }&#xA;&#xA;        av_packet_unref(EncodedPacket);&#xA;&#xA;    }&#xA;&#xA;    return;&#xA;&#xA;}&#xA;

    &#xA;

    The program should decode a video into the individual frames convert them to RGB24, so I can work with the raw data of the frame, then convert it back to the original format and encode the frames.

    &#xA;

    The encoder doesn't play nice, as I get an EOF error at avcodec_send_frame().&#xA;But I couldn't figure it out why the encoder behaves like this.&#xA;And yes I have read the docs and example files, but either I'm massivly missing a crucial detail or I'm just ****.

    &#xA;

    Any and all help will be and is massivly appreciated.

    &#xA;

    PS. : The used libraries are libavutil, libavformat, libavcodec, libswscale. All installed with the "-dev" suffix through linux commandline. Should all be the version 7.0 libraries.

    &#xA;

    Thanks in advance.&#xA;With best regards.

    &#xA;

      &#xA;
    • Read the docs
    • &#xA;

    • Shifting the encoding step out of the decoding while loop
    • &#xA;

    &#xA;