Recherche avancée

Médias (2)

Mot : - Tags -/kml

Autres articles (74)

  • 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

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

Sur d’autres sites (5489)

  • Small discord bot with a set of working music commands, about 6 days ago the play function completely stopped functioning (more below)

    24 février 2021, par TheColoradoKid

    It is a small discord python bot for my server with various features, which had included music commands until they stopped out of the blue without showing any error for the problem.
It uses FFMpeg, and youtubeDl along with pytube to gather the song and store it locally to play it, I have pip updated all of these and they are definitely on the current versions as I have made sure of this online.
Any help or insight anyone could provide would be greatly appreciated. I'm sorry if the code is convoluted in the way it's written I'm still pretty new to coding and this is one of my first proper larger projects.

    


    If you need any information I'm happy to give what I can to help.

    


    Here is the code for the play command :

    


    @client.command()
async def play(ctx, *args):
    global queu
    #global autom
    if not args:
        voice = get(client.voice_clients, guild=ctx.guild)
        if not voice.is_playing():
            server = ctx.message.guild
            voice_channel = server.voice_client
            if queu:
                async with ctx.typing():
                    player = await YTDLSource.from_url(queu[0], loop=client.loop)
                    voice_channel.play(player, after=lambda e: print('Player error: %s' % e) if e else None)

                await ctx.send('**Now playing:** {}'.format(player.title))
                del(queu[0])
                # while autom == True:
                #     try:
                #         a = client.get_command('auto')
                #         await ctx.invoke(a)
                #     except:
                #         print('')
            elif not queu:
                await ctx.send("You can't play if there isn't anything in the queue\nIf auto mode was on it has now been disabled, to use it gain please add to the queue and run ``;auto on``")
                autom = False
    if args:
        global gueu
        search_keywords = ""
        print(args)
        for word in args:
            search_keywords += word
            search_keywords += '+'
        link = "https://www.youtube.com/results?search_query="
        link += search_keywords
        #print(link)
        html = urllib.request.urlopen(link)
        video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
        url = ("https://www.youtube.com/watch?v=" + video_ids[0])
        #print(url)
        queu.append(url)
        #print(queu)
        await ctx.send("``{}`` added to queue!\n If the song doesn't start please either let the current song end and run ``;play``/``;next`` again or run ``;next`` to play now".format(url))
        try:
            p = client.get_command('play')
            await ctx.invoke(p)
        except:
            print('failed')


    


  • C++ ffmpeg video missing frames and won't play in Quicktime

    5 décembre 2019, par Oliver Dain

    I wrote some C++ code that uses ffmpeg to encode a video. I’m having two strange issues :

    1. The final video is always missing 1 frame. That is, if I have it encode 10 frames the final video only has 9 (at least that’s what ffprobe -show_frames -pretty $VIDEO | grep -F '[FRAME]' | wc -l tells me.
    2. The final video plays fine in some players (mpv and vlc) but not in Quicktime. Quicktime just shows a completely black screen.

    My code is roughly this (modified a bit to remove types that are unique to our code base) :

    First, I open the video file, write the headers and initialize things :

    template <class ptrt="ptrt">
    using UniquePtrWithDeleteFunction = std::unique_ptr>;


    std::unique_ptr<ffmpegencodingframesink> FfmpegEncodingFrameSink::Create(
       const std::string&amp; dest_url) {
     AVFormatContext* tmp_format_ctxt;
     auto alloc_format_res = avformat_alloc_output_context2(&amp;tmp_format_ctxt, nullptr, "mp4", dest_url.c_str());
     if (alloc_format_res &lt; 0) {
       throw FfmpegException("Error opening output file.");
     }
     auto format_ctxt = UniquePtrWithDeleteFunction<avformatcontext>(
         tmp_format_ctxt, CloseAvFormatContext);

     AVStream* out_stream_video = avformat_new_stream(format_ctxt.get(), nullptr);
     if (out_stream_video == nullptr) {
       throw FfmpegException("Could not create outputstream");
     }

     auto codec_context = GetCodecContext(options);
     out_stream_video->time_base = codec_context->time_base;

     auto ret = avcodec_parameters_from_context(out_stream_video->codecpar, codec_context.get());
     if (ret &lt; 0) {
       throw FfmpegException("Failed to copy encoder parameters to outputstream");
     }

     if (!(format_ctxt->oformat->flags &amp; AVFMT_NOFILE)) {
       ret = avio_open(&amp;format_ctxt->pb, dest_url.c_str(), AVIO_FLAG_WRITE);
       if (ret &lt; 0) {
         throw VideoDecodeException("Could not open output file: " + dest_url);
       }
     }

     ret = avformat_init_output(format_ctxt.get(), nullptr);
     if (ret &lt; 0) {
       throw FfmpegException("Unable to initialize the codec.");
     }

     ret = avformat_write_header(format_ctxt.get(), nullptr);
     if (ret &lt; 0) {
       throw FfmpegException("Error occurred writing format header");
     }

     return std::unique_ptr<ffmpegencodingframesink>(
         new FfmpegEncodingFrameSink(std::move(format_ctxt), std::move(codec_context)));
    }
    </ffmpegencodingframesink></avformatcontext></ffmpegencodingframesink></class>

    Then, every time I get a new frame to encode I pass it to this function (the frames are being decoded via ffmpeg from another mp4 file which Quicktime plays just fine) :

    // If frame == nullptr then we're done and we're just flushing the encoder
    // otherwise encode an actual frame
    void FfmpegEncodingFrameSink::EncodeAndWriteFrame(
       const AVFrame* frame) {
     auto ret = avcodec_send_frame(codec_ctxt_.get(), frame);
     if (ret &lt; 0) {
       throw FfmpegException("Error encoding the frame.");
     }

     AVPacket enc_packet;
     enc_packet.data = nullptr;
     enc_packet.size = 0;
     av_init_packet(&amp;enc_packet);

     do {
       ret = avcodec_receive_packet(codec_ctxt_.get(), &amp;enc_packet);
       if (ret ==  AVERROR(EAGAIN)) {
         CHECK(frame != nullptr);
         break;
       } else if (ret ==  AVERROR_EOF) {
         CHECK(frame == nullptr);
         break;
       } else if (ret &lt; 0) {
         throw FfmpegException("Error putting the encoded frame into the packet.");
       }

       assert(ret == 0);
       enc_packet.stream_index = 0;

       LOG(INFO) &lt;&lt; "Writing packet to stream.";
       av_interleaved_write_frame(format_ctxt_.get(), &amp;enc_packet);
       av_packet_unref(&amp;enc_packet);
     } while (ret == 0);
    }

    Finally, in my destructor I close everything up like so :

    FfmpegEncodingFrameSink::~FfmpegEncodingFrameSink() {
     // Pass a nullptr to EncodeAndWriteFrame so it flushes the encoder
     EncodeAndWriteFrame(nullptr);
     // write mp4 trailer
     av_write_trailer(format_ctxt_.get());
    }

    If I run this passing n frames to EncodeAndWriteFrame line LOG(INFO) &lt;&lt; "Writing packet to stream."; gets run n times indicating the n packets were written to the stream. But ffprobe always shows only n - 1 frames int he video. And the final video doesn’t play on quicktime.

    What am I doing wrong ??

  • configure : arm : Don't add -march= to the compiler if no preference was passed

    20 septembre 2021, par Martin Storsjö
    configure : arm : Don't add -march= to the compiler if no preference was passed
    

    If no —cpu= option was passed to configure, we detect what the
    compiler defaults to. This detected value was then fed back to the
    rest of the configure logic, as if it was an explicit choice.

    This breaks on Ubuntu 21.10 with GCC 11.1.

    Since GCC 8, it's possible to add configure extra features via the
    - march option, like e.g. -march=armv7-a+neon. If the -mfpu= option
    is configured to default to 'auto', the fpu setting gets taken
    from the -march option.

    GCC 11.1 in Ubuntu seems to be configured to use -mfpu=auto. This
    has the effect of breaking any compilation command that specifies
    - march=armv7-a, because the driver implicitly also adds -mfloat-abi=hard,
    and that combination results in this error :

    cc1 : error : ‘-mfloat-abi=hard’ : selected processor lacks an FPU

    One can compile successfully by passing e.g. -march=armv7-a+fp.

    Therefore, restructure configure. If no specific preference was set
    (and the 'cpu' configure variable was set as the output of
    probe_arm_arch), the value we tried to set via -march= was the same
    value that we just tried to detect as the compiler default.

    So instead, just try to detect what the compiler defaults to, with
    to allow setting other configure settings (such as 'fast_unaligned'),
    but don't try to spell out the compiler's default via the -march flag.

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DH] configure