Recherche avancée

Médias (91)

Autres articles (100)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, 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 (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (12885)

  • Editing Video in Channel Changes Aspect Ratio to Square

    11 octobre 2024, par Shayki Abramczyk

    I'm working on a Telegram bot that processes videos by adding a watermark and then edits the original message to replace the video in a channel post. The issue I'm encountering is that when I edit the message with the new video, the aspect ratio changes, and the video becomes a square, even though the original video is in vertical format.

    


    Here’s a simplified version of the code I’m using to edit the message with the processed video :

    


    video_file = await video.get_file()
print(video_file)
random = randint(0,9999)
input_path = f"input_{user_id}_{random}.mp4"
output_path = f"output_{user_id}_{random}.mp4"
await video_file.download_to_drive(input_path)

loop = asyncio.get_event_loop()
executor = ThreadPoolExecutor()
await loop.run_in_executor(executor, process_video_sync, input_path, output_path, watermark_path, settings)

try:
    if return_file:
        return open(output_path, 'rb')
    if channel:
        chat_id = post.chat_id
        message_id = post.message_id
        caption = post.caption if post.caption else ""
        if settings['has_signature']:
            signature = settings['signature']
        else:
            caption = post.caption_html if post.caption_html else (post.caption or "")
        video_clip = VideoFileClip(output_path)
        await context.bot.edit_message_media(
            chat_id=chat_id,
            message_id=message_id,
            media=InputMediaVideo(media=open(output_path, 'rb'), width=video_clip.w, height=video_clip.h, caption=caption, parse_mode="HTML")
        )
    elif update.message:
        caption = update.message.caption if update.message.caption else ""
        video_clip = VideoFileClip(output_path)
        
        with open(output_path, 'rb') as video_file:
            await update.message.reply_video(
                video=InputFile(video_file),
                caption=caption,
                width=video_clip.w,
                height=video_clip.h,
                supports_streaming=True
            )
except Exception as e:
    logger.error("Error in sending video. Exception Type:", e.args[0][0], "Message:", e.args[0][1])
finally:
    os.remove(input_path)
    os.remove(output_path)


    


    When editing the message in a channel, the video’s aspect ratio changes from vertical to square (if the video is horizonal it's ok). However, if I send the video as a new message, the aspect ratio remains correct.

    


    How can I ensure that when I edit the video in the channel, the aspect ratio stays the same as the original, and doesn’t get cropped or turned into a square ?

    


  • Révision 21860 : Le Dari (http://fr.wikipedia.org/wiki/Dari) est aussi une langue rtl

    10 décembre 2014, par kent1 -
  • Révision 21337 : Ne pas confondre le Kazakh (kk - http://fr.wikipedia.org/wiki/Kazakh) et le Konk...

    5 mai 2014, par kent1 -