Recherche avancée

Médias (0)

Mot : - Tags -/auteurs

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (89)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

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

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

Sur d’autres sites (11777)

  • ERROR : "Cannot Find FFMPEG" on Google Cloud Compute Engine Debian Wheezy 7.8 Managed Instance even though it's installed

    17 mai 2021, par DynamoBooster

    I wrote a Node.JS application that uses the fluent-ffmpeg module to watermark videos uploaded on the platform. I pushed the code to a my Google Cloud Compute Engine project, and every time I get Error : Cannot Find FFMPEG. I ssh'd into the instance once it was created and ran these commands to install FFMPEG before actually testing out the code. I am not sure what is causing the error because after this I am positive that FFMPEG is installed.

    



    sudo apt-get update
sudo apt-get install -y ffmpeg
export FFMPEG_PATH="/usr/bin/ffmpeg"
export FFPROBE_PATH="/usr/bin/ffprobe"


    



    Below is my FFMPEG code

    



    function generate_thumbnail(name, path){
  logging.info("Generating Thumbnail");
  ffmpeg(path)
   .setFfmpegPath('/usr/bin/ffmpeg') 
   .setFfprobePath('/usr/bin/ffprobe')
   .on('end', function() {
        upload_thumbnail(name);
        logging.info("Thumbnail Generated and uploaded");
        return;
    })
  .on('error', function(err, stdout, stderr) {
        logging.info('ERROR: ' + err.message);
        logging.info('STDERR:' + stderr);
  })
  .on('start', function(commandLine) {
       logging.info(commandLine);
  })
  .screenshots({
    count: 1,
    filename: name + '_thumbnail.png',
    folder: 'public/images/thumbnails/'
  });
}


    


  • Revision 5ddcbeeb7d : Adjust style to match Google Coding Style a little more closely. Most of these

    31 octobre 2012, par Ronald S. Bultje

    Changed Paths : Modify /vp8/common/onyxd.h Modify /vp8/decoder/dboolhuff.c Modify /vp8/decoder/dboolhuff.h Modify /vp8/decoder/decodframe.c Modify /vp8/decoder/dequantize.c Modify /vp8/decoder/detokenize.c Modify /vp8/decoder/idct_blk.c Modify /vp8/decoder/onyxd_if.c (...)

  • Screen Capture with FFMPEG and Google Native Client

    18 juillet 2016, par Mohammad Abu Musa

    I am building a screen recorder that is based on Native Client for Google, I have ffmpeg installed and ready but I do not have experience programming in ffmpeg. so I am looking for tips to understand how to build this recorder.

    My goal is to make a screen recorder and export videos as webm files, I have all the required libraries I just could not find any code examples to hack on

    This is what I achieved so far

    #define __STDC_LIMIT_MACROS

    #include
    #include <iostream>
    #include
    #include
    #include <sstream>
    #include
    #include <vector>

    #include "ppapi/cpp/instance.h"
    #include "ppapi/cpp/var_dictionary.h"
    #include "ppapi/c/pp_errors.h"
    #include "ppapi/c/ppb_console.h"
    #include "ppapi/cpp/input_event.h"
    #include "ppapi/cpp/module.h"
    #include "ppapi/cpp/rect.h"
    #include "ppapi/cpp/var.h"
    #include "ppapi/cpp/var_array_buffer.h"

    // Begin File IO headers
    #include "ppapi/c/pp_stdint.h"
    #include "ppapi/c/ppb_file_io.h"
    #include "ppapi/cpp/directory_entry.h"
    #include "ppapi/cpp/file_io.h"
    #include "ppapi/cpp/file_ref.h"
    #include "ppapi/cpp/file_system.h"
    #include "ppapi/cpp/instance.h"
    #include "ppapi/cpp/message_loop.h"
    #include "ppapi/cpp/module.h"
    #include "ppapi/cpp/var.h"
    #include "ppapi/cpp/var_array.h"
    #include "ppapi/utility/completion_callback_factory.h"
    #include "ppapi/utility/threading/simple_thread.h"

    #ifndef INT32_MAX
    #define INT32_MAX (0x7FFFFFFF)
    #endif

    #ifdef WIN32
    #undef min
    #undef max
    #undef PostMessage

    // Allow 'this' in initializer list
    #pragma warning(disable : 4355)
    #endif

    namespace {
    typedef std::vector StringVector;
    }
    //End File IO headers

    extern "C" {
    #include <libavcodec></libavcodec>avcodec.h>
    #include <libswscale></libswscale>swscale.h>
    #include <libavformat></libavformat>avformat.h>
    #include <libavutil></libavutil>imgutils.h>
    }

    const char* file_name = "/file.txt";
    const char* video_name = "/video.mpeg";
    const char* file_text = "Echo from NaCl: ";

    /**
    * Pixel formats and codecs
    */
    static const AVPixelFormat sourcePixelFormat = AV_PIX_FMT_BGR24;
    static const AVPixelFormat destPixelFormat = AV_PIX_FMT_YUV420P;
    static const AVCodecID destCodec = AV_CODEC_ID_MPEG2VIDEO;

    class RecorderInstance: public pp::Instance {
    public:
       explicit RecorderInstance(PP_Instance instance) :
               pp::Instance(instance), callback_factory_(this), file_system_(this,
                       PP_FILESYSTEMTYPE_LOCALPERSISTENT), file_system_ready_(
                       false), file_thread_(this) {
       }

       virtual ~RecorderInstance() {
           file_thread_.Join();
       }

       virtual bool Init(uint32_t /*argc*/, const char * /*argn*/[],
               const char * /*argv*/[]) {
           file_thread_.Start();
           file_thread_.message_loop().PostWork(
                   callback_factory_.NewCallback(
                           &amp;RecorderInstance::OpenFileSystem));
           avcodec_register_all(); // mandatory to register ffmpeg functions

           return true;
       }

    private:
       pp::CompletionCallbackFactory<recorderinstance> callback_factory_;
       pp::FileSystem file_system_;

       // Indicates whether file_system_ was opened successfully. We only read/write
       // this on the file_thread_.
       bool file_system_ready_;
       pp::SimpleThread file_thread_;

       virtual void HandleMessage(const pp::Var&amp; var_message) {
           if (!var_message.is_dictionary()) {
               LogToConsole(PP_LOGLEVEL_ERROR, pp::Var("Invalid message!"));
               return;
           }

           pp::VarDictionary dict_message(var_message);
           std::string command = dict_message.Get("message").AsString();


           if (command == "sendFrame") {
               pp::VarArrayBuffer data(dict_message.Get("data"));
               uint width = 600;
               uint height = 800;
               uint8_t endcode[] = { 0, 0, 1, 0xb7 };
               /**
                * Create an encoder and open it
                */
               avcodec_register_all();

               AVCodec *h264encoder = avcodec_find_encoder(destCodec);
               AVCodecContext *h264encoderContext = avcodec_alloc_context3(
                       h264encoder);

               h264encoderContext->pix_fmt = destPixelFormat;
               h264encoderContext->width = width;
               h264encoderContext->height = height;

               if (avcodec_open2(h264encoderContext, h264encoder, NULL) &lt; 0) {
                   ShowErrorMessage("Cannot open codec" ,-1);
                   return;
               }

               /**
                * Create a stream
                */
               AVFormatContext *cv2avFormatContext = avformat_alloc_context();
               AVStream *h264outputstream = avformat_new_stream(cv2avFormatContext,
                       h264encoder);

               AVFrame *sourceAvFrame = av_frame_alloc(), *destAvFrame =
                       av_frame_alloc();
               int got_frame;

               FILE* videoOutFile = fopen("video", "wb");
               /**
                * Prepare the conversion context
                */
               SwsContext *bgr2yuvcontext = sws_getContext(width, height,
                       sourcePixelFormat, width, height, destPixelFormat,
                       SWS_BICUBIC, NULL, NULL, NULL);

               int framesToEncode = 100;
               /**
                * Convert and encode frames
                */
               for (uint i = 0; i &lt; framesToEncode; i++) {

                   /**
                    * Allocate source frame, i.e. input to sws_scale()
                    */
                   av_image_alloc(sourceAvFrame->data, sourceAvFrame->linesize,
                           width, height, sourcePixelFormat, 1);

                   /**
                    * Copy image data into AVFrame from cv::Mat
                    */
                   for (uint32_t h = 0; h &lt; height; h++)
                       memcpy(
                               &amp;(sourceAvFrame->data[0][h
                                       * sourceAvFrame->linesize[0]]),
                               &amp;(data), width * 3);

                   /**
                    * Allocate destination frame, i.e. output from sws_scale()
                    */
                   av_image_alloc(destAvFrame->data, destAvFrame->linesize, width,
                           height, destPixelFormat, 1);

                   sws_scale(bgr2yuvcontext, sourceAvFrame->data,
                           sourceAvFrame->linesize, 0, height, destAvFrame->data,
                           destAvFrame->linesize);
                   sws_freeContext(bgr2yuvcontext);
                   /**
                    * Prepare an AVPacket and set buffer to NULL so that it'll be allocated by FFmpeg
                    */
                   AVPacket avEncodedPacket;
                   av_init_packet(&amp;avEncodedPacket);
                   avEncodedPacket.data = NULL;
                   avEncodedPacket.size = 0;

                   destAvFrame->pts = i;
                   avcodec_encode_video2(h264encoderContext, &amp;avEncodedPacket,
                           destAvFrame, &amp;got_frame);

                   if (got_frame) {
                       ShowErrorMessage(
                               "Encoded a frame of size \n",-1); //+ (string)avEncodedPacket.size + "\n");

                       if (fwrite(avEncodedPacket.data, 1, avEncodedPacket.size,
                               videoOutFile) &lt; (unsigned) avEncodedPacket.size)
                           ShowErrorMessage(
                                   "Could not write all \n",-1);
                                   //+ avEncodedPacket.size
                                           //+ " bytes, but will continue..\n"


                       fflush(videoOutFile);

                   }
                   /**
                    * Per-frame cleanup
                    */
                   av_packet_free_side_data(&amp;avEncodedPacket);
                   av_free_packet(&amp;avEncodedPacket);
                   av_freep(sourceAvFrame->data);
                   av_frame_free(&amp;sourceAvFrame);
                   av_freep(destAvFrame->data);
                   av_frame_free(&amp;destAvFrame);

               }

               fwrite(endcode, 1, sizeof(endcode), videoOutFile);
               fclose(videoOutFile);

               /**
                * Final cleanup
                */
               avformat_free_context(cv2avFormatContext);
               avcodec_close(h264encoderContext);
               avcodec_free_context(&amp;h264encoderContext);

           } else if (command == "createFile") {
               file_thread_.message_loop().PostWork(
                       callback_factory_.NewCallback(&amp;RecorderInstance::Save,
                               file_name, file_text));
           }
       }


       void OpenFileSystem(int32_t /* result */) {
           int32_t rv = file_system_.Open(1024 * 1024, pp::BlockUntilComplete());
           if (rv == PP_OK) {
               file_system_ready_ = true;
               // Notify the user interface that we're ready
               ShowStatusMessage("STORAGE READY");
           } else {
               ShowErrorMessage("Failed to open file system", rv);
           }
       }

       void Save(int32_t /* result */, const std::string&amp; file_name,
               const std::string&amp; file_contents) {
           if (!file_system_ready_) {
               ShowErrorMessage("File system is not open", PP_ERROR_FAILED);
               return;
           }
           pp::FileRef ref(file_system_, file_name.c_str());
           pp::FileIO file(this);

           int32_t open_result = file.Open(ref,
                   PP_FILEOPENFLAG_WRITE | PP_FILEOPENFLAG_CREATE
                           | PP_FILEOPENFLAG_TRUNCATE, pp::BlockUntilComplete());
           if (open_result != PP_OK) {
               ShowErrorMessage("File open for write failed", open_result);
               return;
           }

           // We have truncated the file to 0 bytes. So we need only write if
           // file_contents is non-empty.
           if (!file_contents.empty()) {
               if (file_contents.length() > INT32_MAX) {
                   ShowErrorMessage("File too big", PP_ERROR_FILETOOBIG);
                   return;
               }
               int64_t offset = 0;
               int32_t bytes_written = 0;
               do {
                   bytes_written = file.Write(offset,
                           file_contents.data() + offset, file_contents.length(),
                           pp::BlockUntilComplete());
                   if (bytes_written > 0) {
                       offset += bytes_written;
                   } else {
                       ShowErrorMessage("File write failed", bytes_written);
                       return;
                   }
               } while (bytes_written
                       &lt; static_cast(file_contents.length()));
           }
           // All bytes have been written, flush the write buffer to complete
           int32_t flush_result = file.Flush(pp::BlockUntilComplete());
           if (flush_result != PP_OK) {
               ShowErrorMessage("File fail to flush", flush_result);
               return;
           }
           ShowStatusMessage("Save success");
       }

       /// Encapsulates our simple javascript communication protocol
       void ShowErrorMessage(const std::string&amp; message, int32_t result) {
           std::stringstream ss;
           ss &lt;&lt; "ERROR: " &lt;&lt; message &lt;&lt; " -- Error #: " &lt;&lt; result &lt;&lt; "\n";
           PostMessage(ss.str());
       }

       void ShowStatusMessage(const std::string&amp; message) {
           std::stringstream ss;
           ss &lt;&lt; "LOG: " &lt;&lt; message &lt;&lt; "\n";
           PostMessage(ss.str());
       }

    };

    class RecorderModule: public pp::Module {
    public:
       RecorderModule() :
               pp::Module() {
       }

       virtual ~RecorderModule() {
       }

       virtual pp::Instance* CreateInstance(PP_Instance instance) {
           return new RecorderInstance(instance);
       }
    };

    namespace pp {

    /**
    * This function is an entry point to a NaCl application.
    * It must be implemented.
    */
    Module* CreateModule() {
       return new RecorderModule();
    }

    }  // namespace pp
    </recorderinstance></vector></sstream></iostream>