J
J
jecer_inside2021-08-02 09:24:58
Python
jecer_inside, 2021-08-02 09:24:58

How to specify the width of the video to send via telegram bot?

I use:

import time
import random
import requests
import os


sending through a cycle (all day the bot sends files):
filesVideo = os.listdir("video/")
    countVideo = len(files)
    if countVideo == 0:
        exit()
    fileUploadIndexVideo = random.randint(0, countVideo - 1)
    fileToUploadVideo = filesVideo[fileUploadIndexVideo]
    fdVideo = open("video/" + fileToUploadVideo, 'rb')

    urlVideo = "https://api.telegram.org/bot" + TOKEN + "/sendVideo";

    filesVideo = {'video': fdVideo}
    dataVideo = {'chat_id': CHAT_ID}
    r = requests.post(urlVideo, files=filesVideo, data=dataVideo)
    fdVideo.close()
    os.remove("video/" + fileToUploadVideo)


after sending the video by the bot to the channel, on the PC client, the video is of normal width (as in the original), and on the phone it is square (compressed in width), it looks as if the aspect ratio changes to 4:3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Krostelev, 2021-08-02
@jecer_inside

It says like that you can specify the width and height of the video. width and height parameters

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question