Recherche avancée

Médias (1)

Mot : - Tags -/swfupload

Autres articles (105)

  • 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

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

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

  • Discord.py - IndexError : list index out of range

    23 novembre 2020, par itsnexn

    Hello i start to learn python and i make bot for practie but i got this error

    


    Ignoring exception in command play:
Traceback (most recent call last):
  File "C:\Users\sinad\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "d:\Projects\discord\musicbot.py", line 147, in play
    player = await YTDLSource.from_url(queue[0], loop=client.loop)
IndexError: list index out of range


    


    and i use ffmpeg to convert audio
and i write this bot in youtube and discord.py documentation
itswork well without music commend but if i use that i got error and isnt working idk why ...
this is my first python project so this is happening and its normal
and this is my code :

    


    import discord
from discord.ext import commands, tasks
from discord.voice_client import VoiceClient

import youtube_dl

from random import choice

from youtube_dl.utils import lowercase_escape

youtube_dl.utils.bug_reports_message = lambda: ''

ytdl_format_options = {
    'format': 'bestaudio/best',
    'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
    'restrictfilenames': True,
    'noplaylist': True,
    'nocheckcertificate': True,
    'ignoreerrors': False,
    'logtostderr': False,
    'quiet': True,
    'no_warnings': True,
    'default_search': 'auto',
    'source_address': '0.0.0.0' # bind to ipv4 since ipv6 addresses cause issues sometimes
}

ffmpeg_options = {
    'options': '-vn'
}

ytdl = youtube_dl.YoutubeDL(ytdl_format_options)

class YTDLSource(discord.PCMVolumeTransformer):
    def __init__(self, source, *, data, volume=0.5):
        super().__init__(source, volume)

        self.data = data

        self.title = data.get('title')
        self.url = data.get('url')

    @classmethod
    async def from_url(cls, url, *, loop=None, stream=False):
        loop = loop or asyncio.get_event_loop()
        data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))

        if 'entries' in data:
            # take first item from a playlist
            data = data['entries'][0]

        filename = data['url'] if stream else ytdl.prepare_filename(data)
        return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)


client = commands.Bot(command_prefix='.')

status = ['']
queue = []

#print on terminal when is bot ready
@client.event
async def on_ready():
    change_status.start()
    print('Bot is online!')

#Welcome message
@client.event
async def on_member_join(member):
    channel = discord.utils.get(member.guild.channels, name='general')
    await channel.send(f'Welcome {member.mention}!  Ready to jam out? See `.help` command for details!')

#ping
@client.command(name='ping', help='This command returns the latency')
async def ping(ctx):
    await ctx.send(f'**Ping!** Latency: {round(client.latency * 1000)}ms')

@client.event
async def on_message(message):

    if message.content in ['hello', 'Hello']:
        await message.channel.send("**wasaaaaaap**")

    await client.process_commands(message)


#join
@client.command(name='join', help='This command makes the bot join the voice channel')
async def join(ctx):
    if not ctx.message.author.voice:
        await ctx.send("You are not connected to a voice channel")
        return

    else:
        channel = ctx.message.author.voice.channel

    await channel.connect()

#queue
@client.command(name='queue', help='This command adds a song to the queue')
async def queue_(ctx, url):
    global queue

    queue.append(url)
    await ctx.send(f'`{url}` added to queue!')

#remove
@client.command(name='remove', help='This command removes an item from the list')
async def remove(ctx, number):
    global queue

    try:
        del(queue[int(number)])
        await ctx.send(f'Your queue is now `{queue}!`')

    except:
        await ctx.send('Your queue is either **empty** or the index is **out of range**')

#play
@client.command(name='play', help='This command plays songs')
async def play(ctx):
    global queue

    server = ctx.message.guild
    voice_channel = server.voice_client

    async with ctx.typing():
        player = await YTDLSource.from_url(queue[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(queue[0])

#pause
@client.command(name='pause', help='This command pauses the song')
async def pause(ctx):
    server = ctx.message.guild
    voice_channel = server.voice_client

    voice_channel.pause()

#resune
@client.command(name='resume', help='This command resumes the song!')
async def resume(ctx):
    server = ctx.message.guild
    voice_channel = server.voice_client

    voice_channel.resume()

#viow
@client.command(name='view', help='This command shows the queue')
async def view(ctx):
    await ctx.send(f'Your queue is now `{queue}!`')

#leave
@client.command(name='leave', help='This command stops makes the bot leave the voice channel')
async def leave(ctx):
    voice_client = ctx.message.guild.voice_client
    await voice_client.disconnect()

#stop
@client.command(name='stop', help='This command stops the song!')
async def stop(ctx):
    server = ctx.message.guild
    voice_channel = server.voice_client

    voice_channel.stop()

@tasks.loop(seconds=20)
async def change_status():
    await client.change_presence(activity=discord.Game(choice(status)))

client.run("my_secret")


    


  • process video stream from memory buffer

    9 août 2020, par Dan

    I need to parse a video stream (mpeg ts) from proprietary network protocol (which I already know how to do) and then I would like to use OpenCV to process the video stream into frames. I know how to use cv::VideoCapture from a file or from a standard URL, but I would like to setup OpenCV to read from a buffer(s) in memory where I can store the video stream data until it is needed. Is there a way to setup a call back method (or any other interfrace) so that I can still use the cv::VideoCapture object ? Is there a better way to accomplish processing the video with out writing it out to a file and then re-reading it. I would also entertain using FFMPEG directly if that is a better choice. I think I can convert AVFrames to Mat if needed.

    


  • Ffmpeg- Split video into 30 seconds parts in android

    22 novembre 2019, par Corgi Mogi

    I am working on a project. In which I want to split the video into 30 sec equal parts. If the video is 45 sec long than ideally in 30 and 15-sec parts. I already created a method which takes the starting and the ending point and run the Ffmpeg command to cut the video. This is what I created so far

      private void executeCutVideoCommand(int startMs, int endMs) {
           File moviesDir = Environment.getExternalStoragePublicDirectory(
                   Environment.DIRECTORY_MOVIES
           );

           String filePrefix = "cut_video";
           String fileExtn = ".mp4";
           String yourRealPath = getPath(VideoCutterActivity.this, selectedVideoUri);
           File dest = new File(moviesDir, filePrefix + fileExtn);
           int fileNo = 0;
           while (dest.exists()) {
               fileNo++;
               dest = new File(moviesDir, filePrefix + fileNo + fileExtn);
           }

           filePath = dest.getAbsolutePath();
           String[] complexCommand = {"-ss", "" + startMs / 1000, "-y", "-i", yourRealPath, "-t", "" + (endMs - startMs) / 1000,"-vcodec", "mpeg4", "-b:v", "2097152", "-b:a", "48000", "-ac", "2", "-ar", "22050", filePath};

           execFFmpegBinary(complexCommand);
           MediaScannerConnection.scanFile(VideoCutterActivity.this,
                   new String[] { filePath },
                   null,
                   new MediaScannerConnection.OnScanCompletedListener() {

                       public void onScanCompleted(String path, Uri uri) {

                           Log.i("ExternalStorage", "Scanned " + path + ":");
                           Log.i("ExternalStorage", "-> uri=" + uri);
                       }
                   });


       }

       /**
        * Executing ffmpeg binary
        */
       private void execFFmpegBinary(final String[] command) {
           try {
               ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
                   @Override
                   public void onFailure(String s) {
                       Log.d(TAG, "FAILED with output : " + s);
                   }

                   @Override
                   public void onSuccess(String s) {
                       Log.d(TAG, "SUCCESS with output : " + s);
                           Intent intent = new Intent(VideoCutterActivity.this, PreviewActivity.class);
                           intent.putExtra(FILEPATH, filePath);
                           startActivity(intent);
                   }

                   @Override
                   public void onProgress(String s) {
                       progressDialog.setMessage("progress : " + s);
                   }

                   @Override
                   public void onStart() {
                       progressDialog.setMessage("Processing...");
                       progressDialog.show();
                   }

                   @Override
                   public void onFinish() {
                       progressDialog.dismiss();


                   }
               });
           } catch (FFmpegCommandAlreadyRunningException e) {
               // do nothing for now
           }
       }

    i tried to add a loop in method Calling But than app crashes

       cutVideo.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View v) {

                   choice = 2;

                   if (selectedVideoUri != null) {
                       int start,end;
                       for (int i=0;i<=duration;i=i+30){
                           start=i;
                           end=start+30;
                           executeCutVideoCommand(start,end);

                       }
    //                    executeCutVideoCommand(rangeSeekBar.getSelectedMinValue().intValue() * 1000, rangeSeekBar.getSelectedMaxValue().intValue() * 1000);

                   } else
                       Snackbar.make(mainlayout, "Please upload a video", 4000).show();
               }
           });


       }

    I hope now you can what i want to do. I want to Ffmpeg command or method which split the video into 30-sec parts and place them on the given filepath. Let me know if we you wanna know more about the code. Help is much appreciated