T
T
twentyz2020-10-08 22:34:15
Python
twentyz, 2020-10-08 22:34:15

What is the native video format for telegram?

Hello. The problem is on iPhones and on the telegram desktop application.
I send video to telegram via telethon via send_file:

client.send_file('@mynickname', 'file.mp4', thumb = 'thumb.jpg', allow_cache=False)

In telegrams on iPhone and desktop, a video comes without a thumbnail and a very small size (not the video itself, but how it looks in the client). Everything is fine on android .
5f7f675965b84768164426.jpeg
But this does not happen on all videos, so I believe that the problem is in the codecs of the file, which for some reason the android normally digests.

I'm trying to convert:
ffmpeg.input('test.mp4') \
        .filter('scale', 640, -1) \
        .output(r'out.mp4', vcodec= 'libx264', crf = 26) \
        .run(capture_stdout=True, capture_stderr=True)

But it doesn’t help either (and by the way, the sound of the file flies for some reason with .filter) On
the stack , we figured out how to use
ffmpeg -i input -an -c:v libx264 -crf 26 -vf scale=640:-1 out.mp4

But I can’t figure out how to write these parameters in python, although the option I mentioned above seems to be similar to this one.
In general, I will be grateful for any hints where to dig.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drno, 2020-10-08
@Drno

On an iPhone (if I'm not mistaken) the standard video format is mov to h264. I don’t remember the audio codec
In ffmpeg, try to specify audio in addition to video - such as acodec copy or convert audio too

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question