Recherche avancée

Médias (0)

Mot : - Tags -/formulaire

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (97)

  • Les images

    15 mai 2013
  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

Sur d’autres sites (5739)

  • Editing Caption in Video Message Changes Aspect Ratio to Square

    12 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 ?

    


    EDIT :

    


    I found it's because I editing the video caption and added there some HTML elements which cause it.

    


    If I just add a simple text it's ok.

    


    Why ?

    


  • ffmpeg inconsistent speed results by version breaking large audio file into multiple pieces with -ss/-to positional parameters [closed]

    2 novembre 2024, par BenH

    I am trying to chop a large (12 hour+) audio file up into multiple segments using multiple -ss/-to positional operations.

    


    ffmpeg.exe -loglevel error -stats -i "C:\data\chapters\joined_output.mp3" -ss -1 -to 1159 -c copy "C:\data\chapters\001 - Chapter 1.mp3" -ss 1159 -to 1800 -c copy "C:\data\chapters\002 - Chapter 2.mp3" -ss 1800 -to 3181 -c copy "C:\data\chapters\003 - Chapter 3.mp3" ... output.mp3


    


    The '...' indicates that I have more than 20 of such repeated statements to break up into 20 or more chapter files.

    


    I arrived on this because using individual command were processing the entire file each time to parse out the section I wanted. I realize there is an option to place -ss/-to prior to the input file, and have since discovered that this appears to work quicker, but I have not found syntax to use this in a single command and therefore must create a separate command for each chapter.

    


    The above syntax appears to work fine, but was taking about 4 minutes to process. When I reverted to older versions this operation completes much quicker. About 20 seconds with version 6.1 and about 10 seconds on version 5.

    


    There is some discrepancy with how the old versions report the length of the file (it appears to show only about 6.5 hours processed in "out_time" value), but the resulting output files appear to be correct. I think it might be reporting out_time of only the longest section it is processing as the 6.5 hours appear to match the length of that output section.

    


    To be clear, version 5 using my above syntax appears to create all my output files correctly in 10 seconds.

    


    If I split them up into individual commands with -ss/-to before the input, then it actually takes longer with ffmpeg version 5/6 (about 45 seconds compared to 10-20 seconds).
With the latest version 7 it takes about 1 min, 15 secs. Much better than the 4 minutes using my syntax above but still well slower than using version 5/6 with that same syntax.

    


    So, in short, why am I able to (apparently) properly split this 12 hour file into about 25 different segments in about 10 seconds using the syntax above on version 5, but it takes 2x that long on 6, and 30x that long on 7 ? I assume there are just syntax changes I can't figure out or some changes to default behavior ?

    


  • avcodec/ffv1 : Allocate unit only when needed and only as large as needed

    2 avril, par Michael Niedermayer
    avcodec/ffv1 : Allocate unit only when needed and only as large as needed
    

    That is instead of a fixed 65536, we now allocate only as many as there
    are pixels.
    We also allocate only for the encoder and only when remapping is enabled
    and only for 32bit per sample

    This should reduce memory consumption, the 2nd array will be
    dealt with in a future commit

    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] libavcodec/ffv1.h
    • [DH] libavcodec/ffv1enc.c