Recherche avancée

Médias (2)

Mot : - Tags -/map

Autres articles (65)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (9195)

  • Rails 4.2.8 Using Paperclip With Resque

    27 mars 2017, par AntonioMarquis

    My application uploads training videos to a S3 bucket. I need the transcoding videos to be processed in the background so they don’t tie up the application. I want to use Resque on my dev machine and Heroku. But my jobs continue to fail.

    Model

    has_attached_file :video

    process_in_background :video

    Gems

    gem 'aws-sdk', '< 2.0'
    gem 'paperclip'
    gem 'paperclip-av-transcoder'
    gem "paperclip-ffmpeg"
    gem "ffmpeg"
    gem 'daemons'
    gem 'delayed_paperclip'
    gem 'nokogiri'#, '~> 1.5.9'
    gem 'rmagick'
    gem 'resque', "~> 1.22.0"

    Output from Failed Jobs

    Class ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper

    Arguments {"job_class"=>"DelayedPaperclip::Jobs::ActiveJob", "job_id"=>"111e4f9d-942d-4613-b3cb-0e884581249f", "queue_name"=>"paperclip", "arguments"=>["Video", 30, "source"], "locale"=>"en"}

    Exception NoMethodError

    Error undefined method `call' for "result == false":String

    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:165:in `block in halting'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `block in call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `each'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:504:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_source_post_process_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/callbacks.rb:26:in `run_paperclip_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/attachment.rb:419:in `block in post_process'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_post_process_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/callbacks.rb:26:in `run_paperclip_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/attachment.rb:418:in `post_process'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/attachment.rb:112:in `assign'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/paperclip-3.5.4/lib/paperclip/attachment.rb:322:in `reprocess!'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/delayed_paperclip-2.10.0/lib/delayed_paperclip/attachment.rb:68:in `process_delayed!'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/delayed_paperclip-2.10.0/lib/delayed_paperclip.rb:36:in `process_job'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/delayed_paperclip-2.10.0/lib/delayed_paperclip/jobs/active_job.rb:10:in `perform'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/execution.rb:32:in `block in perform_now'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:117:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:343:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/i18n-0.8.1/lib/i18n.rb:257:in `with_locale'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/translation.rb:7:in `block (2 levels) in '
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:441:in `instance_exec'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:441:in `block in make_lambda'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:342:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:342:in `block in simple'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:497:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:497:in `block in around'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:343:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:23:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:23:in `block (4 levels) in '
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `block in instrument'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/notifications.rb:164:in `instrument'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:22:in `block (3 levels) in '
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:43:in `block in tag_logger'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `block in tagged'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:26:in `tagged'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/tagged_logging.rb:68:in `tagged'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:43:in `tag_logger'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/logging.rb:19:in `block (2 levels) in '
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:441:in `instance_exec'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:441:in `block in make_lambda'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:342:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:342:in `block in simple'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:497:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:497:in `block in around'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:505:in `call'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:778:in `_run_perform_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551@global/gems/activesupport-4.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/execution.rb:31:in `perform_now'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/execution.rb:21:in `execute'
    /Users/antoniomarquis/.rvm/gems/ruby-1.9.3-p551/gems/activejob-4.2.8/lib/active_job/queue_adapters/resque_adapter.rb:46:in `perform'
    Powered by Resque v1.22.0
    Connected to Redis namespace resque on redis://127.0.0.1:6379/0
  • FFMPEG RTSP stream to MPEG4/H264 file using libx264

    16 octobre 2020, par Phi

    Heyo folks,

    



    I'm attempting to transcode/remux an RTSP stream in H264 format into a MPEG4 container, containing just the H264 video stream. Basically, webcam output into a MP4 container.

    



    I can get a poorly coded MP4 produced, using this code :

    



    // Variables here for demo
AVFormatContext * video_file_output_format = nullptr;
AVFormatContext * rtsp_format_context = nullptr;
AVCodecContext * video_file_codec_context = nullptr;
AVCodecContext * rtsp_vidstream_codec_context = nullptr;
AVPacket packet = {0};
AVStream * video_file_stream = nullptr;
AVCodec * rtsp_decoder_codec = nullptr;
int errorNum = 0, video_stream_index = 0;
std::string outputMP4file = "D:\\somemp4file.mp4";

// begin
AVDictionary * opts = nullptr;
av_dict_set(&opts, "rtsp_transport", "tcp", 0);

if ((errorNum = avformat_open_input(&rtsp_format_context, uriANSI.c_str(), NULL, &opts)) < 0) {
    errOut << "Connection failed: avformat_open_input failed with error " << errorNum << ":\r\n" << ErrorRead(errorNum);
    TacticalAbort();
    return;
}

rtsp_format_context->max_analyze_duration = 50000;
if ((errorNum = avformat_find_stream_info(rtsp_format_context, NULL)) < 0) {
    errOut << "Connection failed: avformat_find_stream_info failed with error " << errorNum << ":\r\n" << ErrorRead(errorNum);
    TacticalAbort();
    return;
}

video_stream_index = errorNum = av_find_best_stream(rtsp_format_context, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);

if (video_stream_index < 0) {
    errOut << "Connection in unexpected state; made a connection, but there was no video stream.\r\n"
        "Attempts to find a video stream resulted in error " << errorNum << ": " << ErrorRead(errorNum);
    TacticalAbort();
    return;
}

rtsp_vidstream_codec_context = rtsp_format_context->streams[video_stream_index]->codec;

av_init_packet(&packet);

if (!(video_file_output_format = av_guess_format(NULL, outputMP4file.c_str(),  NULL))) {
    TacticalAbort();
    throw std::exception("av_guess_format");
}

if (!(rtsp_decoder_codec = avcodec_find_decoder(rtsp_vidstream_codec_context->codec_id))) {
    errOut << "Connection failed: connected, but avcodec_find_decoder returned null.\r\n"
        "Couldn't find codec with an AV_CODEC_ID value of " << rtsp_vidstream_codec_context->codec_id << ".";
    TacticalAbort();
    return;
}

video_file_format_context = avformat_alloc_context();
video_file_format_context->oformat = video_file_output_format;

if (strcpy_s(video_file_format_context->filename, sizeof(video_file_format_context->filename), outputMP4file.c_str())) {
    errOut << "Couldn't open video file: strcpy_s failed with error " << errno << ".";
    std::string log = errOut.str();
    TacticalAbort();
    throw std::exception("strcpy_s");
}

if (!(video_file_encoder_codec = avcodec_find_encoder(video_file_output_format->video_codec))) {
    TacticalAbort();
    throw std::exception("avcodec_find_encoder");
}

// MARKER ONE

if (!outputMP4file.empty() &&
    !(video_file_output_format->flags & AVFMT_NOFILE) &&
    (errorNum = avio_open2(&video_file_format_context->pb, outputMP4file.c_str(), AVIO_FLAG_WRITE, nullptr, &opts)) < 0) {
    errOut << "Couldn't open video file \"" << outputMP4file << "\" for writing : avio_open2 failed with error " << errorNum << ": " << ErrorRead(errorNum);
    TacticalAbort();
    return;
}

// Create stream in MP4 file
if (!(video_file_stream = avformat_new_stream(video_file_format_context, video_file_encoder_codec))) {
    TacticalAbort();
    return;
}

AVCodecContext * video_file_codec_context = video_file_stream->codec;

// MARKER TWO

// error -22/-21 in avio_open2 if this is skipped
if ((errorNum = avcodec_copy_context(video_file_codec_context, rtsp_vidstream_codec_context)) != 0) {
    TacticalAbort();
    throw std::exception("avcodec_copy_context");
}

//video_file_codec_context->codec_tag = 0;

/*
// MARKER 3 - is this not needed? Examples suggest not.
if ((errorNum = avcodec_open2(video_file_codec_context, video_file_encoder_codec, &opts)) < 0)
{
    errOut << "Couldn't open video file codec context: avcodec_open2 failed with error " << errorNum << ": " << ErrorRead(errorNum);
    std::string log = errOut.str();
    TacticalAbort();
    throw std::exception("avcodec_open2, video file");
}*/

//video_file_format_context->flags |= AVFMT_FLAG_GENPTS;
if (video_file_format_context->oformat->flags & AVFMT_GLOBALHEADER)
{
    video_file_codec_context->flags |= CODEC_FLAG_GLOBAL_HEADER;
}

if ((errorNum = avformat_write_header(video_file_format_context, &opts)) < 0) {
    errOut << "Couldn't open video file: avformat_write_header failed with error " << errorNum << ":\r\n" << ErrorRead(errorNum);
    std::string log = errOut.str();
    TacticalAbort();
    return;
}


    



    However, there are several issues :

    



      

    1. I can't pass any x264 options to the output file. The output H264 matches the input H264's profile/level - switching cameras to a different model switches H264 level.
    2. 


    3. The timing of the output file is off, noticeably.
    4. 


    5. The duration of the output file is off, massively. A few seconds of footage becomes hours, although playtime doesn't match. (FWIW, I'm using VLC to play them.)
    6. 


    



    Passing x264 options

    



    If I manually increment PTS per packet, and set DTS equal to PTS, it plays too fast, 2-3 seconds' worth of footage in one second playtime, and duration is hours long. The footage also blurs past several seconds, about 10 seconds' footage in a second.

    



    If I let FFMPEG decide (with or without GENPTS flag), the file has a variable frame rate (probably as expected), but it plays the whole file in an instant and has a long duration too (over forty hours for a few seconds). The duration isn't "real", as the file plays in an instant.

    



    At Marker One, I try to set the profile by passing options to avio_open2. The options are simply ignored by libx264. I've tried :

    



    av_dict_set(&opts, "vprofile", "main", 0);
av_dict_set(&opts, "profile", "main", 0); // error, missing '('
// FF_PROFILE_H264_MAIN equals 77, so I also tried
av_dict_set(&opts, "vprofile", "77", 0); 
av_dict_set(&opts, "profile", "77", 0);


    



    It does seem to read the profile setting, but it doesn't use them. At Marker Two, I tried to set it after the avio_open2, before avformat_write_header .

    



    // I tried all 4 av_dict_set from earlier, passing it to avformat_write_header.
// None had any effect, they weren't consumed.
av_opt_set(video_file_codec_context, "profile", "77", 0);
av_opt_set(video_file_codec_context, "profile", "main", 0);
video_file_codec_context->profile = FF_PROFILE_H264_MAIN;
av_opt_set(video_file_codec_context->priv_data, "profile", "77", 0);
av_opt_set(video_file_codec_context->priv_data, "profile", "main", 0);


    



    Messing with privdata made the program unstable, but I was trying anything at that point.
I'd like to solve issue 1 with passing settings, since I imagine it'd bottleneck any attempt to solve issues 2 or 3.

    



    I've been fiddling with this for the better part of a month now. I've been through dozens of documentation, Q&As, examples. It doesn't help that quite a few are outdated.

    



    Any help would be appreciated.

    



    Cheers

    


  • How to setup a Python AWS Lambda zip with OpenCV + FFmpeg ?

    5 juin 2017, par dannyeuu

    On my desktop I have FFmpeg, OpenCV compilated with CUDA, and woks well.

    The function load a video on S3 and run a model that extract some frames and store them in another S3 Bucket.

    Bur I have to deploy a conda env with my lambda function and packages with OpenCV without FFmpeg, but I need it to opencv mp4 video file.

    python-project/
       - cv2/
       - numpy/
       - lambda_handler.py

    How can I setup the opencv that enable videos on opencv ?