Recherche avancée

Médias (0)

Mot : - Tags -/interaction

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

Autres articles (43)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (6322)

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

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