Recherche avancée

Médias (2)

Mot : - Tags -/kml

Autres articles (23)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

Sur d’autres sites (2786)

  • Revision 32594 : plugins en minuscules, et alias pour les noms de sites

    1er novembre 2009, par fil@… — Log

    plugins en minuscules, et alias pour les noms de sites

  • (FFMPEG) avformat_write_header crashes (MSVC2013) (C++) (Qt)

    29 avril 2015, par user3502626

    I just downloaded FFMPEG and now I’m trying to use it in Qt with MSVC2013 compiler.

    To understand how it works, I started reading the documentation and the API.
    According to this figure, I was trying to make a little test with libavformat.

    I did all they said in the demuxing module, then the muxing module. But, my program crashes when I call the avformat_write_header() function.

    I would like to know what I did wrong and if you could help me to understand that.

    In the main :

    av_register_all();

    if(!decode())
       return;

    The decode() methode :

    bool MainWindow::decode()
    {
    AVFormatContext *formatContext = NULL;
    AVPacket packet;

    /**************** muxing varaiables ******************/

    AVFormatContext *muxingContext = avformat_alloc_context();
    AVOutputFormat *outputFormat = NULL;
    AVIOContext *contextIO = NULL;
    AVCodec *codecEncode = avcodec_find_encoder(AV_CODEC_ID_WMAV2);
    AVStream *avStream =  NULL;
    AVCodecContext *codecContext = NULL;


    /******************* demuxing **************************/

    //open a media file
    if(avformat_open_input(&formatContext,"h.mp3",NULL,NULL)!=0)
    {
       qDebug() << "paka ouve fichier";
       return false;
    }

    //function which tries to read and decode a few frames to find missing          
    information.
    if(avformat_find_stream_info(formatContext,NULL)<0)
    {
       qDebug()<<"paka find stream";
       return false;
    }


    /**************** muxing *************************/

    //The oformat field must be set to select the muxer that will be used.
    muxingContext->oformat = outputFormat;

    //Unless the format is of the AVFMT_NOFILE type, the pb field must be set to
    //an opened IO context, either returned from avio_open2() or a custom one.
    if(avio_open2(&contextIO,"out.wma",AVIO_FLAG_WRITE,NULL,NULL)<0)
    {
       qDebug() <<"paka kreye fichier soti";
       return false;
    }
    muxingContext->pb = contextIO;

    //Unless the format is of the AVFMT_NOSTREAMS type, at least
    //one stream must be created with the avformat_new_stream() function.
    avStream = avformat_new_stream(muxingContext,codecEncode);

    //The caller should fill the stream codec context information,
    //such as the codec type, id and other parameters
    //(e.g. width / height, the pixel or sample format, etc.) as known

    codecContext = avStream->codec;
    codecContext->codec_type = AVMEDIA_TYPE_AUDIO;
    codecContext->codec_id = AV_CODEC_ID_WMAV2;
    codecContext->sample_fmt = codecEncode->sample_fmts[0];
    codecContext->bit_rate = 128000;
    codecContext->sample_rate = 44000;
    codecContext->channels = 2;

    //The stream timebase should be set to the timebase that the caller desires
    //to use for this stream (note that the timebase actually used by the muxer
    //can be different, as will be described later).

    avStream->time_base = formatContext->streams[0]->time_base;
    qDebug()<streams[0]->time_base.num <<"/"
    <streams[0]->time_base.den;


    //When the muxing context is fully set up, the caller must call    
    //avformat_write_header()
    //to initialize the muxer internals and write the file header

    qDebug() << "does not crash yet";
    if(avformat_write_header(muxingContext,NULL) <0)
    {
       qDebug()<<"cannot write header";
       return false;
    }
    qDebug() << "OOps you can't see me (John Cena)";

    ///////////////////// Reading from an opened file //////////////////////////
    while(av_read_frame(formatContext,&packet)==0)
    {
       //The data is then sent to the muxer by repeatedly calling
       //av_write_frame() or av_interleaved_write_frame()
       if(av_write_frame(muxingContext,&packet)<0)
           qDebug()<<"paka write frame";
       else
           qDebug()<<"writing";
    }

    //Once all the data has been written, the caller must call
    //av_write_trailer() to flush any buffered packets and finalize
    //the output file, then close the IO context (if any) and finally
    //free the muxing context with avformat_free_context().

    if(av_write_trailer(muxingContext)!=0)
    {
       qDebug()<<"paka ekri trailer";
       return false;
    }


    return true;
    }

    The program shows the message does not crash yet. But not OOps you can’t see me (John Cena)

    And there is no error. I used an MP3 file as input and I would like to ouput it in WMA.

  • Discord bot stop playing music in random time of song

    25 janvier 2021, par Jusmejtr

    I have a discord to let me play a random song from the list.

    


    How bot works :
Bot IS connected to firestore Cloud (firebase) where i have economy data from my server. Price for playing random song is 75 coins.

    


    Everything worked as it should, but yesterday I used command, the bot started playing and after a while it stopped playing music and also no other commands worked, bot probably get freezed.

    


    I have no errors in the console until after a minute it showed me this error.

    


    https://pastebin.com/ay9gV75T

    


    The bot is hosted on Heroku and I also added this buildpack to ffmpeg in the settings.

    


    https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest

    


    This is my code :

    


    module.exports = {
    name: "buy-music",
    description: "buy a music",

    async execute(message, config, db){
        const PREFIX = (config.prefix);

        if(message.content === PREFIX + "buy music"){
            const ytdl = require("ytdl-core");
            message.delete();
            let uzivatel = message.author.tag;

            let voiceChannel = message.member.voice.channel;
            if(!voiceChannel) return message.reply("Musíš byť vo voice roomke");

            let cena = 75;
    
            db.collection('economy').doc(uzivatel).get().then(async (q) => {
                if(!q.exists) return message.reply("Nemáš vytvorený účet");
                var hodnota = q.data().money;
                if(hodnota < cena) return message.reply("Nemáš dostatok financií");

                db.collection('statusy').doc('music').get().then(async (asaj) => {
                    let stav = asaj.data().stav;
                    if(stav == "off"){
                        db.collection('statusy').doc('music').update({
                            "stav": "on",
                            "autor": message.author.tag,
                        });
                        hodnota -= cena;
                        db.collection('economy').doc(uzivatel).update({
                            'money': hodnota
                        });
                        function randomhraj(){
                            var pole = [
                     My YT links

                            ]
                            let rnd = Math.floor(Math.random() * pole.length);
                            let output = pole[rnd];
                            return output;
                        }
        
                        try{
                            var pripojenie = await voiceChannel.join();
                            message.reply(`Úspešne si si kúpil chuťovečku`);
                        }catch(error){
                            console.log(`Error pri pripajani do room (music join) ${error}`);
                        }
                        
                        const dispatcher = pripojenie.play(ytdl(randomhraj())).on("finish", async() => {
                            await voiceChannel.leave();
                            await db.collection('statusy').doc('music').update({
                                "stav": "off",
                                "autor": "nikto",
                            });
                        }).on("error", error => {
                            console.log(error)
                        })
                        dispatcher.setVolumeLogarithmic(5 / 5)
                    }else{
                        message.reply("Momentálne si hudbu kúpil niekto iný alebo ak si hudbu kúpil a chceš ju zastaviť použi príkaz *stop");
                    }
                    
                });
            });
    
        }else if(message.content === PREFIX + "stop"){
            message.delete();
            db.collection('statusy').doc('music').get().then((n) => {
                let kto = n.data().autor;
                let meno = message.author.tag;
                if(!message.member.voice.channel) return message.channel.send("Musíš byť vo voice roomke pre stopnutie hudby");
                if(kto == meno){
                    message.member.voice.channel.leave();
                    message.channel.send("Úspešne odpojený");
                    db.collection('statusy').doc('music').update({
                        "stav": "off",
                        "autor": "nikto",
                    });
                }else{
                    message.reply("Zastaviť hudbu môže len ten kto si ju kúpil");
                }
            });
        }
        
    }
}