Recherche avancée

Médias (1)

Mot : - Tags -/illustrator

Autres articles (60)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (7354)

  • FFMPEG G711ulaw Rhythmic Distortion [closed]

    8 juillet 2024, par nsd123

    I am using ffmpeg take audio in from my microphone, rtp stream it to a multicast address as g711ulaw audio, and then play that audio through various devices.

    


    In my network I have other workstations, as well as a digital telephone type device.
My workstations are using Windows.

    


    I am taking the microphone input with this ffmpeg command :
ffmpeg -f dshow -i audio="" -pcm_mulaw -ab 64k -ac 1 -ar 8000 -f rtp rtp :// : ?localaddr=

    


    This command transmits the microphone data successfully to other workstations on the network, where I can use ffplay or other means to listen to the rtp stream and hear clear audio.

    


    On the telephone device, when it gets converted to analog to play, it's picking up this strange, rhythmic burp/clicking/noise, like every time its getting information, its interpreting the header as voice data or something.

    


    The output of the ffmpeg command says the pcm_s16le codec is the native one, and seems to convert it just fine.

    


    Is there any kind of option I should be using in my ffmpeg command that sounds like it could resolve this issue ? Or does this kind of interference typically occur for a specific reason ?

    


    Its not the hardware, I've tested that (other audio able to play clearly).
I've tried a few other codecs to no success.
I've tried a few ffmpeg options, but there are so many options, they've just been successful stabs in the dark

    


  • How to clean the packets of AVFormatContext ?

    8 mars 2024, par Jorge Augusto Wilchen

    I'm trying to write a video recorder class with ffmpeg, but video file generate have a issue. In every record, the second 1 of the video is a dark frame, and the second 2 is single frame, repeated 25 times. After that, the video runs normal.
If I record a video during 10 seconds, the video file will have 12 seconds (2 first second with this issue).

    


    This is my code to start and record the frames :

    


    #include <iostream>&#xA;#include <sstream>&#xA;#include <string>&#xA;#include <iomanip>&#xA;#include <thread>&#xA;&#xA;extern "C" {&#xA;#include <libavformat></libavformat>avformat.h>&#xA;}&#xA;</thread></iomanip></string></sstream></iostream>

    &#xA;

    bool recording;&#xA;&#xA;const std::string recordFileName = "video.avi";&#xA;&#xA;std::string camera_address;&#xA;std::thread recordingThread;&#xA;&#xA;AVFormatContext* inputFormatContext;&#xA;AVOutputFormat* outputFormat;&#xA;AVFormatContext* outputFormatContext;&#xA;AVStream* outputVideoStream;&#xA;

    &#xA;

    bool VideoRecorder::start_record()&#xA;{&#xA;    if (!recording) {&#xA;        AVDictionary* options = nullptr;&#xA;        av_dict_set(&amp;options, "rtsp_transport", "udp", 0);&#xA;&#xA;        if (avformat_open_input(&amp;inputFormatContext, camera_address.c_str(), nullptr, &amp;options) != 0) {&#xA;            std::cerr &lt;&lt; "Error opening input stream." &lt;&lt; std::endl;&#xA;            return false;&#xA;        }&#xA;&#xA;        if (avformat_find_stream_info(inputFormatContext, nullptr) &lt; 0) {&#xA;            std::cerr &lt;&lt; "Error finding stream information." &lt;&lt; std::endl;&#xA;            avformat_close_input(&amp;inputFormatContext);&#xA;            return false;&#xA;        }&#xA;&#xA;        // Open output file AVI&#xA;        if (avformat_alloc_output_context2(&amp;outputFormatContext, outputFormat, "avi", recordFileName.c_str()) &lt; 0) {&#xA;            std::cerr &lt;&lt; "Error allocating output context." &lt;&lt; std::endl;&#xA;            avformat_close_input(&amp;inputFormatContext);&#xA;            return false;&#xA;        }&#xA;&#xA;        // Add a new video stream to the output file&#xA;        outputVideoStream = avformat_new_stream(outputFormatContext, nullptr);&#xA;        if (!outputVideoStream) {&#xA;            std::cerr &lt;&lt; "Error creating output video stream." &lt;&lt; std::endl;&#xA;            avformat_close_input(&amp;inputFormatContext);&#xA;            avformat_free_context(outputFormatContext);&#xA;            return false;&#xA;        }&#xA;&#xA;        if (avcodec_parameters_copy(outputVideoStream->codecpar, inputFormatContext->streams[0]->codecpar) &lt; 0) {&#xA;            std::cerr &lt;&lt; "Error copying codec parameters." &lt;&lt; std::endl;&#xA;            avformat_close_input(&amp;inputFormatContext);&#xA;            avformat_free_context(outputFormatContext);&#xA;            return false;&#xA;        }&#xA;        // Open the output file for writing&#xA;        if (avio_open(&amp;outputFormatContext->pb, recordFileName.c_str(), AVIO_FLAG_WRITE) &lt; 0) {&#xA;            std::cerr &lt;&lt; "Error opening output file for writing." &lt;&lt; std::endl;&#xA;            avformat_close_input(&amp;inputFormatContext);&#xA;            avformat_free_context(outputFormatContext);&#xA;            return false;&#xA;        }&#xA;        // Write output file header&#xA;        if (avformat_write_header(outputFormatContext, nullptr) &lt; 0) {&#xA;            std::cerr &lt;&lt; "Error writing output file header." &lt;&lt; std::endl;&#xA;            avformat_close_input(&amp;inputFormatContext);&#xA;            avformat_free_context(outputFormatContext);&#xA;            return false;&#xA;        }&#xA;&#xA;        recording = true;&#xA;        recordingThread = std::thread(&amp;VideoRecorder::record_video, this);&#xA;        std::cout &lt;&lt; "Recording started." &lt;&lt; std::endl;&#xA;        return true;&#xA;    }&#xA;    return false;&#xA;}&#xA;

    &#xA;

    bool VideoRecorder::record_video()&#xA;{&#xA;    if (recording) {&#xA;        AVPacket packet;&#xA;&#xA;        while (recording &amp;&amp; av_read_frame(inputFormatContext, &amp;packet) >= 0) {&#xA;            AVStream* in_stream = inputFormatContext->streams[packet.stream_index];&#xA;            AVStream* out_stream = outputFormatContext->streams[0];&#xA;&#xA;            // Adjustment of DTS and PTS to ensure increasing monoticity&#xA;            if (packet.pts != AV_NOPTS_VALUE) {&#xA;                packet.pts = av_rescale_q_rnd(packet.pts, in_stream->time_base, out_stream->time_base, AVRounding(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));&#xA;            }&#xA;&#xA;            if (packet.dts != AV_NOPTS_VALUE) {&#xA;                packet.dts = av_rescale_q_rnd(packet.dts, in_stream->time_base, out_stream->time_base, AVRounding(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));&#xA;            }&#xA;&#xA;            packet.duration = av_rescale_q(packet.duration, in_stream->time_base, out_stream->time_base);&#xA;&#xA;            packet.stream_index = 0;&#xA;            av_interleaved_write_frame(outputFormatContext, &amp;packet);&#xA;&#xA;            av_packet_unref(&amp;packet);&#xA;        }&#xA;&#xA;&#xA;        return true;&#xA;    }&#xA;&#xA;    std::cerr &lt;&lt; "Error recording video. Recording not started or already stopped." &lt;&lt; std::endl;&#xA;    return false;&#xA;}&#xA;

    &#xA;

    I know this extra 2 seconds of frames comes from avformat_open_input(&amp;inputFormatContext, camera_address.c_str(), nullptr, &amp;options) and avformat_find_stream_info(inputFormatContext, nullptr) execution, this fuction execute in around 2-3 seconds, and at this time, wrong packets are writen to inputFormatContext.

    &#xA;

    I've already tried :

    &#xA;

    avformat_flush(inputFormatContext); ;

    &#xA;

    while (av_read_frame(inputFormatContext, &amp;packet) >= 0) { av_packet_unref(&amp;packet); } ;

    &#xA;

    Write the first 2 seconds in another file ;

    &#xA;

    Cut the first 2 seconds from the file (this works in the terminal, but not in code)

    &#xA;

    void VideoRecorder::cut_video() {&#xA;    std::string outputFileName = "cut_" &#x2B; recordFileName;&#xA;    std::string command = "ffmpeg -ss 2 -i " &#x2B; recordFileName &#x2B; " -c copy " &#x2B; outputFileName;&#xA;&#xA;    int result = std::system(command.c_str());&#xA;&#xA;    if (result == 0) {&#xA;        std::cout &lt;&lt; "Video cut successfully." &lt;&lt; std::endl;&#xA;        &#xA;        std::remove(recordFileName.c_str());&#xA;        std::cout &lt;&lt; "Original video file deleted." &lt;&lt; std::endl;&#xA;    } else {&#xA;        std::cerr &lt;&lt; "Error cutting video." &lt;&lt; std::endl;&#xA;    }&#xA;}&#xA;

    &#xA;

     ;

    &#xA;

    Verify packet.dts and packet.pts, if wrong values is find, don't write the packet ;

    &#xA;

    None of this solved my problem.&#xA;I just need a way to remove this first 2 seconds of wrong frames from my video.

    &#xA;

  • How to display a stream of mdat/moof boxes in VLC ? [closed]

    8 juillet 2024, par roacs

    I am trying to display a real-time video stream in VLC. The snag is that the real-time video that is being received is a stream of just the mdat and moof boxes of a fragmented MP4 file that is being recorded elsewhere. The initialization information (ftyp/moov) is not and will never be available in the real-time stream. There is also no audio.

    &#xA;

    I have access to initialization information (ftyp/moov) of a previously completed file and can use that to aid in the processing/streaming of the real-time mdat/moof boxes.

    &#xA;

    I am currently extracting the contents of the mdat box, splitting those up and packaging them in 188 byte MPEG-TS packets and multicasting them for VLC to pick up. And just as a shot in the dark, every 50 mdat's I am also packaging the SPS and PPS NALUs from the initialization information of the completed file and multicasting those in one MPEG-TS packet.

    &#xA;

    Input looks like this :

    &#xA;

      &#xA;
    • ...
    • &#xA;

    • mdat 1
    • &#xA;

    • moof 1
    • &#xA;

    • mdat 2
    • &#xA;

    • moof 2
    • &#xA;

    • ...
    • &#xA;

    • mdat N
    • &#xA;

    • moof N
    • &#xA;

    • ...
    • &#xA;

    &#xA;

    And my output looks like this :

    &#xA;

      &#xA;
    • ...
    • &#xA;

    • MPEG-TS 1 containing first 184 bytes of mdat 1
    • &#xA;

    • MPEG-TS 2 containing next 184 bytes of mdat 1
    • &#xA;

    • ...
    • &#xA;

    • MPEG-TS N containing last 184 bytes of mdat 1
    • &#xA;

    • MPEG-TS N+1 containing first 184 bytes of mdat 2
    • &#xA;

    • MPEG-TS N+2 containing next 184 bytes of mdat 2
    • &#xA;

    • ...
    • &#xA;

    • MPEG-TS N+M containing last 184 bytes of mdat 2
    • &#xA;

    • ...
    • &#xA;

    • MPEG-TS containing SPS and PPS NALU
    • &#xA;

    • ...
    • &#xA;

    &#xA;

    VLC gets the data but no video playback.

    &#xA;

    How do I process this input in order to get it to play in VLC ?

    &#xA;