Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (71)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

Sur d’autres sites (8553)

  • MoviePy error : failed to read the first frame of video file... That may also mean that you are using a deprecated version of FFMPEG

    30 août 2023, par Alister Kwapisz

    When I run a python telegram bot script locally, it works completely fine but when I run the script on PythonAnywhere I get an error that shows up when I try to generate a video :

    


    "2023-08-29 15:21:53,138 (__init__.py:960 MainThread) ERROR - TeleBot: "Infinity polling exception: MoviePy error: failed to read the first frame of video file /home/AlisterK/video_clips/Video 2023-01-10 &#xA;18 45 07.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Pleas&#xA;e update to a recent version from the website."&#xA;2023-08-29 15:21:53,138 (__init__.py:962 MainThread) ERROR - TeleBot: "Exception traceback:&#xA;Traceback (most recent call last):&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 955, in infinity_polling&#xA;    self.polling(non_stop=True, timeout=timeout, long_polling_timeout=long_polling_timeout,&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1043, in polling&#xA;    self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout,&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1118, in __threaded_polling&#xA;    raise e&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 1074, in __threaded_polling&#xA;    self.worker_pool.raise_exceptions()&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/util.py", line 147, in raise_exceptions&#xA;    raise self.exception_info&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/util.py", line 90, in run&#xA;    task(*args, **kwargs)&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/telebot/__init__.py", line 6788, in _run_middlewares_and_handler&#xA;    result = handler[&#x27;function&#x27;](message)&#xA;  File "/home/AlisterK/Video generator.py", line 34, in generate_video_command&#xA;    generated_video = generate_video(audio_files[user_id])&#xA;  File "/home/AlisterK/Video generator.py", line 72, in generate_video&#xA;    clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]&#xA;  File "/home/AlisterK/Video generator.py", line 72, in <listcomp>&#xA;    clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__&#xA;    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 73, in __init__&#xA;    self.lastread = self.read_frame()&#xA;  File "/home/AlisterK/.local/lib/python3.10/site-packages/moviepy/video/io/ffmpeg_reader.py", line 133, in read_frame&#xA;    raise IOError(("MoviePy error: failed to read the first frame of "&#xA;OSError: MoviePy error: failed to read the first frame of video file /home/AlisterK/video_clips/Video 2023-01-10 18 45 07.mp4. That might mean that the file is corrupted. That may also mean that you are using a deprecated version of FFMPEG. On Ubuntu/Debian for instance the version in the repos is deprecated. Please update to a recent version from the website."&#xA;</listcomp>

    &#xA;

    I tried updating ffmpeg and moviepy. I even tried different versions but to no avail. The video clips are not corrupted as I checked.

    &#xA;

    This part of the code is responsible for generating the videos :

    &#xA;

    def generate_video(audio_path):&#xA;    input_folder = &#x27;/home/AlisterK/video_clips&#x27;  # Replace with your folder path&#xA;    output_file = &#x27;/home/AlisterK/output_combined_video.mp4&#x27;&#xA;    clip_duration = 3  # Duration of each clip in seconds&#xA;    num_clips = 10     # Number of video clips to select and combine&#xA;&#xA;    width = 1080  # Replace with your desired width&#xA;    height = 1920  # Replace with your desired height&#xA;&#xA;    video_clips = random_files_in_folder(input_folder, &#x27;.mp4&#x27;, num_clips)&#xA;&#xA;    clips = [VideoFileClip(os.path.join(input_folder, clip_file)).subclip(0, clip_duration) for clip_file in video_clips]&#xA;    standardized_clips = [clip.resize((width, height)) for clip in clips]  # Ensure consistent resolutions&#xA;&#xA;    final_clip = concatenate_videoclips(standardized_clips)&#xA;&#xA;    final_audio = AudioFileClip(audio_path)&#xA;

    &#xA;

  • Anomalie #4495 (Nouveau) : migration 3.2.7 vers 3.3.0

    24 mai 2020, par josiane aletto

    test 1-
    j’ai installée en local un site qui était en SPIP 3.2.7 [24473] pour le migrer en SPIP 3.3.0-dev [24578].
    fichier mesoptions.php avec

    1. <span class="CodeRay"><span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_IMG_MAX_HEIGHT</span><span class="delimiter">'</span></span>,<span class="integer">1200</span>); <span class="comment">// largeur en pixels</span>
    2. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_IMG_MAX_WIDTH</span><span class="delimiter">'</span></span>, <span class="integer">1024</span>);  <span class="comment">// hauteur en pixels</span>
    3. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_IMG_MAX_SIZE</span><span class="delimiter">'</span></span>,  <span class="integer">650</span>);   <span class="comment">// taille en kilo-octets</span>
    4. </span>

    Télécharger


    Des logos de taille superieure a _IMG_MAX_SIZE’, 650 ne sont plus dans IMG Pas non plus dans logo_erreur non plus.
    par exemple rubon3 : 1630 × 648 pixels
    Plugins :
    Adaptive Images 1.9.2 -
    Agenda 3.26.0 -
    API de vérification 1.8.1 - stable
    Centre image 0.10.4 - dev
    Couleur de rubrique 2.3.8
    Facteur 3.6.2 - stable
    Formidable 3.34.3 - stable
    Insérer Modèles 1.3.3 - stable
    Massicot 0.8.1 -
    Mini Calendrier 2.4.1 - stable
    oEmbed 2.0.10 - stable
    Owl Carousel 1.0.18
    Carousel responsive avec support du multi-touch.
    Palette 4.0.7
    pdf.js 0.6.3
    Picto mod avec FontAwesome 2.1.0
    Saisies pour formulaires 3.11.1
    SPIP Bonux 3.4.6
    YAML 2.0.10
    test2
    Pour mieux voir J’ai recommencé installation /migration en désinstallant le plugin massicot et en le supprimant du repertoire plugin et en mettant dans mes_options.php
    define(’_IMG_MAX_HEIGHT’,800) ; // largeur en pixels
    define(’_IMG_MAX_WIDTH’, 500) ; // hauteur en pixels
    define(’_IMG_MAX_SIZE’, 400) ; // taille en kilo-octets

    je constate ; que les logos de taille >400Ko sont présent mais retaillé, rubon3 qui avait 1630 × 648 pixels a maintenant à 500 × 199 pixels 221 ko dans logo/IMG alors qu’il n’ y a pas massicot.
    si je supprime ce rubon3 par logo de la rubrique et télécharge l’image originale j’obtiens une image retaillé avec du noir en plus. mais si je clique dessus l’image est retaillée mais ok et elle est bien en 500*199 dans IMG sans le noir.

    • les images migrées ont bien gardées leurs dimensions*.

    test3
    je telecharge le logo rubon3 de 1630 × 648 pixels comme un document d’un article —> il est enregistré directement en 500 × 199 pixels 221 ko . Ce mécanisme a changé, en mieux, car dans la version 3.2 j’avais un message "Les images doivent obligatoirement faire moins de 650 ko (ce fichier fait 847.5 ko)".

  • Using libavcodec to read .mkv video file

    10 mars 2020, par Slav

    Trying to read .mkv file and write it to .bmp, but resulting .bmp is black-and-white and consists of multiple mini-images of what supposed to be written :

    int main()
    {
       av_register_all();
       avformat_network_init();
       avfilter_register_all();

       //crashes on -Ofast without =NULL initialization:
       AVFormatContext * format = NULL;
       if ( avformat_open_input( &amp; format, VIDEO_FILE, NULL, NULL ) != 0 ) {
           cerr &lt;&lt; "Could not open file " &lt;&lt; VIDEO_FILE &lt;&lt; endl;
           return -1;
       }

       // Retrieve stream information
       if ( avformat_find_stream_info( format, NULL ) &lt; 0) {
           cerr &lt;&lt; "avformat_find_stream_info() failed." &lt;&lt; endl;
           return -1;
       }
       av_dump_format( format, 0, VIDEO_FILE, false );

       AVCodec * video_dec = (AVCodec*)1;
       AVCodec * audio_dec = (AVCodec*)1;
       const auto video_stream_index = av_find_best_stream( format, AVMEDIA_TYPE_VIDEO, -1, -1, &amp; video_dec, 0 );
       const auto audio_stream_index = av_find_best_stream( format, AVMEDIA_TYPE_AUDIO, -1, -1, &amp; audio_dec, 0 );
       if ( video_stream_index &lt; 0 ) {
           cerr &lt;&lt; "Failed to find video stream." &lt;&lt; endl;
           return -1;
       }
       if ( audio_stream_index &lt; 0 ) {
           cerr &lt;&lt; "Failed to find audio stream." &lt;&lt; endl;
           return -1;
       }

       AVCodecParameters * videoParams = format->streams[ video_stream_index ]->codecpar;
       cout &lt;&lt; "Having " &lt;&lt; videoParams->width &lt;&lt; " | " &lt;&lt; videoParams->height &lt;&lt; " video." &lt;&lt; endl;

       av_read_play( format );

       // create decoding context
       AVCodecContext * video_ctx = avcodec_alloc_context3( video_dec );
       AVCodecContext * audio_ctx = avcodec_alloc_context3( audio_dec );
       if ( ! video_ctx || ! audio_ctx ) {
           cerr &lt;&lt; "Failed to avcodec_alloc_context3()" &lt;&lt; endl;
           return -1;
       }
       if ( video_dec->capabilities &amp; AV_CODEC_CAP_TRUNCATED ) video_ctx->flags |= AV_CODEC_FLAG_TRUNCATED; // we do not send complete frames

       /* For some codecs, such as msmpeg4 and mpeg4, width and height
          MUST be initialized there because this information is not
          available in the bitstream. */

       avcodec_parameters_to_context( video_ctx, format->streams[ video_stream_index ]->codecpar );
       avcodec_parameters_to_context( audio_ctx, format->streams[ audio_stream_index ]->codecpar );
       if ( avcodec_open2( video_ctx, video_dec, NULL ) &lt; 0 ) {
           cout &lt;&lt; "Failed to open video decoder." &lt;&lt; endl;
           return -1;
       }
       if ( avcodec_open2( audio_ctx, audio_dec, NULL ) &lt; 0 ) {
           cout &lt;&lt; "Failed to open audio decoder." &lt;&lt; endl;
           return -1;
       }

       uint8_t* picture_buffer = (uint8_t*) (av_malloc( avpicture_get_size( AV_PIX_FMT_RGB24 , videoParams->width, videoParams->height ) ));
       AVFrame* picture = av_frame_alloc();
       avpicture_fill( (AVPicture *) picture, picture_buffer, AV_PIX_FMT_RGB24, video_ctx->width, video_ctx->height );

       AVPacket packet;
       av_init_packet( &amp; packet );

       int cnt = 0;
       while ( av_read_frame( format, &amp; packet ) >= 0 &amp;&amp; cnt &lt; 10 ) {
           if ( packet.stream_index == video_stream_index ) {
               int check;
               const auto result = avcodec_decode_video2( video_ctx, picture, &amp; check, &amp; packet );
               cout &lt;&lt; "Bytes decoded " &lt;&lt; result &lt;&lt; " check " &lt;&lt; check &lt;&lt; endl;

               std::string name = "debug/av/";
               name += std::to_string( cnt ) + ".bmp";
               cout &lt;&lt; "Writing frame " &lt;&lt; name &lt;&lt; " with linesize " &lt;&lt; picture->linesize[0] &lt;&lt; " ..." &lt;&lt; endl;
               write_bmp( (uint8_t*) picture->data, videoParams->width, videoParams->height, name.c_str() );

               av_frame_unref( picture );

               ++ cnt;
           }
           else if ( packet.stream_index == audio_stream_index ) {
               cout &lt;&lt; "Sound packet" &lt;&lt; endl;
           }
           av_free_packet( &amp; packet );
           av_init_packet( &amp; packet );
       }
    }

    How can I fix it ?