Recherche avancée

Médias (1)

Mot : - Tags -/getid3

Autres articles (80)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (4989)

  • How to save animations with tight layout, transparency and in high quality with matplotlib ?

    29 novembre 2019, par mapf

    I am trying to implement an option in my GUI to save an image sequence displayed using matplotlib. The code looks something like this :

    import matplotlib.pyplot as plt
    from matplotlib.backends.backend_qt5agg import \
       FigureCanvasQTAgg as FigureCanvas
    from matplotlib.animation import FuncAnimation
    from PIL import Image


    plt.rcParams['savefig.bbox'] = 'tight'


    class Printer:
       def __init__(self, data):
           self.fig, self.ax = plt.subplots()
           self.canvas = FigureCanvas(self.fig)

           # some irrelevant color adjustment here
           #self.ax.spines['bottom'].set_color('#f9f2d7')
           #self.ax.spines['top'].set_color('#f9f2d7')
           #self.ax.spines['right'].set_color('#f9f2d7')
           #self.ax.spines['left'].set_color('#f9f2d7')
           #self.ax.tick_params(axis='both', colors='#f9f2d7')
           #self.ax.yaxis.label.set_color('#f9f2d7')
           #self.ax.xaxis.label.set_color('#f9f2d7')
           #self.fig.subplots_adjust(left=0.1, right=0.975, bottom=0.09, top=0.98)
           self.fig.patch.set_alpha(0)
           self.fig.patch.set_visible(False)
           self.canvas.setStyleSheet("background-color:transparent;")
           self.fig.set_size_inches(10, 10, True)
           self.fig.tight_layout()

           self.data = data
           self.image_artist = self.ax.imshow(data[0])

       def animate(self, i):
           self.image_artist.set_data(self.data[i])
           self.canvas.draw()


    def save_animation():
       data = [
           Image.open("test000.png"),
           Image.open("test001.png"),
       ]
       file = 'test.gif'
       printer = Printer(data)

       ani = FuncAnimation(
           printer.fig, printer.animate, interval=100, frames=len(data),
       )
       # writer = animation.writers['pillow'](bitrate=1000)
       ani.save(
           file, writer='pillow', savefig_kwargs={'transparent': True, 'bbox_inches': 'tight'}
       )


    save_animation()

    Transparency :

    As you can see I have already tried several different approaches as suggested elsewhere (1, 2), but didn’t manage to find a solution. All of the settings and arguments patch.set_alpha(0), patch.set_visible(False), canvas.setStyleSheet("background-color:transparent;"), savefig_kwargs={'transparent': True} seem to have no effect at all on the transparency. I found this post but I didn’t get the code to work (for one I had to comment out this %matplotlib inline, but then I ended up getting some error during the MovieWriter.cleanup out = TextIOWrapper(BytesIO(out)).read() TypeError: a bytes-like object is required, not 'str'). Here, it was suggested that this is actually a bug, but the proposed workaroud doesn’t work for me since I would have to rely on third-party software. There also exists this bug report which was supposedly solved, so maybe it is unrelated.

    Tight layout

    I actually couldn’t really find much on this, but all the things I tried (plt.rcParams['savefig.bbox'] = 'tight', fig.tight_layout(), savefig_kwargs={'bbox_inches': 'tight'}) don’t have any effect or are even actively discarded in the case of the bbox_inches argument. How does this work ?

    High quality

    Since I cannot use ImageMagick and can’t get ffmpeg to work (more on this below), I rely on pillow to save my animation. But the only argument in terms of quality that I can pass on seems to be the bitrate, which doesn’t have any effect. The files still have the same size and the animation still looks like mush. The only way that I found to increase the resolution was to use fig.set_size_inches(10, 10, True), but this still doesn’t improve the overall quality of the animation. It still looks bad. I saw that you can pass on codec and extra_args so maybe that is something that might help, but I have no idea how to use these because I couldn’t find a list with allowed arguments.

    ffmpeg

    I can’t get ffmpeg to work. I installed the python package from here and can import it into a python session but I don’t know how I can get matplotlib to use that. I also got ffmpeg from here (Windows 64-bit version) and set the plt.rcParams['animation.ffmpeg_path'] to where I saved the files (there was no intaller to run, not sure if I did it correctly). But this didn’t help either. Also this is of course also third-party software, so if somebody else were to use my code/program it wouldn’t work.

  • avfilter/scale.c : factorize ff_scale_eval_dimensions

    2 décembre 2019, par Gyan Doshi
    avfilter/scale.c : factorize ff_scale_eval_dimensions
    

    Adjustment of evaluated values shifted to ff_adjust_scale_dimensions
    Shifted code for force_original_aspect_ratio and force_divisble_by from
    vf_scale so it is now available for scale_cuda, scale_npp and
    scale_vaapi as well.

    • [DH] doc/filters.texi
    • [DH] libavfilter/scale.c
    • [DH] libavfilter/scale.h
    • [DH] libavfilter/vf_scale.c
    • [DH] libavfilter/vf_scale_cuda.c
    • [DH] libavfilter/vf_scale_npp.c
    • [DH] libavfilter/vf_scale_vaapi.c
  • ffmpeg : move A/V non-streamcopy initialization to a later point

    10 septembre 2020, par Jan Ekström
    ffmpeg : move A/V non-streamcopy initialization to a later point
    

    - For video, this means a single initialization point in do_video_out.
    - For audio we unfortunately need to do it in two places just
    before the buffer sink is utilized (if av_buffersink_get_samples
    would still work according to its specification after a call to
    avfilter_graph_request_oldest was made, we could at least remove
    the one in transcode_step).

    Other adjustments to make things work :
    - As the AVFrame PTS adjustment to encoder time base needs the encoder
    to be initialized, so it is now moved to do_video,audio_out,
    right after the encoder has been initialized. Due to this,
    the additional parameter in do_video_out is removed as it is no
    longer necessary.

    • [DH] fftools/ffmpeg.c