Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

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

Autres articles (49)

  • Monitoring de fermes de MediaSPIP (et de SPIP tant qu’à faire)

    31 mai 2013, par

    Lorsque l’on gère plusieurs (voir plusieurs dizaines) de MediaSPIP sur la même installation, il peut être très pratique d’obtenir d’un coup d’oeil certaines informations.
    Cet article a pour but de documenter les scripts de monitoring Munin développés avec l’aide d’Infini.
    Ces scripts sont installés automatiquement par le script d’installation automatique si une installation de munin est détectée.
    Description des scripts
    Trois scripts Munin ont été développés :
    1. mediaspip_medias
    Un script de (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Les notifications de la ferme

    1er décembre 2010, par

    Afin d’assurer une gestion correcte de la ferme, il est nécessaire de notifier plusieurs choses lors d’actions spécifiques à la fois à l’utilisateur mais également à l’ensemble des administrateurs de la ferme.
    Les notifications de changement de statut
    Lors d’un changement de statut d’une instance, l’ensemble des administrateurs de la ferme doivent être notifiés de cette modification ainsi que l’utilisateur administrateur de l’instance.
    À la demande d’un canal
    Passage au statut "publie"
    Passage au (...)

Sur d’autres sites (4111)

  • How to repair a raw H.264 stream using FFmpeg

    13 janvier 2020, par Chris Kennedy

    I apologize if I start rambling or seem incoherent.

    Preface : My house caught on fire last week.

    I have been trying to get the footage off my security camera system (Zmodo, don’t ever buy this crap) to share with the fire marshal and my insurance. I can’t get it off the "proper" way because the box doesn’t detect any drive or any file system I throw at it, and none of their viewing apps (for Android or Windows) allow video downloads.

    I was able to get the files directly from the system’s hard drive, but they’re (of course) messed up in such a way that I can’t just open up VLC (or even Zmodo’s own viewing software !) and view them. I have spent several hours scouring the web for various ways to run it through FFmpeg to see if it can repair the file, but I’ve had no luck so far and my mind is already stretched thin with everything else.

    This is the output from ffprobe :

    ffprobe version 4.2.1 Copyright (c) 2007-2019 the FFmpeg developers
     built with gcc 9.1.1 (GCC) 20190807
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
     libavutil      56. 31.100 / 56. 31.100
     libavcodec     58. 54.100 / 58. 54.100
     libavformat    58. 29.100 / 58. 29.100
     libavdevice    58.  8.100 / 58.  8.100
     libavfilter     7. 57.100 /  7. 57.100
     libswscale      5.  5.100 /  5.  5.100
     libswresample   3.  5.100 /  3.  5.100
     libpostproc    55.  5.100 / 55.  5.100
    [h264 @ 000002479ee1c180] Format h264 detected only with low score of 1, misdetection possible!

    Then this repeats several dozen times :

       Last message repeated 1 times
    [h264 @ 000002479ee1de40] decode_slice_header error
    [h264 @ 000002479ee1de40] no frame!
    [h264 @ 000002479ee1de40] non-existing PPS 0 referenced

    And it finishes off with this :

    [h264 @ 000002479ee1c180] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, h264, from '.\recfile_-200102-130000-135959-00001100.264':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: h264, none, 25 fps, 25 tbr, 1200k tbn, 50 tbc

    I have tried several options with ffmpeg, including force_key_frames, setting the analyzeduration and probesize options to max_int, tried a -c copy, forcibly specified x264, tried to force a specific resolution (which it should all be standard HD video), and several others that I can’t recall at the moment.

    The video files are also accompanied by a .IDX file, but I haven’t figured out how important they are if they are at all to the video file.

    I can provide links to the smallest video and its associated IDX if needed, but if anyone can think of anything else to try on these files I’d greatly appreciate it.

  • swr_convert float planar to S16

    8 janvier 2020, par Kevin Kouketsu

    How convert using libav API AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16

    I’m trying to figure out how to resample and encode PCM (captured from Microphone) 44.1KHz to AAC 48.0KHz

    That’s my resampler initializer :

    void initialize_resampler(SwrContext*& resamplerCtx, AVCodecContext* encoder, AVFrame*& rawResampledAudioFrame, AVStream* audioFormatStream)
    {
       int nb_samples = (encoder->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) ? encoder->sample_rate : encoder->frame_size;

       int encoderFrameSize = encoder->channels * av_get_bytes_per_sample(encoder->sample_fmt) * encoder->frame_size;
       rawResampledAudioFrame = allocate_audioframe(encoder->sample_fmt, encoder->channel_layout, encoder->sample_rate, nb_samples);

       // Copy the stream parameters to the muxer
       check(avcodec_parameters_from_context(audioFormatStream->codecpar, encoder));

       // Create resampler context
       resamplerCtx = swr_alloc();
       if (resamplerCtx == nullptr)
           throw std::runtime_error("Could not allocate resampler context");

       // Set options
       check(av_opt_set_int(resamplerCtx, "in_channel_count", 2, 0));
       check(av_opt_set_int(resamplerCtx, "in_sample_rate", 44100, 0));
       check(av_opt_set_sample_fmt(resamplerCtx, "in_sample_fmt", AV_SAMPLE_FMT_S16, 0));
       check(av_opt_set_int(resamplerCtx, "out_channel_count", encoder->channels, 0));
       check(av_opt_set_int(resamplerCtx, "out_sample_rate", encoder->sample_rate, 0));
       check(av_opt_set_sample_fmt(resamplerCtx, "out_sample_fmt", encoder->sample_fmt, 0));

       // initialize the resampling context
       check(swr_init(resamplerCtx));
    }

    And for resample I’ve this code :

       AVPacket pkt{};
       while (true)
       {
           AVPacket input_packet;
           av_init_packet(&input_packet);

           check(av_read_frame(inputContext, &input_packet));

           check(avcodec_send_packet(decoderContext, &input_packet));
           check(avcodec_receive_frame(decoderContext, decodedFrame));


           // WHAT DO HERE swr_convert(resamplerContext, )
           av_packet_unref(&input_packet);

           av_init_packet(&pkt);
           auto in_stream = inputContext->streams[pkt.stream_index];
           auto out_stream = outputContext->streams[pkt.stream_index];

           pkt.pts = av_rescale_q_rnd(pkt.pts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
           pkt.dts = av_rescale_q_rnd(pkt.dts, in_stream->time_base, out_stream->time_base, (AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
           pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);
           pkt.pos = -1;

           check(avcodec_send_frame(encoderContext, decodedFrame));
           check(avcodec_receive_packet(encoderContext, &pkt));

           check(av_interleaved_write_frame(outputContext, &pkt));
           av_packet_unref(&pkt);
       }

    REading the docs I can’t figure out what exactly I need to pass to function. I have this code to encode PCM to MP2 (output is AV_SAMPLE_FMT_S16)

    const uint8_t* inPtr[] { const_cast<const>(&amp;pcmData[0]), nullptr, nullptr,nullptr,nullptr,nullptr,nullptr,nullptr };
    uint8_t* outPtr[] { &amp;resampledAudioData[0], nullptr, nullptr,nullptr,nullptr,nullptr,nullptr,nullptr };

    int resampledSamplesCount{ swr_convert(
       resamplerCtx,
       outPtr,
       maxResampledSamplesCount,
       inPtr,
       inputSampleCount) };

    // Negativo indica erro.
    check(resampledSamplesCount);
    </const>

    pcmData is raw data from input AVPacket (PCM)

    What I get here is : MP2 isn’t planar so it uses the same outPtr[0] different from plannar which needs two valid pointers to same writable data. But what I need to pass to inPtr, for example ?

    When I try to use the same code, ffmpeg try to write on outPtr[1] which is nullptr.

  • How to hide/disable ffmpeg erros when using OpenCV (python) ?

    20 décembre 2019, par Mehran

    I’m using OpenCV python to capture a video.
    This is my code

    import cv2

    cap = cv2.VideoCapture("vid.mp4")
    while True:
       flag, frame =  cap.read()

       if not flag:
           cv2.imshow('video', frame)

       if cv2.waitKey(10) == 27:
           break

    When a frame is not ready it produces an error like this

    enter image description here

    or

    Truncating packet of size 2916 to 1536
    [h264 @ 0x7ffa4180be00] AVC: nal size 2912
    [h264 @ 0x7ffa4180be00] AVC: nal size 2912
    [h264 @ 0x7ffa4180be00] no frame!

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ffa41803000] stream 0, offset 0x14565: partial file

    I wanted to find a way to hide this error ! I guess that this error is being produced by ffmpeg. Is there any way to hide or disable it ?

    This error is produced when I call cap.read(). And I also tried to wrap it with try ... except ... but it doesn’t work because it doesn’t throw any exceptions.