Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (42)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • Diogene : création de masques spécifiques de formulaires d’édition de contenus

    26 octobre 2010, par

    Diogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
    A quoi sert ce plugin
    Création de masques de formulaires
    Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
    Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)

Sur d’autres sites (4332)

  • Calling FFMPEG with Boost.Process

    10 février 2016, par CadentOrange

    I’m trying to call FFMPEG from my C++ process to stream video from an IP camera. The FFMPEG command I use is ffmpeg.exe -rtsp_transport tcp -i rtsp://10.0.1.21/ONVIF/MediaInput?profile=1_def_profile4 -f image2pipe -pix_fmt rgb24 -vcodec rawvideo -r 15 -. I’ve verified this command in the command prompt and it does start a video stream and dumps the frames to stdout. I’ve also written similar code in Python and it works.

    This is the code I’m using to call FFMPEG with the arguments from the previous paragraph in C++ and read the individual frames from stdout.

    bool build_ffmpeg_arguments(const std::string &uri, std::vector &args)
    {
       args.push_back("-rtsp_transport");
       args.push_back("tcp");
       args.push_back("-i");
       args.push_back(uri);
       args.push_back("-f");
       args.push_back("image2pipe");
       args.push_back("-pix_fmt");
       args.push_back("rgb24");
       args.push_back("-vcodec");
       args.push_back("rawvideo");
       args.push_back("-r");
       args.push_back("15");
       args.push_back("-");

       return true;
    }


    boost::process::child start_ffmpeg(const std::string &uri,
                                      const std::string &ffmpeg_path = "c:\\Tools\\ffmpeg.exe")
    {
       std::vector args;
       build_ffmpeg_arguments(uri, args);

       boost::process::context ctx;
       ctx.stdout_behavior = boost::process::capture_stream();
       ctx.stderr_behavior = boost::process::capture_stream();

       return boost::process::launch(ffmpeg_path, args, ctx);
    }

    bool read_frame(boost::process::pistream &amp;is, int frame_size, std::vector<char> &amp;frame_bytes)
    {
       char *buffer = new char[frame_size];

       frame_bytes.clear();
       is.read(buffer, frame_size);
       int bytes_read = is.gcount();
       frame_bytes.assign(buffer, buffer + bytes_read);

    //    std::cout &lt;&lt; "Is Bad: " &lt;&lt; is.bad() &lt;&lt; std::endl;
    //    std::cout &lt;&lt; "Is EOF: " &lt;&lt; is.eof() &lt;&lt; std::endl;
    //    std::cout &lt;&lt; "gcount: " &lt;&lt; bytes_read &lt;&lt; std::endl;

       delete[] buffer;
       if(is.bad() || is.eof() || bytes_read &lt; frame_size)
       {
           //We read in gunk, skip this time.
           is.clear();
           return false;
       }
       else
       {
           return true;
       }
    }


    //This is where the code is invoked.
    BOOST_AUTO_TEST_CASE(test_ffmpeg_stream)
    {
       std::string uri = "rtsp://10.0.1.21/ONVIF/MediaInput?profile=1_def_profile4";
       int width = 320;
       int height = 240;
       int bpp = 3;
       int bytes_expected = width * height * 3;
       boost::process::child c = start_ffmpeg(uri);
       boost::process::pistream &amp;is = c.get_stdout();
       boost::process::pistream &amp;err = c.get_stderr();

       std::vector<char> buffer;
       bool result = read_frame(is, bytes_expected, buffer);
       //BOOST_CHECK_EQUAL(true, result);
       std::cout &lt;&lt; "Buffer size: " &lt;&lt; buffer.size() &lt;&lt; std::endl;

       std::string line;
       while (std::getline(err, line))
           std::cout &lt;&lt; line &lt;&lt; std::endl;
    }
    </char></char>

    The output from stderr suggests that the parameters could be passed in wrong.

    ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
     built with gcc 5.2.0 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
    enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
    ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
    le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
    able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
    ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
    --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
    e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
    ble-decklink --enable-zlib
     libavutil      54. 31.100 / 54. 31.100
     libavcodec     56. 60.100 / 56. 60.100
     libavformat    56. 40.101 / 56. 40.101
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 40.101 /  5. 40.101
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  2.101 /  1.  2.101
     libpostproc    53.  3.100 / 53.  3.100
    rtsp://10.0.1.21/ONVIF/MediaInput?profile=1_def_profile4: Unknown error

    Is there a way of showing the full command line with arguments that boost::process::launch is calling ? Is there anything obvious that I’m doing wrong with boost::process ?

    Update :

    Suspecting that it could be the command line arguments being passed in wrong, I’ve created a dummy executable that prints out the command line arguments it receives. It’s a drop-in replacement for ffmpeg.exe purely so that I can see what command lines are being passed. The command line I’m getting is -rtsp_transport tcp -i rtsp://10.0.1.21/ONVIF/MediaInput?profile=1_def_profile4 -f image2pipe -pix_fmt rgb24 -vcodec rawvideo -r 15 -. Manually calling ffmpeg with that command line works as expected. Yet somehow it doesn’t work when launched via boost::process.

    ** Solution **

    It looks like I need to set the the environment field of the context. No idea why that fixes the problem, but it does.

    boost::process::context ctx;
    ctx.environment = boost::process::self::get_environment();
    ctx.stdout_behavior = boost::process::capture_stream();
    ctx.stderr_behavior = boost::process::capture_stream();
  • confliction on ssl_init among boost and ffmpeg, ios platform ;

    31 octobre 2016, par Martian Puss

    I’m developing a sdk on ios, including boost and openssl ; The target app is also using another sdk including ffmpeg, which is also using openssl ; Now it reveals a conflict that boost and ffmpeg both call openssl::ssl_init, boost sets CRYPTO_set_locking_callback, CRYPTO_set_id_callback besides ssl_init, and ffmpeg triggers some error handling then triggers locking_callback, then the app crashes in boost ; below’s the stack :

    2   libsystem_c.dylib           abort
    3   libsystem_malloc…           free
    4   MyApp_iPhone                CRYPTO_free           (opensl)
    5   MyApp_iPhone                lh_free
    6   MyApp_iPhone                int_err_del
    7   MyApp_iPhone                boost::asio::ssl::detail::opensl_init_base::do_init::~do_init          (boost)
    8     MyApp_iPhone                std::__1::__shared_ptr_pointer:: ??
    9   libc++.1.dylib                   std::__1::__shared_weak_count::__release_shared()
    10  MyApp_iPhone                int_thread_get           (opensl) // triggers callback
    11  MyApp_iPhone                int_thread_get_item  (opensl)
    12  MyApp_iPhone                ERR_get_state            (opensl)
    13  MyApp_iPhone                ERR_peek_error        (opensl)
    14  MyApp_iPhone                SSL_get_error            (opensl)
    15  MyApp_iPhone                dl_tls_poll                   (ffmpeg)
    16  MyApp_iPhone                tls_read                      (ffmpeg)

    My question is why the trigger in id_callback leads to boost openssl_init object releasing, it’s a static object and should not have been released until the app exits.

    If anybody has been using a combination of boost, ffmpeg and openssl on ios platform, it would be great that we know it’s feasible.

  • Boost threads and FFmpeg : Such simple code gives me error C2064. What I do wrong way ?

    19 mars 2017, par Rella

    I have some class file.h where public : bool frameSendingFinished; is defined.
    So in class logic i create and encode video frame, now I want to send it to some server using ffmpeg. I want to send in separate thread so in one of my classes function (in file.cpp) I do :

     if (frameSendingFinished)
     {
         boost::thread UrlWriteFrame(url_context, (unsigned char *)pb_buffer, len);
     }

    ....// some other functions code etc.

        void VideoEncoder::UrlWriteFrame( URLContext *h, const unsigned char *buf, int size )
    {
       frameSendingFinished =false;
       url_write (h, (unsigned char *)buf, size);
       frameSendingFinished =true;
    }

    it works with out creation of new thread. Commenting thread line makes it compile...

    so error is error c2064 term does not evaluate to a function taking 2 arguments

    So - what shall I do with my code to make boost work with in my class ?