Recherche avancée

Médias (91)

Autres articles (49)

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

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (9017)

  • libvpxenc : quiet unused-variable warning

    20 février 2016, par James Zern
    libvpxenc : quiet unused-variable warning
    

    with older versions of libvpx
    since :
    432be63 lavc/libvpx : Fix support for RGB colorspace.

    Reviewed-by : James Almer <jamrial@gmail.com>
    Signed-off-by : James Zern <jzern@google.com>

    • [DH] libavcodec/libvpxenc.c
  • Fix compile error on arm4/arm5 platform

    23 septembre 2014, par Bernd Kuhls
    Fix compile error on arm4/arm5 platform
    

    Since these commits
    http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=adf8227cf4e7b4fccb2ad88e1e09b6dc00dd00ed
    http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=db7f1c7c5a1d37e7f4da64a79a97bea1c4b6e9f8

    compilation on arm4/arm5 fails :

    libavcodec/libavcodec.so : undefined reference to
    `ff_startcode_find_candidate_armv6’

    Because libavcodec/arm/Makefile contains
    ARMV6-OBJS-$(CONFIG_STARTCODE) += arm/startcode_armv6.o
    function ff_startcode_find_candidate_armv6 is not included for older ARM
    archs. The bug was found during automatic buildroot builds :

    http://autobuild.buildroot.net/results/ec7/ec71e4f16ee9106747dff5f15999cbd17903e76f//build-end.log
    Quote from configure summary :
    ARCH arm (armv4t)
    big-endian no
    runtime cpu detection yes
    ARMv5TE enabled no
    ARMv6 enabled no
    ARMv6T2 enabled no

    http://autobuild.buildroot.net/results/be7/be72eb182eaccf0064a32c9dfc2ac1c0d6555506/build-end.log
    ARCH arm (armv5te)
    big-endian no
    runtime cpu detection yes
    ARMv5TE enabled yes
    ARMv6 enabled no
    ARMv6T2 enabled no

    This patch provides the necessary #if clauses as discussed with Michael :
    https://ffmpeg.org/pipermail/ffmpeg-devel/2014-September/163329.html

    Signed-off-by : Bernd Kuhls <bernd.kuhls@t-online.de>
    Signed-off-by : Michael Niedermayer <michaelni@gmx.at>

    • [DH] libavcodec/arm/h264dsp_init_arm.c
    • [DH] libavcodec/arm/vc1dsp_init_arm.c
  • Extracting the h264 part of a video file (demuxing)

    3 mars 2016, par MOHW

    I am trying to demux a video file into the video part (h264, mpeg4, h265, vp8, etc) and the audio part (mp3, aac, ac3, etc) and the subtitle part (srt) using ffmpeg in c++.

    The audio part came out alright and played on all the media players I have, so also did the subtitle part. The video part however came out WITHOUT error and saved into a .h264 file but when I use ffprobe to check it or ffplay to play it, it always give the error "Invalid data found when processing input".

    The code below

    /* Separate a media file into audio, video and subtitle files (demuxing, complex) */
    //TODO: mute error when subtitle is not present
    #define __STDC_CONSTANT_MACROS

    extern "C"
    {
       #include "libavformat/avformat.h"
    }


    int main()
    {
       //Input AVFormatContext and Output AVFormatContext
       AVOutputFormat *ofmt_a = NULL, *ofmt_v = NULL, *ofmt_s = NULL;
       AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx_a = NULL, *ofmt_ctx_v = NULL, *ofmt_ctx_s = NULL;
       AVPacket pkt;

       int ret, i;
       int videoindex=-1, audioindex=-1, srtindex=-1;
       int frame_index=0;

       //Input file URL
       const char *in_filename  = "sample.mp4";

       //Output file URL
       const char *out_filename_v = "sample.h264";
       const char *out_filename_a = "sample.mp3";
       const char *out_filename_s = "sample.srt";

       av_register_all();

       //Input
       if ((ret = avformat_open_input(&amp;ifmt_ctx, in_filename, 0, 0)) &lt; 0) {
           printf( "Could not open input file.");
           goto end;
       }
       if ((ret = avformat_find_stream_info(ifmt_ctx, 0)) &lt; 0) {
           printf( "Failed to retrieve input stream information");
           goto end;
       }

       //Output
       avformat_alloc_output_context2(&amp;ofmt_ctx_v, NULL, NULL, out_filename_v);
       if (!ofmt_ctx_v) {
           printf( "Could not create output context\n");
           ret = AVERROR_UNKNOWN;
           goto end;
       }
       ofmt_v = ofmt_ctx_v->oformat;

       avformat_alloc_output_context2(&amp;ofmt_ctx_a, NULL, NULL, out_filename_a);
       if (!ofmt_ctx_a) {
           printf( "Could not create output context\n");
           ret = AVERROR_UNKNOWN;
           goto end;
       }
       ofmt_a = ofmt_ctx_a->oformat;

       avformat_alloc_output_context2(&amp;ofmt_ctx_s, NULL, NULL, out_filename_s);
       if (!ofmt_ctx_a) {
           printf( "Could not create output context\n");
           ret = AVERROR_UNKNOWN;
           goto end;
       }
       ofmt_s = ofmt_ctx_s->oformat;

       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {
               //Create output AVStream according to input AVStream
               AVFormatContext *ofmt_ctx;
               AVStream *in_stream = ifmt_ctx->streams[i];
               AVStream *out_stream = NULL;

               if(ifmt_ctx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO){
                   videoindex=i;
                   out_stream=avformat_new_stream(ofmt_ctx_v, in_stream->codec->codec);
                   ofmt_ctx=ofmt_ctx_v;
               }
               else if(ifmt_ctx->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO){
                   audioindex=i;
                   out_stream=avformat_new_stream(ofmt_ctx_a, in_stream->codec->codec);
                   ofmt_ctx=ofmt_ctx_a;
               }
               else if(ifmt_ctx->streams[i]->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
                   srtindex=i;
                   out_stream=avformat_new_stream(ofmt_ctx_s, in_stream->codec->codec);
                   ofmt_ctx=ofmt_ctx_s;
               }
               else{
                   break;
               }

               if (!out_stream) {
                   printf( "Failed allocating output stream\n");
                   ret = AVERROR_UNKNOWN;
                   goto end;
               }
               //Copy the settings of AVCodecContext
               if (avcodec_copy_context(out_stream->codec, in_stream->codec) &lt; 0) {
                   printf( "Failed to copy context from input to output stream codec context\n");
                   goto end;
               }
               out_stream->codec->codec_tag = 0;

               if (ofmt_ctx->oformat->flags &amp; AVFMT_GLOBALHEADER)
                   out_stream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
       }

       //Dump Format------------------
       printf("\n==============Input Video=============\n");
       av_dump_format(ifmt_ctx, 0, in_filename, 0);

       printf("\n==============Output Video============\n");
       av_dump_format(ofmt_ctx_v, 0, out_filename_v, 1);
       printf("\n==============Output Audio============\n");
       av_dump_format(ofmt_ctx_a, 0, out_filename_a, 1);
       /*printf("\n==============Output Subtitle============\n");
       av_dump_format(ofmt_ctx_s, 0, out_filename_s, 1);*/
       printf("\n======================================\n");

       //Open output file
       if (!(ofmt_v->flags &amp; AVFMT_NOFILE)) {
           if (avio_open(&amp;ofmt_ctx_v->pb, out_filename_v, AVIO_FLAG_WRITE) &lt; 0) {
               printf( "Could not open output file '%s'", out_filename_v);
               goto end;
           }
       }
       if (!(ofmt_a->flags &amp; AVFMT_NOFILE)) {
           if (avio_open(&amp;ofmt_ctx_a->pb, out_filename_a, AVIO_FLAG_WRITE) &lt; 0) {
               printf( "Could not open output file '%s'", out_filename_a);
               goto end;
           }
       }
       if (!(ofmt_a->flags &amp; AVFMT_NOFILE)) {
           if (avio_open(&amp;ofmt_ctx_s->pb, out_filename_s, AVIO_FLAG_WRITE) &lt; 0) {
               printf( "Could not open output file '%s'", out_filename_s);
               goto end;
           }
       }

       //Write file header
       if (avformat_write_header(ofmt_ctx_v, NULL) &lt; 0) {
           printf( "Error occurred when opening video output file\n");
           goto end;
       }
       system("pause");


       if (avformat_write_header(ofmt_ctx_a, NULL) &lt; 0) {
           printf( "Error occurred when opening audio output file\n");
           goto end;
       }
       if (avformat_write_header(ofmt_ctx_s, NULL) &lt; 0) {
           printf( "Error occurred when opening audio output file\n");
           goto end;
       }

       AVBitStreamFilterContext* h264bsfc =  av_bitstream_filter_init("h264_mp4toannexb");

       while (1) {
           AVFormatContext *ofmt_ctx;
           AVStream *in_stream, *out_stream;
           //Get an AVPacket
           if (av_read_frame(ifmt_ctx, &amp;pkt) &lt; 0)
               break;
           in_stream  = ifmt_ctx->streams[pkt.stream_index];


           if(pkt.stream_index==videoindex){
               out_stream = ofmt_ctx_v->streams[0];
               ofmt_ctx=ofmt_ctx_v;
               printf("Write Video Packet. size:%d\tpts:%lld\n",pkt.size,pkt.pts);
               av_bitstream_filter_filter(h264bsfc, in_stream->codec, NULL, &amp;pkt.data, &amp;pkt.size, pkt.data, pkt.size, 0);
           }else if(pkt.stream_index==audioindex){
               out_stream = ofmt_ctx_a->streams[0];
               ofmt_ctx=ofmt_ctx_a;
               printf("Write Audio Packet. size:%d\tpts:%lld\n",pkt.size,pkt.pts);
           }
           else if(pkt.stream_index==srtindex){
               out_stream = ofmt_ctx_s->streams[0];
               ofmt_ctx=ofmt_ctx_s;
               printf("Write Subtitle Packet. size:%d\tpts:%lld\n",pkt.size,pkt.pts);
           }
           else{
               continue;
           }


           //Convert PTS/DTS
           pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
           pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
           pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
           pkt.pos = -1;
           pkt.stream_index=0;
           //Write
           if (av_interleaved_write_frame(ofmt_ctx, &amp;pkt) &lt; 0) {
               printf( "Error muxing packet\n");
               break;
           }
           //printf("Write %8d frames to output file\n",frame_index);
           av_free_packet(&amp;pkt);
           frame_index++;
       }

       av_bitstream_filter_close(h264bsfc);  

       //Write file trailer
       av_write_trailer(ofmt_ctx_a);
       av_write_trailer(ofmt_ctx_v);
       av_write_trailer(ofmt_ctx_s);
    end:
       avformat_close_input(&amp;ifmt_ctx);
       /* close output */
       if (ofmt_ctx_a &amp;&amp; !(ofmt_a->flags &amp; AVFMT_NOFILE))
           avio_close(ofmt_ctx_a->pb);

       if (ofmt_ctx_v &amp;&amp; !(ofmt_v->flags &amp; AVFMT_NOFILE))
           avio_close(ofmt_ctx_v->pb);

       if (ofmt_ctx_s &amp;&amp; !(ofmt_s->flags &amp; AVFMT_NOFILE))
           avio_close(ofmt_ctx_s->pb);

       avformat_free_context(ofmt_ctx_a);
       avformat_free_context(ofmt_ctx_v);
       avformat_free_context(ofmt_ctx_s);

       system("pause");
       if (ret &lt; 0 &amp;&amp; ret != AVERROR_EOF) {
           printf( "Error occurred.\n");
           return -1;
       }

       return 0;
    }

    EDIT 1
    Screen shot of resultant h264 file
    enter image description here

    EDIT 2
    I think the "error" has to do with FFMPEG’s "Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead" error.
    I revert to an older version of FFMPEG and with the same code, the resultant h264 file was ok !