Recherche avancée

Médias (91)

Autres articles (20)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

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

  • 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 (4629)

  • ffmpeg and boost::asio NULL pointer

    9 avril 2015, par Georgi

    I am trying to make a special video software which will run on multiple core machines.

    I want many c++ object to stream video files and many other c++ objects to store the streamed data into file.

    I have created some simple classes, but when I try to create 2 and more objects I got :

    opening stream9079.sdp
    [udp @ 0xaef5380] bind failed: Address already in use
    Could not open input file stream9079.sdp
    Segmentation fault (core dumped)

    When I use only one object everything is fine.

    I use the following code

    int main(int argc, char **argv)
    {
       boost::asio::io_service ios;
       boost::asio::io_service ios1;

       Channel *channels[100];

       channels[0] = new Channel(ios, 9078, atoi(argv[1]));
       channels[0]->StartTimer(0);

       channels[1] = new Channel(ios1, 9079, atoi(argv[1]));
       channels[1]->StartTimer(0);

       boost::thread t(boost::bind(&worker, &ios));
       boost::thread t1(boost::bind(&worker, &ios1));


       t.join();
       t1.join();

       CEVLOG_MSG << "done" << std::endl;

       return 0;
    }

    My Channel class implementation is :

    #include "channel.hpp"
    #include "utils.hpp"
    #include "boost/lexical_cast.hpp"
    Channel::Channel(boost::asio::io_service &ioP, int i, bool to_send):
       Runnable(ioP),
       work( new boost::asio::io_service::work(ioP) ),
       ofmt(NULL),
       ifmt_ctx(NULL),
       ofmt_ctx(NULL)
    {
       id = i;
       sender = to_send;

       if (sender)
       {
               input.assign("/home/georgi/Downloads/video/IMG_0019.MOV");
               output.assign("rtp://10.101.3.60:"); output += boost::lexical_cast(id);
       }
       else
       {
               input.assign("stream"); input += boost::lexical_cast(id); input += ".sdp";
               output.assign("test"); output += boost::lexical_cast(id); output += ".mp4";
       }

    video_idx = audio_idx = sub_idx = -1;

       if (OpenInput())
       {
               if (sender)
                       OpenOutput(eStreamOutput);
               else
                       OpenOutput(eFileOutput);
       }
    }

    Channel::~Channel()
    {
       av_write_trailer(ofmt_ctx);

       avformat_close_input(&ifmt_ctx);

       if (ofmt_ctx && !(ofmt->flags & AVFMT_NOFILE))
               avio_closep(&ofmt_ctx->pb);

       avformat_free_context(ofmt_ctx);

       work.reset();
    }

    bool Channel::OpenInput()
    {
       CEVLOG_MSG << "opening " << input << std::endl;

       int ret;
       if ((ret = avformat_open_input(&ifmt_ctx, input.c_str(), 0, 0)) < 0)
       {
               CEVLOG_ERR << "Could not open input file " << input << std::endl;
               return false;
       }

       CEVLOG_MSG << " " << ifmt_ctx << std::endl;

       if ((ret = avformat_find_stream_info(ifmt_ctx, 0)) < 0)
       {
               CEVLOG_ERR << "Failed to retrieve input stream information" << std::endl;
               return false;
       }

       ifmt_ctx->flags |= AVFMT_FLAG_GENPTS;

       //read and set timestamps to 0
    av_read_frame(ifmt_ctx, &pkt);
    pkt.pts = pkt.dts = 0;

    return true;
    }

    bool Channel::OpenOutput(tOutputType WhatToOpen)
    {
       int SDP_size;

       switch (WhatToOpen)
       {
       case eFileOutput:
               avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, output.c_str());
               break;

       case eStreamOutput:
               avformat_alloc_output_context2(&ofmt_ctx, NULL, "rtp", output.c_str());

               char SDP[4096];
               SDP_size = 4096;

               av_sdp_create(&ofmt_ctx, 1, SDP, SDP_size);
               CEVLOG_DBG << "SDP=" << SDP << std::endl;
               break;

       default:
               assert(false);
               break;
       }

       if (!ofmt_ctx)
       {
               CEVLOG_ERR << "Could not create output context" << std::endl;
               return false;
       }

       ofmt = ofmt_ctx->oformat;

       video_idx = FindIndex(AVMEDIA_TYPE_VIDEO);

       if (!(ofmt->flags & AVFMT_NOFILE))
       {
               if (avio_open(&ofmt_ctx->pb, output.c_str(), AVIO_FLAG_WRITE) < 0)
               {
                       CEVLOG_ERR << "Could not open output file " << output << std::endl;
                       return false;
               }
       }

       if (avformat_write_header(ofmt_ctx, NULL) < 0)
       {
               CEVLOG_ERR << "Error occurred when opening output file " << output << std::endl;
               return false;
       }

       return true;
    }

    unsigned int Channel::FindIndex(AVMediaType Type)
    {
       int idx;

       for (idx = 0; idx < ifmt_ctx->nb_streams; idx++)
       {
               if (ifmt_ctx->streams[idx]->codec->codec_type == Type)
               {
                       AVStream *in_stream = ifmt_ctx->streams[idx];
                       AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec);

                       if (!out_stream)
                       {
                               CEVLOG_ERR << "Failed allocating output stream" << std::endl;
                               break;
                       }

                       if (avcodec_copy_context(out_stream->codec, in_stream->codec) < 0)
                       {
                               CEVLOG_ERR << "Failed to copy context from input to output stream codec context" << std::endl;
                               break;
                       }

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

                       break;
               }
       }

       return idx;
    }

    void Channel::Callback()
    {
       if (sender)
               SendVideo();
       else
               RecvVideo();
    }

    void Channel::SendVideo()
    {
       int ret = av_read_frame(ifmt_ctx, &pkt);
       int time_ms = 0;

       if (ret != 0)
       {
               av_write_trailer(ofmt_ctx);
               work.reset();
               return;
       }

       if (pkt.stream_index == video_idx)
       {
               AVStream *in_stream  = ifmt_ctx->streams[pkt.stream_index];
               AVStream *out_stream = ofmt_ctx->streams[pkt.stream_index];

               AVRational time_base = ifmt_ctx->streams[video_idx]->time_base;

               char timestamp[100];
               time_ms = 1000 * 1000 * strtof(timestamp2char(timestamp, pkt.duration, &time_base), NULL);

               pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF);
               pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF);
               pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
               pkt.pos = -1;

               ret = av_interleaved_write_frame(ofmt_ctx, &pkt);

               if (ret < 0)
               {
                       CEVLOG_ERR << "Error muxing packet" << std::endl;
                       return;
               }
       }

       av_free_packet(&pkt);

       StartTimer(time_ms);
    }

    void Channel::RecvVideo()
    {
       int ret = av_read_frame(ifmt_ctx, &pkt);

       if (ret != 0)
       {
               //Some error or end of stream is detected. Write file trailer
               av_write_trailer(ofmt_ctx);
               work.reset();
               return;
       }

       //if is NOT video just continue reading
       if (pkt.stream_index == video_idx)
       {
               AVStream *in_stream  = ifmt_ctx->streams[pkt.stream_index];
               AVStream *out_stream = ofmt_ctx->streams[pkt.stream_index];

               AVRational time_base = ifmt_ctx->streams[video_idx]->time_base;

               pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF);
               pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, AV_ROUND_NEAR_INF);
               pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
               pkt.pos = -1;

               ret = av_interleaved_write_frame(ofmt_ctx, &pkt);
               if (ret < 0)
               {
                       CEVLOG_ERR << "Error muxing packet" << std::endl;
                       return;
               }
       }

       av_free_packet(&pkt);

       StartTimer(0);
    }
  • dca : Convert dca_dmixtable to integers

    6 mai 2014, par Niels Möller
    dca : Convert dca_dmixtable to integers
    

    Also include zero in the table, eliminating a special case in the
    decoder.

    Signed-off-by : Niels Möller <nisse@southpole.se>
    Signed-off-by : Anton Khirnov <anton@khirnov.net>

    • [DH] libavcodec/dcadata.h
    • [DH] libavcodec/dcadec.c
  • Force GStreamer for IOS to use ffmpeg library outside of the framework

    24 avril 2014, par Michelle Cannon

    Gstreamer 1.0 for IOS is delivered in a static framework, the source to build the framework is around 1.2g , this framework is huge and tries to provide for any decoding server scenario you may have. Trouble is it tries to do to much and IMHO not enough thought was put into the IOS port.

    Here’s the problem we have an application that uses the GSTreamer avdec_h264 plugin for displaying an RTP over UDP stream . This works rather well. recently we were required to do some special recording functions so we introduced an api that had its own version of ffmpeg. Gstreamer has Libav compiled into the framework. When we place our api into the application with the gst_IOS_RESTICTED_PLUGINS disabled the code runs fine when we introduce the GStreamer.framework into the application code similar to that shown below fails with a protocol not found error.

    The problem is that the internal version of libav seems to disable all the protocols that ffmpeg supplies. because GSTreamer uses its own custom AVIO callback based on ffmpeg pipe protocol.

    According to Gstreamer support that has been somewhat helpful

    ) Add a new recipe with the libav version you want to use and disable the build of the internal libav in gst-libav-1.0 with :
    configure_options = ’—with-system-libav’

    You might need to comment out this part to prevent libav being packaged in the framewiork or make sure that your libav recipe creates these files in the correct place to include them in the framework :

    42 for f in [’libavcodec’, ’libavformat’, ’libavutil’, ’libswscale’] :
    43 for ext in [’.a’, ’.la’] :
    44 path = os.path.join(’lib’, f + ext)
    45 self.files_plugins_codecs_restricted_devel.append(path)

    2) Update libav submodule gst-libav to use the correct version you need.

    https://bugs.freedesktop.org/show_bug.cgi?id=77399

    The first method didn’t work , the recipe kept getting overwritten even after applying a patch for a bug fix that was made as result of this bug report.

    And I have no idea how to do the second method. Which is what I’d like some help with.

    Has anyone with GStreamer 1.0 for iOS

    1) Built the get-libav plugin against an external to to the framework set of ffmpeg static libs (.a)

    2) built the internal libav to allow for RTP , UDP and TCP protocols, or written a custom AVIO callback using the FFPipe protocol.

    3) just managed to somehow get the below code working with GStreamer.

    I don’t ask many questions, I’ve kind of implemented all kinds of encoders/decoders using ffmpeg , lib555 and a few hardware decoders. But this GStreamer issue is causing me more sleepless nights than I’ve had in a long time.

    AVFormatContext * avctx;
    avctx = avformat_alloc_context();

    av_register_all();
    avformat_network_init();
    avcodec_register_all();
    avdevice_register_all();



    // Set the RTSP Options
    AVDictionary *opts = 0;

    av_dict_set(&amp;opts, "rtsp_transport", "udp", 0);


    int err = 0;
    err = avformat_open_input(&amp;avctx, "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov", NULL, &amp;opts);
    av_dict_free(&amp;opts);
    if (err) {
       NSLog(@"Error: Could not open stream: %d", err);
       char errbuf[400];
       av_strerror(err,errbuf,400);
       NSLog(@"%s failed with error %s","avformat_open_input",errbuf);



    }
    else {
       NSLog(@"Opened stream");
    }

    err = avformat_find_stream_info(avctx, NULL);
    if( err &lt; 0)
    {
       char errbuf[400];
       av_strerror(err,errbuf,400);
       NSLog(@"%s failed with error %s","avformat_find_stream_info",errbuf);
       return ;
    }else {
        NSLog(@"found stream info");
    }

    }