Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No sound video causes media group send failure #729

Closed
3 tasks done
SagiriShiho opened this issue Jul 27, 2021 · 1 comment
Closed
3 tasks done

No sound video causes media group send failure #729

SagiriShiho opened this issue Jul 27, 2021 · 1 comment
Labels

Comments

@SagiriShiho
Copy link

Checklist

  • I am sure the error is coming from Pyrogram's code and not elsewhere.
  • I have searched in the issue tracker for similar bug reports, including closed ones.
  • I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version.

Description

Sending with a media group (send_media_group), if one of the videos is without sound, it causes the conversion to animation(gif) and thus the sending fails
If don't upload no sound the 'sample_960x540.mp4' , the remaining two videos will be uploaded successfully

from pyrogram import Client
from pyrogram.types import InputMediaPhoto, InputMediaVideo

api_id = xxxx
api_hash = "xxxx"

'''
I use Sample MP4 from filesamples.com/formats/mp4
https://filesamples.com/samples/video/mp4/sample_960x400_ocean_with_audio.mp4
https://filesamples.com/samples/video/mp4/sample_960x540.mp4
https://filesamples.com/samples/video/mp4/sample_1280x720.mp4
'''

with Client("xxxx", api_id, api_hash) as client:
    client.send_media_group(
        "me",
        [
            InputMediaVideo('sample_960x400_ocean_with_audio.mp4', caption="a video"),
            InputMediaVideo('sample_960x540.mp4'), #This is a video without sound
            InputMediaVideo('sample_1280x720.mp4'),
        ]
    )

Traceback

The full traceback (if applicable).

Traceback (most recent call last):
  File ".\tgup_test.py", line 15, in <module>
    client.send_media_group(
  File ".\Programs\Python\Python39\lib\site-packages\pyrogram\sync.py", line 56, in async_to_sync_wrap
    return loop.run_until_complete(coroutine)
  File ".\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File ".\Programs\Python\Python39\lib\site-packages\pyrogram\methods\messages\send_media_group.py", line 272, in send_media_group
    r = await self.send(
  File ".\Programs\Python\Python39\lib\site-packages\pyrogram\methods\advanced\send.py", line 77, in send
    r = await self.session.send(
  File ".\Programs\Python\Python39\lib\site-packages\pyrogram\session\session.py", line 425, in send
    return await self._send(data, timeout=timeout)
  File ".\Programs\Python\Python39\lib\site-packages\pyrogram\session\session.py", line 395, in _send
    RPCError.raise_it(result, type(data))
  File ".\Programs\Python\Python39\lib\site-packages\pyrogram\errors\rpc_error.py", line 78, in raise_it
    raise getattr(
pyrogram.errors.exceptions.bad_request_400.MediaEmpty: [400 MEDIA_EMPTY]: The media you tried to send is invalid (caused by "messages.SendMultiMedia")

Process finished with exit code 1

@delivrance
Copy link
Member

Telegram "limitation", not a Pyrogram issue - the error comes straight from the server. Videos inside albums need to have an audio stream, otherwise they are considered animations/gifs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants