Recherche avancée

Médias (91)

Autres articles (82)

  • Emballe Médias : Mettre en ligne simplement des documents

    29 octobre 2010, par

    Le plugin emballe médias a été développé principalement pour la distribution mediaSPIP mais est également utilisé dans d’autres projets proches comme géodiversité par exemple. Plugins nécessaires et compatibles
    Pour fonctionner ce plugin nécessite que d’autres plugins soient installés : CFG Saisies SPIP Bonux Diogène swfupload jqueryui
    D’autres plugins peuvent être utilisés en complément afin d’améliorer ses capacités : Ancres douces Légendes photo_infos spipmotion (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

Sur d’autres sites (4622)

  • TypeError : must be real number, not NoneType using spyder anaconda

    13 août 2023, par faisal2k
    import moviepy.editor as mp
import tkinter as tk
from tkinter import filedialog
import math
from PIL import Image
import numpy


def zoom_in_effect(clip, zoom_ratio=0.02):
    def effect(get_frame, t):
        img = Image.fromarray(get_frame(t))
        base_size = img.size

        new_size = [
            math.ceil(img.size[0] * (1 + (zoom_ratio * t))),
            math.ceil(img.size[1] * (1 + (zoom_ratio * t)))
        ]

        # The new dimensions must be even.
        new_size[0] = new_size[0] + (new_size[0] % 2)
        new_size[1] = new_size[1] + (new_size[1] % 2)

        img = img.resize(new_size, Image.LANCZOS)

        x = math.ceil((new_size[0] - base_size[0]) / 2)
        y = math.ceil((new_size[1] - base_size[1]) / 2)

        img = img.crop([
            x, y, new_size[0] - x, new_size[1] - y
        ]).resize(base_size, Image.LANCZOS)

        #result = numpy.array(img)
        result = numpy.array(img, dtype=numpy.uint8)

        img.close()

        return result

    return clip.fl(effect)


    

def make_center_video():
    
    size = (1080, 1080)

    audio_file = '/home/faisal/pythonfiles/audio/tts_voice.wav'
    audio = mp.AudioFileClip(audio_file)
   
    root = tk.Tk()
    root.withdraw()
     
    print("waiting for Image Selection....")

    img = filedialog.askopenfilename()


    slide = mp.ImageClip(img).set_fps(29).set_duration(audio.duration).resize(size)
    slide = zoom_in_effect(slide, 0.02)
    slide.write_videofile('/home/faisal/pythonfiles/videos/zoom-short.mp4',codec='libx264',  fps=29)
    
    
    size = (600, 600)

 


    slide = mp.ImageClip(img).set_fps(29).set_duration(audio.duration).resize(size)
    slide = zoom_in_effect(slide, 0.02)
    slide.write_videofile('/home/faisal/pythonfiles/videos/zoom-wide.mp4',codec='libx264', fps=29)
    
import traceback

try:
    make_center_video()
except Exception as e:
    traceback.print_exc()
    print(f"An error occurred: {e}")


    


    I'm trying to make the zoom video using image but facing

    


    TypeError: must be real number, not NoneType.


    


    It used was to run but I don't remember if I might have updated numpy, ffmpeg, or any thing else that is now causing the error. I have tried the code on python 3.10 and 3.11 and get the same error in both. I was previously running it on python 3.10.

    


    An error occurred: must be real number, not NoneType&#xA;Traceback (most recent call last):&#xA;  File "/home/faisal/pythonfiles/code/zoom_video.py", line 76, in <module>&#xA;    make_center_video()&#xA;  File "/home/faisal/pythonfiles/code/zoom_video.py", line 61, in make_center_video&#xA;    slide.write_videofile(&#x27;/home/faisal/pythonfiles/videos/zoom-short.mp4&#x27;,codec=&#x27;libx264&#x27;,  fps=29)&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/decorator.py", line 232, in fun&#xA;    return caller(func, *(extras &#x2B; args), **kw)&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/moviepy/decorators.py", line 54, in requires_duration&#xA;    return f(clip, *a, **k)&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/decorator.py", line 232, in fun&#xA;    return caller(func, *(extras &#x2B; args), **kw)&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/moviepy/decorators.py", line 135, in use_clip_fps_by_default&#xA;    return f(clip, *new_a, **new_kw)&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/decorator.py", line 232, in fun&#xA;    return caller(func, *(extras &#x2B; args), **kw)&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB&#xA;    return f(clip, *a, **k)&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 300, in write_videofile&#xA;    ffmpeg_write_video(self, filename, fps, codec,&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_writer.py", line 213, in ffmpeg_write_video&#xA;    with FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,&#xA;  File "/home/faisal/anaconda3/envs/py-310/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_writer.py", line 88, in __init__&#xA;    &#x27;-r&#x27;, &#x27;%.02f&#x27; % fps,&#xA;TypeError: must be real number, not NoneType&#xA;</module>

    &#xA;

  • get metadata and download mp4 video link to server with ffmpeg

    17 mars 2019, par user892134

    I have the following directory in server /home/example.com/videos

    I want to download this video http://example.com/videos/video.mp4 into the directory.

    First how do i get metadata of http://example2.com/videos/video.mp4 ?

    Here is my command to download video, is it correct ?

    ffmpeg -i "http://example2.com/videos/video.mp4" -c copy "/home/example.com/videos/video2.mp4"

    Lastly, how do i determine if video has downloaded or didn’t finish downloading successfully ?

  • Using ffmpeg with MAMP local server

    22 mai 2012, par dirk_22

    In my MAMP local server home folder on Mac OS X (htdocs), I have a bunch of images (labeled image0 through image(n)) which I would like to stitch together into a jpeg using ffmpeg. When I type the following command into terminal, a .mpg file is successfully generated.

    ffmpeg -f image2 -i image%d.jpg videofile.mpg

    However, when I try to execute the same command using the php code pasted below, nothing seems to happen.

    &lt;?php
    shell_exec(&#39;ffmpeg -f image2 -i image%d.jpg videofile.mpg&#39;);
    ?>

    I've copied the installed ffmpeg folder on my home directory into htdocs, but ffmpeg doesn't seem to be accessed. I'm very new to PHP, so please feel free to point out any gross errors in my code. I'd just like the php script to accomplish the same task which terminal executes upon input of the aforementioned command. I'd welcome any and all advice. Cheers.