Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (52)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (5756)

  • store pcm data into file, but can not play that file

    25 mai 2016, par Peng Qu

    I am writing a simple program, which reads mp3 file and store its pcm data into another file. I could get that file now, but when I play that on windows, I failed. So is there any wrong in my code, or windows couldn’t play raw audio data ?

    #include
    #include
    #include <libavutil></libavutil>avutil.h>
    #include <libavformat></libavformat>avformat.h>
    #include <libavcodec></libavcodec>avcodec.h>

    int main()
    {
    int err;
    FILE *fout = fopen("test.wav", "wb");
    av_register_all();

    // step 1, open file and find audio stream
    AVFormatContext *fmtx = NULL;
    err = avformat_open_input(&amp;fmtx, "melodylove.mp3", NULL, NULL);
    assert(!err);

    err = avformat_find_stream_info(fmtx, NULL);
    assert(!err);

    int audio_stream_idx = -1;
    AVStream *st;
    AVCodecContext *decx;
    AVCodec *dec;

    for (int i = 0; i &lt; fmtx->nb_streams; ++i) {
       audio_stream_idx = i;
       if (fmtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
           st = fmtx->streams[i];
           decx = st->codec;
           dec = avcodec_find_decoder(decx->codec_id);
           decx->request_channel_layout = AV_CH_LAYOUT_STEREO_DOWNMIX;
           decx->request_sample_fmt = AV_SAMPLE_FMT_FLT;
           avcodec_open2(decx, dec, NULL);
           break;
       }
    }
    assert(audio_stream_idx != -1);

    int channels = decx->channels;
    int sample_rate = decx->sample_rate;
    int planar = av_sample_fmt_is_planar(decx->sample_fmt);
    int num_planes =  planar? decx->channels : 1;
    const char *sample_name = av_get_sample_fmt_name(decx->sample_fmt);
    printf("sample name: %s, channels: %d, sample rate: %d\n",
           sample_name, channels, sample_rate);
    printf("is planar: %d, planes: %d\n", planar, num_planes);

    /*
    * above I print some infomation about mp3 file, they are:
    * sample name: s16p, channels: 2, sample rate: 48000
    * is planar: 1, planes: 2
    */
    getchar();

    AVPacket pkt;
    av_init_packet(&amp;pkt);
    AVFrame *frame = av_frame_alloc();

    while (1) {
       err = av_read_frame(fmtx, &amp;pkt);
       if (err &lt; 0) {
           printf("read frame fail\n");
           fclose(fout);
           exit(-1);
       }
       if (pkt.stream_index != audio_stream_idx) {
           printf("we don't need this stream\n");
           continue;
       }
       printf("data size: %d\n", pkt.size);

       int got_frame = 0;
       int bytes = avcodec_decode_audio4(decx, frame, &amp;got_frame, &amp;pkt);
       if (bytes &lt; 0) {
           printf("decode audio fail\n");
           continue;
       }
       printf("frame size: %d, samples: %d\n", bytes, frame->nb_samples);

       if (got_frame) {
           int input_samples = frame->nb_samples * decx->channels;
           int sz = input_samples / num_planes;
           short buffer1[input_samples];

           for (int j = 0; j &lt; frame->nb_samples; ++j) {
               for (int i = 0; i &lt; num_planes; ++i) {
                   short *d = (short *)frame->data[i];
                   buffer1[j*2+i] = d[j];
               }
           }

           fwrite(buffer1, input_samples, 2, fout);
       } else {
           printf("why not get frame???");
       }
    }
    }
  • Streaming audio file conversion process

    11 janvier 2017, par YAL

    I am integrating IBM Speech to Text API to my Django project. The problem that I have right now is that we allow users to upload audio files and majority of them are in the format of MP3 or MP4. However, the API only takes FLAC or WAV format.

    I am currently using FFMPEG for file conversion. However, this audio conversion library loads the entire audio file in memory as opposed to doing it in chunks.

    I wonder what would be a good solution to this problem or other packages that I should use ?

  • No such file or directory Error with custom FFMPEG + CarrierWave method

    10 juillet 2013, par dodgerogers747

    I am using AWS CORS to upload videos to my site, all of which works as planned.

    I have the following model method which runs as an after_create callback (for speed) to take a screenshot from the video file on AWS. I plan to move this out into a delayed job but I don't think this will solve this particular issue. Please advise if mistaken.

    I use FFMPEG to take a screenshot from the AWS self.file location, I then send the file to CarrierWave by saving the file to self.screenshot where it is uploaded to AWS.

    Approx. 50% of the time it errors out with Errno::ENOENT - No such file or directory for the location of the screenshot image.

    How can I rectify my code to remove this error and how come it only occurs around 50% of the time ? If anyone needs more code just shout.

    video.rb

    after_create :take_screenshot

    mount_uploader :screenshot, ImageUploader

     def take_screenshot
       location = "#{Rails.root}/public/uploads/tmp/screenshots/#{unique}_#{File.basename(file)}.jpg"
       system `ffmpeg #{log_level} -i #{self.file} -ss 00:00:0#{time_frame} -vframes 1 #{location}`
       logger.debug "Trying to take screenshot from #{self.file}"
       #pass the actual file to CarrierWave to handle the image upload
       self.screenshot = File.open(location)
       self.save
       logger.debug "Deleting tmp file: #{location}: #{File.delete(location)}" if self.screenshot.present?
     end

    def unique
       (0..6).map{(65+rand(26)).chr}.join
     end

    def log_level
       "-loglevel panic"
     end

     def time_frame
       rand(0..3)
     end

    Stack trace :

    Started POST "/videos" for 127.0.0.1 at 2013-07-10 03:58:49 +0800
    Processing by VideosController#create as JS
     Parameters: {"utf8"=>"✓", "authenticity_token"=>"6M1Ia+Ag2E3HVKH2PO/p7jewxSpMPdWeVHGA933Bzjw=", "video"=>{"file"=>"http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v"}}
     User Load (0.3ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 9 LIMIT 1
      (0.1ms)  BEGIN
     SQL (0.2ms)  INSERT INTO `videos` (`created_at`, `file`, `question_id`, `screenshot`, `updated_at`, `user_id`) VALUES (&#39;2013-07-09 19:58:49&#39;, &#39;http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v&#39;, NULL, NULL, &#39;2013-07-09 19:58:49&#39;, 9)
    Trying to take screenshot from http://bucketname.s3.amazonaws.com/uploads/video/file/671a87fb-91de-4eaf-a38a-1b25c51798e5/Good_7iron.m4v
      (0.8ms)  ROLLBACK
    Completed 500 Internal Server Error in 3550ms

    Errno::ENOENT - No such file or directory - /Users/me/rails/project/public/uploads/tmp/screenshots/WCACLIC_Good_7iron.m4v.jpg:
     app/models/video.rb:24:in `initialize&#39;
     app/models/video.rb:24:in `open&#39;
     app/models/video.rb:24:in `take_screenshot&#39;