1

When "pyrogram" is used to upload videos in batches, the video frames will stretch and the video duration will not be displaye

Because there are many videos and different screen sizes, the specific width and height cannot be set

def main(video_file,fname):
    def progress(current, total):
        print(f"{current * 100 / total:.1f}%")
 
    app.start()
    app.send_video('chat_id',video_file, progress=progress,caption=fname,parse_mode=enums.ParseMode.MARKDOWN)
    time.sleep(1) 
    with open(video_file, 'w',encoding='utf-8') as f:
        f.write('')
        f.close() 
    return app.stop()

Is there any solution to make the video display normally

suixin
  • 11
  • 2

1 Answers1

0

You need to pass the width and the height to the send_video function.

app.send_video('chat_id', 
                video_file, 
                height=1280, 
                width=720, 
                progress=progress, 
                caption=fname, 
                parse_mode=enums.ParseMode.MARKDOWN)

This would display the video in the correct resolution.

nisalap
  • 122
  • 6