Recherche avancée

Médias (16)

Mot : - Tags -/mp3

Autres articles (78)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Qu’est ce qu’un masque de formulaire

    13 juin 2013, par

    Un masque de formulaire consiste en la personnalisation du formulaire de mise en ligne des médias, rubriques, actualités, éditoriaux et liens vers des sites.
    Chaque formulaire de publication d’objet peut donc être personnalisé.
    Pour accéder à la personnalisation des champs de formulaires, il est nécessaire d’aller dans l’administration de votre MediaSPIP puis de sélectionner "Configuration des masques de formulaires".
    Sélectionnez ensuite le formulaire à modifier en cliquant sur sont type d’objet. (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (13299)

  • "Critical error detected c0000374" when running av_packet_unref or av_frame_unref

    15 mai 2021, par Shivang Sharma

    I am trying to read and decode frames which is happening nicely but when its reaching part of un-referencing frame or packet using av_packet_unref and av_frame_unref it is giving error during second frame or third frame sometimes .

    


    Error (Copied from visual studio output window) :

    


    Critical error detected c0000374
Libav.exe has triggered a breakpoint


    


    Here is some code of reading and decoding which is giving error :

    


    void Decoder::streamNextFrame(int type = 0)
{
    while (av_read_frame(this->fileFormatCtx, this->latestpacket) >= 0) {
        if (this->audioDecoder->activeAudioStream != nullptr) {
            if (this->latestpacket->stream_index == this->audioDecoder->activeAudioStream->index) {
                avcodec_send_packet(this->audioDecoder->activeStreamDecoder, this->latestpacket);
                err = avcodec_receive_frame(this->audioDecoder->activeStreamDecoder, this->decodedFrame);
                if (err == AVERROR(EAGAIN)) {
                    av_frame_unref(this->decodedFrame);
                    av_packet_unref(this->latestpacket);
                    continue;
                }

                {
                    int currentIndex = (int)this->audioFrames->size();
                    this->audioFrames->resize((int)this->audioFrames->size() + 1);
                    int nb = 0;
                    this->audioFrames->at(currentIndex).pts = (int)this->decodedFrame->pts;
                    if (this->audioDecoder->activeStreamDecoder->sample_fmt != AV_SAMPLE_FMT_S16) {
                        nb = 2048 * this->audioDecoder->activeStreamDecoder->channels;
                        printf("%i\n", nb);
                        this->audioFrames->at(currentIndex).data.resize(nb);
                        if (!swr_is_initialized(swr)) {

                            swr_alloc_set_opts(swr, this->audioDecoder->activeStreamDecoder->channel_layout, AV_SAMPLE_FMT_S16, this->audioDecoder->activeStreamDecoder->sample_rate, this->audioDecoder->activeStreamDecoder->channel_layout, this->audioDecoder->activeStreamDecoder->sample_fmt, this->audioDecoder->activeStreamDecoder->sample_rate, 0, nullptr);
                            swr_init(swr);
                        }

                        uint8_t* buffer = this->audioFrames->at(currentIndex).data.data();
                        swr_convert(swr, &buffer, nb, (const uint8_t**)this->decodedFrame->extended_data, this->decodedFrame->nb_samples);
                    }
                    else {
                        nb = this->decodedFrame->nb_samples * this->audioDecoder->activeStreamDecoder->channels;
                        this->audioFrames->at(currentIndex).data = std::vector(*this->decodedFrame->extended_data, *this->decodedFrame->extended_data + (uint8_t)nb);
                    }

                    this->audioFrames->at(currentIndex).buffersize = nb;
                }

                if (err == AVERROR_EOF) {
                    this->audioDecoder->streamEnded = true;
                    av_frame_unref(this->decodedFrame);
                    av_packet_unref(this->latestpacket);
                    break;
                }
                else if (err >= 0) {
                    this->audioDecoder->streamEnded = false;
                }

                if (type != 0) {
                    av_packet_unref(this->latestpacket);
                    av_frame_unref(this->decodedFrame);
                    break;
                }
                av_packet_unref(this->latestpacket);
                av_frame_unref(this->decodedFrame);
            }
        }
        else {
            printf("No active audio stream is set\n");
            if(type!=0)
            break;
        }
    }

}


    


    I have removed some of code which was concerning the video and was not giving problem I think.

    


    Some Information about above code :

    


    this->audioFrames is a pointer to vector with following type.&#xA;std::vector<audioframeformat>* "AudioFrameFormat" is struct defined as following&#xA;&#xA;struct AudioFrameFormat {&#xA;        std::vector data = {};&#xA;        int pts = 0;&#xA;        int buffersize = 0;&#xA;    };&#xA;&#xA;&#xA;swr is a private class member allocated in constructor&#xA;</audioframeformat>

    &#xA;

    Call Stack looks like :

    &#xA;

    enter image description here

    &#xA;

    I am getting from call stack is that I am not taking care of my heap memory.

    &#xA;

    Can someone please explain where problem is and, why some times it run till third frame and some time till second frame of the audio stream ?

    &#xA;

    And please tell how can I improve this code.

    &#xA;

  • Running ffmpeg (WASM/NodeJS) on multiple input files in a React App

    17 septembre 2024, par FlipFloop

    I recently followed a tutorial by Fireship.io going over making a React App that enables a user to input a video file and convert it into a gif. Here is the source GitHub Repo.

    &#xA;

    The packages used by the project are @ffmpeg/ffmpeg and @ffmpeg/core, which take care of converting the video into a GIF (although this can be changed to whatever, like the FFmpeg CLI tool).

    &#xA;

    I wanted to take this a step further and make it possible for me to convert multiple videos at once, each into their own separate gif, however, I am having trouble running the next task when the first is finished.

    &#xA;

    Here is documentation I found about the ffmpeg wasm package. I also read this example given by the package providers to have multiple outputs from a single file.

    &#xA;

    Here is my code (App.jsx) :

    &#xA;

    import { createFFmpeg, fetchFile } from &#x27;@ffmpeg/ffmpeg&#x27;;&#xA;const ffmpeg = createFFmpeg({ log: true });&#xA;&#xA;function App() {&#xA;    const [ready, setReady] = useState(false);&#xA;    const [videos, setVideos] = useState([]);&#xA;    const [gifs, setGifs] = useState([]);&#xA;    const load = async () => {&#xA;         await ffmpeg.load();&#xA;         setReady(true);&#xA;    };&#xA;&#xA;   useEffect(() => {&#xA;       load();&#xA;   }, []);&#xA;&#xA;   const onInputChange = (e) => {&#xA;       for (let i = 0; i &lt; e.target.files.length; i&#x2B;&#x2B;) {&#xA;           const newVideo = e.target.files[i];&#xA;           setVideos((videos) => [...videos, newVideo]);&#xA;       }&#xA;   };&#xA;&#xA;   const batchConvert = async (video) => {&#xA;       const name = video.name.split(&#x27;.mp4&#x27;).join(&#x27;&#x27;);&#xA;&#xA;       ffmpeg.FS(&#x27;writeFile&#x27;, name &#x2B; &#x27;.mp4&#x27;, await fetchFile(video));&#xA;       await ffmpeg.run(&#xA;           &#x27;-i&#x27;,&#xA;           name &#x2B; &#x27;.mp4&#x27;,&#xA;           &#x27;-f&#x27;,&#xA;           &#x27;gif&#x27;,&#xA;            name &#x2B; &#x27;.gif&#x27;,&#xA;        );&#xA;&#xA;        const data = ffmpeg.FS(&#x27;readFile&#x27;, name &#x2B; &#x27;.gif&#x27;);&#xA;&#xA;        const url = URL.createObjectURL(&#xA;            new Blob([data.buffer], { type: &#x27;image/gif&#x27; }),&#xA;        );&#xA;&#xA;        setGifs((gifs) => [...gifs, url]);&#xA;    };&#xA;&#xA;    const convertToGif = async () => {&#xA;        videos.forEach((video) => {&#xA;            batchConvert(video);&#xA;        }&#xA;    );&#xA;&#xA;return ready ? (&#xA;<div classname="App">&#xA;  {videos &amp;&amp;&#xA;    videos.map((video) => (&#xA;      <video controls="controls" width="250" src="{URL.createObjectURL(video)}"></video>&#xA;    ))}&#xA;&#xA;  <input type="file" multiple="multiple" />&#xA;&#xA;  {videos &amp;&amp; <button>Convert to Gif</button>}&#xA;&#xA;  {gifs &amp;&amp; (&#xA;    <div>&#xA;      <h3>Result</h3>&#xA;      {gifs.map((gif) => (&#xA;        <img src="http://stackoverflow.com/feeds/tag/{gif}" width="250" style='max-width: 300px; max-height: 300px' />&#xA;      ))}&#xA;    </div>&#xA;  )}&#xA;</div>&#xA;) : (&#xA;    <p>Loading...</p>&#xA;);&#xA;}&#xA;&#xA;export default App;&#xA;

    &#xA;

    The error I am getting is along the lines of "Cannot run multiple instances of FFmpeg at once", which I understand, however, I have no idea how to make the batchConvert function only run one instance at a time, whether it's outside or inside the function.

    &#xA;

    Thank you !

    &#xA;

  • Live video streaming with Node js ,HTML5, MPEG-DASH, FFMPEG and IP camera/Raspberry Pi

    12 mai 2016, par sparks

    I am a programmer but i am very new in live video streaming concepts.I need help

    What i want to accomplish

    I want to develop an online live video streaming system.The scenario is i would have a device or number of devices(raspberry pi & camera only OR ip camera only ...not sure yet) to capture the video and stream the video live in real time remotely to my web app.Multiple clients can connect to the web app and watch the video live.The key things to note here, is that these devices should be wireless(able to connect to internet and live stream the content) and also i want to eliminate the idea of manually configuring the ip adrress to local WIFI router.So simply i turn on the device and it start streaming right away to the web app.

    Infrastructure, Platforms,Browsers, Streaming methods and formats

    In the beginning i just want to stream though chrome web browser(that’s all i care about).But in the future i would build android and IOS mobile apps.So long term i would expect to be Chrome and mobile(Android & IOS platforms)
    So based on my research i learned that the client should be HTML5, streaming method MPEG-DASH(In the future add HLS), the web app will be in Node Js.I also came across Dash.js for Html5.

    My understanding of streaming based on my research

    I also came across things like FFMPEG,Dash encoder and wowza which i am not clear about.Now correct me if i am wrong, my understanding is that FFMPEG get hold of the device/camera and the content(i am not sure the format of the content at this point)and format it(i am not sure what this means in simple english) and then Dash encoder picks up and re-format the content to MPEG-DASH format, which produces MPD and then Dash.js client uses MPD to display the video to the browser.

    QUESTIONS

    1. First correct me if i am wrong based on my understanding above or
      clarify for me.Also I am not sure of where the wowza streaming
      engine come into play. Do i even need it ?

    2. I am not sure of the devices to use between Raspberry pi with camera
      module/ Or IP Wifi camera by itself.I know with raspberry pi
      connected to internet you can set up all the necessary programs and
      stream the video to web app directly(not sure about quality and
      performance) but I am not sure about Wifi camera.Is it possible to
      connect to the wifi camera remotely from the web app programatically
      without opening the wifi router portal manually or i should stick
      with Raspbery Pi ?

    3. For raspberry Pi would i be able to connect it with high quality
      picture IP camera/web cam ? (The point here to get the best picture
      through raspbery Pi)

      My expectations

      Better performance and quality would be great.But i know live streaming is not easy so i am willing to compromise performance to a point but not quality.

    Thank you in advance, Anything will be appreciated.I know this is a lot so take your time :)