Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (31)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • 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

  • 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 (...)

Sur d’autres sites (7332)

  • FFmpeg only reading one channel

    29 août 2017, par AbstractDissonance

    Trying to read a stereo wav file and ffmpeg is only reading one channel. ffprobe returns 2 channels.

    I have used -ac 2 and then added -channel_layout stereo but all return 1 channel(or basically filling half the buffer I created).

    Basically the output size of ffmpeg is about half the wav file size.

    What I would like is for it to return every channel in

    Channel1_sample1, channel2_sample1, ..., ChannelN_sample1, channel1_sample2, etc...

    But, in reality, I’d rather just have it work with stereo ;) I’m giving it plenty large enough buffer to read to, so that isn’t the problem either.

    Here is the output

    ffprobe.exe -hide_banner -v quiet -print_format flat -show_streams -i temp.wav
    streams.stream.0.index=0
    streams.stream.0.codec_name="pcm_s16le"
    streams.stream.0.codec_long_name="PCM signed 16-bit little-endian"
    streams.stream.0.profile="unknown"
    streams.stream.0.codec_type="audio"
    streams.stream.0.codec_time_base="1/44100"
    streams.stream.0.codec_tag_string="[1][0][0][0]"
    streams.stream.0.codec_tag="0x0001"
    streams.stream.0.sample_fmt="s16"
    streams.stream.0.sample_rate="44100"
    streams.stream.0.channels=2
    streams.stream.0.channel_layout="unknown"
    streams.stream.0.bits_per_sample=16
    streams.stream.0.id="N/A"
    streams.stream.0.r_frame_rate="0/0"
    streams.stream.0.avg_frame_rate="0/0"
    streams.stream.0.time_base="1/44100"
    streams.stream.0.start_pts="N/A"
    streams.stream.0.start_time="N/A"
    streams.stream.0.duration_ts=14200200
    streams.stream.0.duration="322.000000"
    streams.stream.0.bit_rate="1411200"
    streams.stream.0.max_bit_rate="N/A"
    streams.stream.0.bits_per_raw_sample="N/A"
    streams.stream.0.nb_frames="N/A"
    streams.stream.0.nb_read_frames="N/A"
    streams.stream.0.nb_read_packets="N/A"
    streams.stream.0.disposition.default=0
    streams.stream.0.disposition.dub=0
    streams.stream.0.disposition.original=0
    streams.stream.0.disposition.comment=0
    streams.stream.0.disposition.lyrics=0
    streams.stream.0.disposition.karaoke=0
    streams.stream.0.disposition.forced=0
    streams.stream.0.disposition.hearing_impaired=0
    streams.stream.0.disposition.visual_impaired=0
    streams.stream.0.disposition.clean_effects=0
    streams.stream.0.disposition.attached_pic=0
    streams.stream.0.disposition.timed_thumbnails=0
    ffmpeg.exe -i temp.wav -loglevel quiet -f s16le -ac 2 -channel_layout stereo -

    temp.wav is just a standard stereo wav file.

  • Discord bot leaving voice channel immediately after joining

    17 janvier 2018, par Forb

    I am building a bot for my discord server to play the audio YouTube videos as I haven’t found a reliable bot online.

    The bot connects to my voice channel after I type the !play url command but immediately leaves even if the URL is valid.

    My code is below :

    [Command("play", RunMode = RunMode.Async)]
    public async Task play(string url) {
       IVoiceChannel channel = (Context.User as IVoiceState).VoiceChannel;
       IAudioClient client = await channel.ConnectAsync();

       var output = CreateStream(url).StandardOutput.BaseStream;
       var stream = client.CreatePCMStream(AudioApplication.Music, 128 * 1024);
       output.CopyToAsync(stream);
       stream.FlushAsync().ConfigureAwait(false);
    }

    private Process CreateStream(string url) {
       Process currentsong = new Process();

       currentsong.StartInfo = new ProcessStartInfo {
           FileName = "cmd.exe",
           Arguments = $"/C youtube-dl -o - {url} | ffmpeg -i pipe:0 -ac 2 -f s16le -ar 48000 pipe:1",
           UseShellExecute = false,
           RedirectStandardOutput = true,
           CreateNoWindow = true
       };

       currentsong.Start();
       return currentsong;
    }

    I have tried using just ffmpeg with a file on my PC which was hard coded in, but I had the same result and the bot left the voice channel as soon as it connected.

    I did verify that both ffmpeg and youtube-dl were working by running the commands in a cmd window and they both ran fine.

  • Discord.py music_cog, bot joins channel but plays no sound

    20 juin 2021, par Ozzy

    I have started using python a week ago or so. I have watched all the related videos on YT and checked google pages etc. But still no luck. My bot perfectly joins to the voice channel and when i use play it downloads and presumebly starts the play function but there is no sound or anything, it just joins and waits 1-2 mins then leaves with timeout error.

    


    from discord.ext import commands
import logging

from youtube_dl import YoutubeDL

logging.basicConfig(level=logging.INFO)


class music_cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        # all the music related stuff
        self.is_playing = False

        # 2d array containing [song, channel]
        self.music_queue = []
        self.YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True', 'no_warnings': 'False'}
        self.FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
                               'options': '-vn'}

        self.vc = ""

    # searching the item on youtube
    def search_yt(self, item):
        with YoutubeDL(self.YDL_OPTIONS) as ydl:
            try:
                info = ydl.extract_info("ytsearch:%s" % item, download=False)['entries'][0]
            except Exception:
                return False

        return {'source': info['formats'][0]['url'], 'title': info['title']}

    def play_next(self):
        if len(self.music_queue) > 0:
            self.is_playing = True

            # get the first url
            m_url = self.music_queue[0][0]['source']

            # remove the first element as you are currently playing it
            self.music_queue.pop(0)

            self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
        else:
            self.is_playing = False

    # infinite loop checking
    async def play_music(self):
        if len(self.music_queue) > 0:
            self.is_playing = True

            m_url = self.music_queue[0][0]['source']

            # try to connect to voice channel if you are not already connected

            if self.vc == "" or not self.vc.is_connected() or self.vc == None:
                self.vc = await self.music_queue[0][1].channel.connect()
            else:
                await self.vc.move_to(self.music_queue[0][1])

            print(self.music_queue)
            # remove the first element as you are currently playing it
            self.music_queue.pop(0)

            self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
        else:
            self.is_playing = False

    @commands.command(name="play", help="Plays a selected song from youtube")
    async def p(self, ctx, *args):
        query = " ".join(args)

        voice_channel = ctx.author.voice
        if voice_channel is None:
            # you need to be connected so that the bot knows where to go
            await ctx.send("Connect to a voice channel!")
        else:
            song = self.search_yt(query)
            if type(song) == type(True):
                await ctx.send(
                    "Could not download the song. Incorrect format try another keyword. This could be due to playlist or a livestream format.")
            else:
                await ctx.send("Song added to the queue")
                self.music_queue.append([song, voice_channel])

                if self.is_playing == False:
                    await self.play_music()

    @commands.command(name="queue", help="Displays the current songs in queue")
    async def q(self, ctx):
        retval = ""
        for i in range(0, len(self.music_queue)):
            retval += self.music_queue[i][0]['title'] + "\n"

        print(retval)
        if retval != "":
            await ctx.send(retval)
        else:
            await ctx.send("No music in queue")

    @commands.command(name="skip", help="Skips the current song being played")
    async def skip(self, ctx):
        if self.vc != "" and self.vc:
            self.vc.stop()
            await ctx.send("Stopped!")
            # try to play next in the queue if it exists
            await self.play_music()
            await ctx.send("Skipped!")


def setup(bot):
    bot.add_cog(music_cog(bot))


    


    I enabled logs to be sure, when it connects there's just that info :

    


    INFO:discord.voice_client:Connecting to voice... | INFO:discord.voice_client:Starting voice handshake... (connection attempt 1)

    


    I have also checked FFMPEG and its Path, tried different codes and methods but even though they work there is no sound. Also I installed discord.py[voice] too.

    


    I appreciate help already, thanks.