Open kv-y opened 4 years ago
I glossed over it initially but @hisirbr has mentioned a fix in his comment - setting the width and height causes the video to playback correctly.
@hisirbr thanks, your solution works. Just added proper width and height as parameters and video started to display correctly not only on iOS but also on official MacOS client.
if you are looking for easy solution how to grab locally stored video dimensions, this works for me (using ffmpeg-python): https://github.com/kkroening/ffmpeg-python/blob/master/examples/video_info.py#L15
probe = ffmpeg.probe(path_to_file)
video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)
width = int(video_stream['width'])
height = int(video_stream['height'])
Checklist
Description
I use
MTProto Telegram API
andTelegram Bot API
to upload small videos to Telegram. Format of video:h264+mp4
(audio stream doesn't matter) Resolution: 720p or 1080p Size of video file:> 10 MB
(but less than 20MB) Source of video: doesn't matter (you can use any valid h264 video). Method:sendVideo
if Telegram Bot API ormessages.sendMedia
if MTProto API.I upload my video to the Telegram server using mentioned API and don't provide explicit info about width and height of this video. According to the documenation of
sendVideo
I don't need to provide info aboutwidth
andheight
. They are both marked asoptional
. In this case Telegram server is reported that video was uploaded successfully (with width=0 and height=0). After that I try to watch video in different Telegram clients. Video is played correctly in Desktop client and Android app. But in iOS app I see a black screen instead of video (see attached screenshot).If I explicitly set width and height of video or use video is less than 10 MB than video is played correctly iOS app. As I understand, if video is less than 10 MB then telegram server is calculated its width and height.
Expected Behavior
I can watch the video uploaded via Telegram Bot API or MTProto API in the Telegram-iOS app (even if I don't provide info about width and height in API method)
Actual Behavior
Black screen instead of the video in iOS app. But I can hear sound and can see video thumbnails.
Steps to Reproduce
Screenshots and Videos
Environment
Device:
iPhone X
iOS version:
13.4
,13.5
App version:
6.1.2