Recherche avancée

Médias (91)

Autres articles (41)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (7528)

  • Downloading youtube mp3 - metadata encoding issue (python, youtube-dl, ffmpeg)

    21 novembre 2018, par mopsiok

    I’m trying to download audio from youtube with youtube-dl.exe and ffmpeg.exe (Windows 7), but I am having some troubles with encoding. I have to parse metadata manually, because when I try to use

    --metadata-from-title "%(artist) - %(title)" --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=DaU94Ld3fuM

    I get ERROR : Could not interpret title of video as "%(artist) - %(title)"

    Anyway, I wrote some code to save metadata with ffmpeg :

    def download(url, title_first=False):
       if (0 == subprocess.call('youtube-dl --extract-audio --audio-format mp3 %s' % url)):
           #saves file in current directory in format: VID_TITLE-VID_ID.mp3
           video_id = url[url.find('=')+1:] #video id from URL (after ?v=)
           for f in os.listdir('.'):
               if video_id in f:
                   filename = f
                   break
           os.rename(filename, video_id+'.mp3') #name without non-ascii chars (for tests)
           video_title = filename[: filename.find(video_id)-1]

           output = video_title + '.mp3'
           title, artist = '', ''
           try: #parsing the title
               x = video_title.find('-')
               artist = video_title[:x].strip()
               title = video_title[x+1:].strip()
               if (title_first): output = '%s - %s.mp3' % (title, artist)
           except:
               pass

           x = 'ffmpeg -i "%s" -metadata title="%s" -metadata artist="%s" -acodec copy -id3v2_version 3 -write_id3v1 1 "%s"' \
                           % (video_id+'.mp3', title, artist, output)
           print x
           subprocess.call(x)

    The file is downloaded and then cropped to given start and duration times (the code above is a simplified version). Filename is fine, but when I open the file with AIMP3, it shows rubbish instead of non-ascii characters :

    enter image description here

    I’ve tried to re-encode the final command with iso-8859-2, utf-8 and mbcs :

    x = x.decode('cp1250').encode('iso-8859-2')

    But non-ascii chars are still not readable. Passing an unicode command returns UnicodeEncodeError...

    Any idea how to solve this problem ?

  • Python Youtube ffmpeg Session Has Been Invalidated

    14 août 2020, par Daniel

    I get the following error while I'm playing YouTube audio with my bot

    



    [tls @ 0000024ef8c4d480] Error in the pull function.
[matroska,webm @ 0000024ef8c4a400] Read error
[tls @ 0000024ef8c4d480] The specified session has been invalidated for some reason.
    Last message repeated 1 times


    



    It seems like YouTube links expire ? I don't really know but I need to fix this issue. This is my code :

    



        class YTDLSource(discord.PCMVolumeTransformer):

        def __init__(self, source, *, data, requester):
            super().__init__(source)
            self.requester = requester

            self.title = data['title']
            self.description = data['description']
            self.uploader = data['uploader']
            self.duration = data['duration']
            self.web_url = data['webpage_url']
            self.thumbnail = data['thumbnail']

        def __getitem__(self, item: str):
            return self.__getattribute__(item)

        @classmethod
        async def create_source(cls, ctx, player, search: str, *, loop, download=True):
            async with ctx.typing():
                loop = loop or asyncio.get_event_loop()
                to_run = partial(ytdl.extract_info, url=search, download=download)
                raw_data = await loop.run_in_executor(None, to_run)

                if 'entries' in raw_data:
                    # take first item from a playlist
                    if len(raw_data['entries']) == 1:
                        data = raw_data['entries'][0]
                    else:
                        data = raw_data['entries']
                        #loops entries to grab each video_url
                        total_duration = 0
                        try:
                            for i in data:
                                webpage = i['webpage_url']
                                title = i['title']
                                description = i['description']
                                uploader = i['uploader']
                                duration = i['duration']
                                thumbnail = i['thumbnail']
                                total_duration += duration

                                if download:
                                    source = ytdl.prepare_filename(i)
                                    source = cls(discord.FFmpegPCMAudio(source), data=i, requester=ctx.author)
                                else:
                                    source = {'webpage_url': webpage, 'requester': ctx.author, 'title': title, 'uploader': uploader, 'description': description, 'duration': duration, 'thumbnail': thumbnail}

                                player.queue.append(source)

                        except Exception as e:
                            print(e)
                            return

                        embed=discord.Embed(title="Playlist", description="Queued", color=0x30a4fb, timestamp=datetime.now(timezone.utc))
                        embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
                        embed.set_thumbnail(url=data[0]['thumbnail'])
                        embed.add_field(name=raw_data['title'], value=f"{len(data)} videos queued.", inline=True)
                        embed.set_footer(text=raw_data["uploader"] + ' - ' + '{0[0]}m {0[1]}s'.format(divmod(total_duration, 60)))
                        await ctx.send(embed=embed)
                        return

                embed=discord.Embed(title="Playlist", description="Queued", color=0x30a4fb, timestamp=datetime.now(timezone.utc))
                embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
                embed.set_thumbnail(url=data['thumbnail'])
                embed.add_field(name=data['title'], value=(data["description"][:72] + (data["description"][72:] and '...')), inline=True)
                embed.set_footer(text=data["uploader"] + ' - ' + '{0[0]}m {0[1]}s'.format(divmod(data["duration"], 60)))
                await ctx.send(embed=embed)

                if download:
                    source = ytdl.prepare_filename(data)
                else:
                    source = {'webpage_url': data['webpage_url'], 'requester': ctx.author, 'title': data['title'], 'uploader': data['uploader'], 'description': data['description'], 'duration': data['duration'], 'thumbnail': data['thumbnail']}
                    player.queue.append(source)
                    return

                source = cls(discord.FFmpegPCMAudio(source), data=data, requester=ctx.author)
                player.queue.append(source)


        @classmethod
        async def regather_stream(cls, data, *, loop):
            loop = loop or asyncio.get_event_loop()
            requester = data['requester']

            to_run = partial(ytdl.extract_info, url=data['webpage_url'], download=True)
            data = await loop.run_in_executor(None, to_run)

            return(cls(discord.FFmpegPCMAudio(data['url']), data=data, requester=requester))


    



    I'm using the rewrite branch of discord.py for the bot.
I'm not sure if I need to provide more details ? Please let me know, I really need to get this fixed...

    


  • Concatenate Movies from Python List using MoviePy or FFmpeg

    24 septembre 2020, par Python_Learner_DK

    I have about 10,000 short videos that I am trying to make several longer videos from.

    



    I've created these videos using MoviePy, but keep getting memory errors when trying to concatenate them back together.

    



    In my code I have an outer loop going through each letter of the alphabet and getting the files that start with that letter.

    



    From the returned video clips I get the length and and strip off the last 3.5 seconds (outro_clip_duration) of the video, and then add it into a Python list clips.

    



    Where I'm stuck is I then want to take this list of trimmed videos and make one long long video from it.

    



    I have all the files, I just need to trim them, concatenate them, and then export them as one.

    



    I've tried many times with different MoviePy attempts and keep getting MemoryErrors so I gave up and took a swing at an ffmpeg solution seen here but it is not working out either.

    



    The latest version of the main part of my code is here :

    



    clips = []
outro_clip = mpy.VideoFileClip('Logo_Intro_w_Stinger_Large.mp4')
outro_clip_duration = outro_clip.duration
for def_image in vid_list_long:
    video_item = mpy.VideoFileClip('F:/sm_My_Video/sm_%s.mp4' % def_image)
    video_item_duration = video_item.duration
    clips.append(ffmpeg_extract_subclip(video_item,0,(video_item_duration - outro_clip_duration), targetname = def_image))

# #Append the outro_clip to the end 
clips.append(mpy.VideoFileClip('Logo_Intro_w_Stinger_Large.mp4',target_resolution = (h,w),audio=True))
slided_clips = [CompositeVideoClip([clip.fx( transfx.crossfadein, transition_seconds)]) for clip in clips]
#added 'method = compose' NEED TO TEST - supposedly removes the weird glitches.
c = concatenate_videoclips(slided_clips, method = 'compose')
c.write_videofile('F:/Extended_Play/%s_Extended_Play_vid.mp4' % letter,fps=23.98)


    



    My PC is Windows 10 and I have 32 GB of RAM running Anaconda and Python 3.