Recherche avancée

Médias (1)

Mot : - Tags -/stallman

Autres articles (94)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (9963)

  • Revision 7ab9a9587b : Remove Wextra warnings from vp9_sad.c As a side-effect, the max_sad check is re

    13 mai 2014, par Deb Mukherjee

    Changed Paths :
     Modify /test/sad_test.cc


     Modify /vp8/common/rtcd_defs.pl


     Modify /vp8/common/sad_c.c


     Modify /vp8/common/variance.h


     Modify /vp8/encoder/mcomp.c


     Modify /vp8/encoder/rdopt.c


     Modify /vp9/common/vp9_rtcd_defs.pl


     Modify /vp9/encoder/vp9_encodeframe.c


     Modify /vp9/encoder/vp9_mbgraph.c


     Modify /vp9/encoder/vp9_mcomp.c


     Modify /vp9/encoder/vp9_rdopt.c


     Modify /vp9/encoder/vp9_sad.c


     Modify /vp9/encoder/vp9_variance.h



    Remove Wextra warnings from vp9_sad.c

    As a side-effect, the max_sad check is removed from the
    C-implementation of VP8, for consistency with VP9, and to
    ensure that the SAD tests common to VP8/VP9 pass.
    That will make the VP8 C implementation of sad a little slower
    but given that is rarely used in practice, the impact will be
    minimal.

    Change-Id : I7f43089fdea047fbf1862e40c21e4715c30f07ca

  • Why is my DSharpPlus Slash Command not playing my desired sound using FFMPEG in C# ?

    19 mai 2023, par IngeniousThoughts

    I'm having a problem with my ffmpeg setup the commands work fine but my play command doesn't play my desired sound.

    


    //The command.
        [SlashCommand("play", "plays a sound in a voice channel.")]
        public async Task HowlCommand(InteractionContext ctx, [Choice("ChoiceName", "C:\\My\\Program\\Directory\\Name\\MySound.mp3")]
                                                             [Option("Sound", "Please select a Sound")] string filepath)
        {
            //Creates a slash command used response.
            //Also removes the error message.
            await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder()
                                                                                                                    .WithContent("Playing sound in voice channel. Please wait just a moment!"));
 
            //Checks if the user is not a bot to send the message.
            if (ctx.Member.IsBot)
            {
                return;
            }
            else
            {
                if(filepath != "C:\\My\\Program\\Directory\\Name\\MySound.mp3")
                {
                    var embedmessage = new DiscordMessageBuilder()
                        .AddEmbed(new DiscordEmbedBuilder()
 
                        .WithAuthor("BotName", null, ctx.Client.CurrentApplication.Icon)
                        .WithTitle("Please select the following sound to play:")
                        .WithImageUrl(ctx.Client.CurrentApplication.Icon)
                        .WithFooter("VoiceChannel Error.", "ImageURL.png")
                        .WithTimestamp(DateTime.Now)
                        .Build()
 
                        );
 
                    //Makes the command wait 5 seconds before sending the rest of the command data.
                    await Task.Delay(TimeSpan.FromSeconds(5));
 
                    //Sends the embed in a message.
                    await ctx.Channel.SendMessageAsync(embedmessage);
                }
                else
                {
                    //Makes the command wait 5 seconds before sending the rest of the command data.
                    await Task.Delay(TimeSpan.FromSeconds(5));
 
 
                    var vnext = ctx.Client.GetVoiceNext();
                    var vnc = vnext.GetConnection(ctx.Guild);
                    
                    //if null throws exception.
                    if (vnc == null)
                        throw new System.InvalidOperationException("Not connected in this guild.");
 
 
                    //Gets the mp3 file to use.
                    var ffmpeg = Process.Start(new ProcessStartInfo
                    {
                        FileName = "ffmpeg",
                        Arguments = $@"-i ""{filepath}"" -ac 2 -f s16le -ar 48000 pipe:1",
                        RedirectStandardOutput = true,
                        UseShellExecute = false
                    });
                    Stream pcm = ffmpeg.StandardOutput.BaseStream;
 
                    VoiceTransmitSink transmit = vnc.GetTransmitSink();
                    await pcm.CopyToAsync(transmit);
                    vnc.GetTransmitSink().VolumeModifier = 5;
 
                    //Makes the command wait 10 seconds before sending the rest of the command data.
                    await Task.Delay(TimeSpan.FromSeconds(10));
 
                    //Disconnects the bot from the voice channel.
                    vnc.Disconnect();
                }
            }
        }


    


    //The command.
        [SlashCommand("join", "Joins a voice channel.")]
        public async Task JoinChannel(InteractionContext ctx, [Choice("MyVoiceChannel", "VoiceChannelName")]
                                                             [Option("VoiceChannel", "Please choose a Voice Channel.")] DiscordChannel channel)
        {
            //Creates a slash command used response.
            //Also removes the error message.
            await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder()
                                                                                                                    .WithContent("Joining voice channel. Please wait just a moment!"));
 
            //Checks if the user is not a bot to send the message.
            if (ctx.Member.IsBot)
            {
                return;
            }
            else
            {
                if (channel.Name != "MyVoiceChannelName")
                {
                    var embedmessage = new DiscordMessageBuilder()
                        .AddEmbed(new DiscordEmbedBuilder()
 
                        .WithAuthor("BotName", null, ctx.Client.CurrentApplication.Icon)
                        .WithTitle("Please Create The Following Voice Channel:")
                        .WithImageUrl(ctx.Client.CurrentApplication.Icon)
                        .AddField("VoiceChannel:", "**BotName**" + Environment.NewLine + "Is Case Sensitive: **Yes**")
                        .WithFooter("VoiceChannel Error.", "ImageURL.png")
                        .WithTimestamp(DateTime.Now)
                        .Build()
 
                        );
 
                    //Makes the command wait 5 seconds before sending the rest of the command data.
                    await Task.Delay(TimeSpan.FromSeconds(5));
 
                    //Sends the embed in a message.
                    await ctx.Channel.SendMessageAsync(embedmessage);
                }
                else
                {
                    //Makes the command wait 5 seconds before sending the rest of the command data.
                    await Task.Delay(TimeSpan.FromSeconds(5));
 
 
                    channel = ctx.Member.VoiceState?.Channel;
                    await channel.ConnectAsync();
 
                }
            }
        }
 
    }
}


    


    public sealed class Program&#xA;    {&#xA;        public static DiscordClient Client { get; private set; }&#xA;        public static InteractivityExtension Interactivity { get; private set; }&#xA;        public static CommandsNextExtension Commands { get; private set; }&#xA;        public static VoiceNextExtension VoiceNext { get; private set; }&#xA; &#xA; &#xA;        static async Task Main(string[] args)&#xA;        {&#xA; &#xA;            //Main Window configs specifying the title name and color.&#xA;            Console.BackgroundColor = ConsoleColor.Black;&#xA;            Console.ForegroundColor = ConsoleColor.Magenta;&#xA;            Console.Title = "BotName";&#xA; &#xA;            //1. Get the details of your config.json file by deserialising it&#xA;            var configJsonFile = new JSONReader();&#xA;            await configJsonFile.ReadJSON();&#xA; &#xA;            //2. Setting up the Bot Configuration&#xA;            var discordConfig = new DiscordConfiguration()&#xA;            {&#xA;                Intents = DiscordIntents.All,&#xA;                Token = configJsonFile.token,&#xA;                TokenType = TokenType.Bot,&#xA;                AutoReconnect = true&#xA;            };&#xA; &#xA;            //3. Apply this config to our DiscordClient&#xA;            Client = new DiscordClient(discordConfig);&#xA; &#xA;            //4. Set the default timeout for Commands that use interactivity&#xA;            Client.UseInteractivity(new InteractivityConfiguration()&#xA;            {&#xA;                Timeout = TimeSpan.FromMinutes(2)&#xA;            });&#xA; &#xA;            //5. Set up the Task Handler Ready event&#xA;            Client.Ready &#x2B;= OnClientReady;&#xA; &#xA;            //6. Set up the Commands Configuration&#xA;            var commandsConfig = new CommandsNextConfiguration()&#xA;            {&#xA;                StringPrefixes = new string[] { configJsonFile.prefix },&#xA;                EnableMentionPrefix = true,&#xA;                EnableDms = true,&#xA;                EnableDefaultHelp = false,&#xA;            };&#xA; &#xA;            Commands = Client.UseCommandsNext(commandsConfig);&#xA; &#xA;            //7. Register your commands&#xA;            var slashCommandsConfig = Client.UseSlashCommands();&#xA;            slashCommandsConfig.RegisterCommands<mysoundscommand>(MyGuildID);&#xA; &#xA;            //8. Allows usage of voice channels.&#xA;            var VoiceNext = Client.UseVoiceNext();&#xA; &#xA;            //9. Connect to get the Bot online&#xA;            await Client.ConnectAsync();&#xA;            await Task.Delay(-1);&#xA;        }&#xA; &#xA;        private static Task OnClientReady(DiscordClient sender, ReadyEventArgs e)&#xA;        {&#xA;            return Task.CompletedTask;&#xA;        }&#xA;    }&#xA;</mysoundscommand>

    &#xA;

    SourceCode Link :

    &#xA;

    text

    &#xA;

    playing the playsound slash command but wasn't expecting it to not play the mp3 file.

    &#xA;

    everything else worked fine except when it transmits the sound it doesn't play it.

    &#xA;

  • H264 Encoding - Could not play video using VLC Player

    31 mars 2016, par bot1131357

    I am have trouble encoding an H264 video correctly using FFmpeg libav. I could not play the encoded video in VLC media player, and although I could play the video on MPC-HC the time shows 00:00/00:00. Clearly I’m missing something.

    The Media info from MPC-HC shows this :

    General
    Format : AVC
    Format/Info : Advanced Video Codec
    File size : 110 KiB
    Duration : 2s 400ms
    Overall bit rate : 375 Kbps
    Writing library : x264 core 148 r2665 a01e339
    Encoding settings : cabac=0 / ref=3 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=7 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=12 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=12 / rc=abr / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

    Video
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Baseline@L2.1
    Format settings, CABAC : No
    Format settings, ReFrames : 3 frames
    Format settings, GOP : M=1, N=12
    Duration : 2s 400ms
    Bit rate : 2 000 Kbps
    Width : 320 pixels
    Height : 240 pixels
    Display aspect ratio : 4:3
    Frame rate mode : Variable
    Frame rate : 20.833 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 1.250
    Stream size : 586 KiB
    Writing library : x264 core 148 r2665 a01e339
    Encoding settings : cabac=0 / ref=3 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=7 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=12 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=12 / rc=abr / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

    I noticed something odd in the above info :
    - The frame rate is 20.833 fps, instead of the specified 10 fps.
    - Duration of 2s 400ms did not seem right either, since the video played for more than 4s.

    Also, (AVFrame* picture)->pict_type is always set to AV_PICTURE_TYPE_NONE. I don’t think this is normal.

    The library that I’m using is ffmpeg-20160219-git-98a0053-win32-dev. I would really really appreciate if you could help me out of this confusion.

    /*
    * Video encoding example
    */
    char filename[] = "test.mp4";
    int main(int argc, char** argv)
    {
       AVCodec *codec = NULL;
       AVCodecContext *codecCtx= NULL;
       AVFormatContext *pFormatCtx = NULL;
       AVStream * pVideoStream = NULL;
       AVFrame *picture = NULL;

       int i, x, y,            //
           ret,                // Return value
           got_packet_ptr;     // Data encoded into packet

       printf("Video encoding\n");

       // Register all formats and codecs
       av_register_all();

       // allocate context
       pFormatCtx = avformat_alloc_context();
       memcpy(pFormatCtx->filename,filename,
           min(strlen(filename), sizeof(pFormatCtx->filename)));

       // guess format
       pFormatCtx->oformat = av_guess_format("h264", NULL, NULL);
       if (NULL==pFormatCtx->oformat)
       {
           cerr &lt;&lt; "Could not guess output format" &lt;&lt; endl;
           return -1;
       }  

       // Find the codec.
       codec = avcodec_find_encoder(pFormatCtx->oformat->video_codec);
       if (codec == NULL) {
           fprintf(stderr, "Codec not found\n");
           return -1;
       }

       // Set context
       int framerate = 10;
       codecCtx = avcodec_alloc_context3(codec);
       avcodec_get_context_defaults3(codecCtx, codec);
       codecCtx->pix_fmt = AV_PIX_FMT_YUV420P;
       codecCtx->profile = FF_PROFILE_H264_BASELINE;
       // Resolution must be a multiple of two.
       codecCtx->width  = 320;
       codecCtx->height = 240;

       codecCtx->bit_rate = 2000000;
       codecCtx->time_base.den = framerate;
       codecCtx->time_base.num = 1;
       codecCtx->gop_size = 12; // emit one intra frame every twelve frames at most

       // Open the codec.  
       if (avcodec_open2(codecCtx, codec, NULL) &lt; 0)
       {
           printf("Cannot open video codec\n");
           return -1;
       }

       // Add stream to pFormatCtx
       pVideoStream = avformat_new_stream(pFormatCtx, codec);
       if (!pVideoStream)
       {
           printf("Cannot add new video stream\n");
           return -1;
       }
       pVideoStream->codec = codecCtx;
       pVideoStream->time_base.den = framerate;
       pVideoStream->time_base.num = 1;

       if (avio_open2(&amp;pFormatCtx->pb, filename, AVIO_FLAG_WRITE, NULL, NULL) &lt; 0)
       {
           printf("Cannot open file\n");
           return -1;
       }

       // Write file header.
       avformat_write_header(pFormatCtx, NULL);

       // Create frame
       picture= av_frame_alloc();
       picture->format = codecCtx->pix_fmt;
       picture->width  = codecCtx->width;
       picture->height = codecCtx->height;

       int bufferImgSize = av_image_get_buffer_size(codecCtx->pix_fmt, codecCtx->width,
                       codecCtx->height,1);    
       av_image_alloc(picture->data, picture->linesize, codecCtx->width, codecCtx->height,                 codecCtx->pix_fmt, 32);

       AVPacket avpkt;

       /* encode 1 second of video */
       for(i=0;i&lt;50;i++)
       {
           /* prepare a dummy image */
           /* Y */
           for(y=0;yheight;y++)
           {
               for(x=0;xwidth;x++)
               {
                   picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
               }
           }
           /* Cb and Cr */
           for(y=0;yheight/2;y++)
           {
               for(x=0;xwidth/2;x++)
               {
                   picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
                   picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
               }
           }

           // Get timestamp
           picture->pts = (float) i * (1000.0/(float)(codecCtx->time_base.den)) * 90;

           // Encode frame to packet
           av_init_packet(&amp;avpkt);
           got_packet_ptr = 0;
           int error = avcodec_encode_video2(codecCtx, &amp;avpkt, picture, &amp;got_packet_ptr);
           if (!error &amp;&amp; got_packet_ptr > 0)
           {
               // Write packet with frame.
               ret = (av_interleaved_write_frame(pFormatCtx, &amp;avpkt) == 0);        
           }  
           av_packet_unref(&amp;avpkt);
       }

       // Flush remaining encoded data
       while(1)
       {
           av_init_packet(&amp;avpkt);
           got_packet_ptr = 0;
           // Encode frame to packet.
           int error = avcodec_encode_video2(codecCtx, &amp;avpkt, NULL, &amp;got_packet_ptr);
           if (!error &amp;&amp; got_packet_ptr > 0)
           {
               // Write packet with frame.
               ret = (av_interleaved_write_frame(pFormatCtx, &amp;avpkt) == 0);        
           }
           else
           {
               break;
           }
           av_packet_unref(&amp;avpkt);
       }
       av_write_trailer(pFormatCtx);

       av_packet_unref(&amp;avpkt);
       av_frame_free(&amp;picture);

       avcodec_close(codecCtx);
       av_free(codecCtx);

       cin.get();
    }