Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (81)

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

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • 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

Sur d’autres sites (5532)

  • ffmpeg + ffserver : "Broken ffmpeg default settings detected"

    18 octobre 2012, par Chris Nolet

    I'm just trying to connect ffmpeg to ffserver and stream rawvideo.

    I keep getting the error : broken ffmpeg default settings detected from libx264 and then Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height from ffmpeg before it exits.

    I'm launching ffmpeg with the command : ffmpeg -f x11grab -s 320x480 -r 10 -i :0.0 -tune zerolatency http://localhost:8090/feed1.ffm

    My ffserver.conf file (for ffserver) looks like this :

    Port 8090
    BindAddress 0.0.0.0
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 1000
    CustomLog -
    NoDaemon

    <feed>
     ACL allow 127.0.0.1
    </feed>

    <stream>
     Feed feed1.ffm
     Format asf

     NoAudio

     VideoBitRate 128
     VideoBufferSize 400
     VideoFrameRate 24
     VideoSize 320x480

     VideoGopSize 12

     VideoQMin 1
     VideoQMax 31

     VideoCodec libx264
    </stream>

    <stream>
     Format status
    </stream>

    And the full output is :

    ffmpeg version N-45614-g364c60b Copyright (c) 2000-2012 the FFmpeg developers
     built on Oct 17 2012 04:34:04 with Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)
     configuration: --enable-shared --enable-libx264 --enable-libmp3lame --enable-x11grab --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --cc=/usr/bin/clang --host-cflags=&#39;-Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7&#39; --extra-cflags=&#39;-x objective-c&#39; --extra-ldflags=&#39;-framework Foundation -framework Cocoa -framework CoreServices -framework ApplicationServices -lobjc&#39;
     libavutil      51. 76.100 / 51. 76.100
     libavcodec     54. 66.100 / 54. 66.100
     libavformat    54. 32.101 / 54. 32.101
     libavdevice    54.  3.100 / 54.  3.100
     libavfilter     3. 19.103 /  3. 19.103
     libswscale      2.  1.101 /  2.  1.101
     libswresample   0. 16.100 /  0. 16.100
     libpostproc    52.  1.100 / 52.  1.100
    [x11grab @ 0x7f87dc01e200] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 320 height: 480
    [x11grab @ 0x7f87dc01e200] Estimating duration from bitrate, this may be inaccurate
    Input #0, x11grab, from &#39;:0.0&#39;:
     Duration: N/A, start: 1350517708.386699, bitrate: 49152 kb/s
       Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 320x480, 49152 kb/s, 10 tbr, 1000k tbn, 10 tbc
    [tcp @ 0x7f87dc804120] TCP connection to localhost:8090 failed: Connection refused
    [tcp @ 0x7f87dc804b20] TCP connection to localhost:8090 failed: Connection refused
    [libx264 @ 0x7f87dd801000] broken ffmpeg default settings detected
    [libx264 @ 0x7f87dd801000] use an encoding preset (e.g. -vpre medium)
    [libx264 @ 0x7f87dd801000] preset usage: -vpre <speed> -vpre <profile>
    [libx264 @ 0x7f87dd801000] speed presets are listed in x264 --help
    [libx264 @ 0x7f87dd801000] profile is optional; x264 defaults to high
    Output #0, ffm, to &#39;http://localhost:8090/feed1.ffm&#39;:
     Metadata:
       creation_time   : now
       Stream #0:0: Video: h264, yuv420p, 160x128, q=2-31, 128 kb/s, 1000k tbn, 10 tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (rawvideo -> libx264)
    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
    </profile></speed>

    Any help much appreciated :)

  • 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(&amp;worker, &amp;ios));
       boost::thread t1(boost::bind(&amp;worker, &amp;ios1));


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

       CEVLOG_MSG &lt;&lt; "done" &lt;&lt; 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 &amp;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(&amp;ifmt_ctx);

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

       avformat_free_context(ofmt_ctx);

       work.reset();
    }

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

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

       CEVLOG_MSG &lt;&lt; " " &lt;&lt; ifmt_ctx &lt;&lt; std::endl;

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

       ifmt_ctx->flags |= AVFMT_FLAG_GENPTS;

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

    return true;
    }

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

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

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

               char SDP[4096];
               SDP_size = 4096;

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

       default:
               assert(false);
               break;
       }

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

       ofmt = ofmt_ctx->oformat;

       video_idx = FindIndex(AVMEDIA_TYPE_VIDEO);

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

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

       return true;
    }

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

       for (idx = 0; idx &lt; 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 &lt;&lt; "Failed allocating output stream" &lt;&lt; std::endl;
                               break;
                       }

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

                       out_stream->codec->codec_tag = 0;
                       if (ofmt_ctx->oformat->flags &amp; 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, &amp;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, &amp;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, &amp;pkt);

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

       av_free_packet(&amp;pkt);

       StartTimer(time_ms);
    }

    void Channel::RecvVideo()
    {
       int ret = av_read_frame(ifmt_ctx, &amp;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, &amp;pkt);
               if (ret &lt; 0)
               {
                       CEVLOG_ERR &lt;&lt; "Error muxing packet" &lt;&lt; std::endl;
                       return;
               }
       }

       av_free_packet(&amp;pkt);

       StartTimer(0);
    }
  • Révision 21939 : gestion des emoji avec MySQL

    14 mars 2015, par Fil Up

    ================

    le charset ’utf8’ de MySQL ne contient pas l’ensemble de l’UTF-8, mais seulement les caractères codés sur 1, 2, ou 3 bytes ; pour contourner ce problème, on pourrait adopter le charset ’utf8mb4’, mais c’est difficile à faire, et ça implique de revoir la structure de la base (notamment les VARCHAR 255 ne passent plus, car 255*4 > 1000)

    la solution adoptée ici est d’échapper les caractères de 4 bytes sous leur forme unicode *