Code Monkey home page Code Monkey logo

merge-bot's Introduction

MERGE-BOT

PR's Welcomed


GitHub Repo stars GitHub forks GitHub issues GitHub closed issues GitHub pull requests GitHub closed pull requests GitHub contributors GitHub repo size GitHub commit activity

An Telegram Bot By Yash Oswal To Merge multiple Videos in Telegram into single video.
Bugs should be reported at: Telegram Group

- TODO's:
+ Add ability to edit metadata of exported video

- FEATURES:
+ (new) Option to add multiple audio tracks to telegram video
+ (new) Option to add multiple subtitles to telegram video
+ Upload Files to Drive (Send your rclone config to bot)
#  1. Send your rclone config to bot.
#  2. Then send videos to merge, after you tap "Merge Now", upload to drive option will available.
+ Merged video preserves all streams of the first video you send (i.e. all audiotracks/subtitles)

+ Merge Upto 10 videos in one 
+ Upload as document/video 
+ Custom thumbnail support
+ Users can login to bot using password
+ Owner can broadcast message to all users
+ Log Channel to store all merged videos

Deploy Tutorial :

Watch the video

Deploy(at your own risk) :

OR

Goto settings > actions > secret > New Repository Secret
Add HEROKU_EMAIL
Add HEROKU_API_KEY
Add HEROKU_APP_NAME
Add CONFIG_FILE_URL
Goto Actions > Manual Deploy To Heroku > Run Workflow

OR

Coming soon

Tutorial to get MongoDB URI:

Watch the video

Config File Variables :

  1. TELEGRAM_API : User Account Telegram API_ID, get it from my.telegram.org
  2. API_HASH : User Account Telegram API_HASH, get it from my.telegram.org
  3. BOT_TOKEN : Your Telegram Bot Token, get it from @Botfather XD
  4. OWNER: Enter bot owner's ID
  5. OWNER_USERNAME: User name of bot owner
  6. DATABASE_URL: Enter your mongodb URI
  7. PASSWORD: Enter password to login bot
  8. LOGCHANNEL: Log channel will store all users merged videos ("-100" + "channel Id")
  9. USER_SESSION_STRING: Premium account session string to upload upto 4GB (requires LOGCHANNEL)

Commands (add via @botfather) :

start - Start The Bot
extract - Extract audios/subtitles from telegram media
showthumbnail - Shows your thumbnail
deletethumbnail - Delete your thumbnail
settings - User Settings to manage different modes
help - How to use Bot
about - About the bot
login - Access bot
ban - (admin only) Ban any user
unban - (admin only) Unban any user
log - (admin only) Get log file from server
broadcast - (admin only) Broadcast message to bot users
stats - (admin only) check bots stats

Self Host

$ git clone https://github.com/yashoswalyo/MERGE-BOT.git
$ cd MERGE-BOT
$ sudo apt-get install python3 python3-pip ffmpeg
$ pip3 install -U pip
$ pip3 install -U -r requirements.txt
# <fill config.env correctly by looking at sample_config.env>
$ bash start.sh

License

Merge Bot, Telegram Video Merge Bot
Copyright (c) 2021  Yash Oswal <https://github.com/yashoswalyo>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>

Credits

merge-bot's People

Contributors

dishapatel010 avatar yashoswalyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

merge-bot's Issues

ffmpeg error

PermissionError: [Errno 13] Permission denied: 'ffmpeg'

The API key is required for new authorizations.

i already filled config like that you made https://telegra.ph/file/eae155c2918c9de8d5a55.jpg but i dont know why about this error

2022-07-20T03:20:19.236237+00:00 app[worker.1]: 20-Jul-22 03:20:19 - INFO - Bot started [bot.py:59]
2022-07-20T03:20:19.324943+00:00 app[worker.1]: 20-Jul-22 03:20:19 - INFO - Bot started [bot.py:59]
2022-07-20T03:20:19.611751+00:00 app[worker.1]: Traceback (most recent call last):
2022-07-20T03:20:19.611770+00:00 app[worker.1]: File "/usr/src/mergebot/bot.py", line 557, in
2022-07-20T03:20:19.612010+00:00 app[worker.1]: mergeApp.run()
2022-07-20T03:20:19.612012+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/pyrogram/methods/utilities/run.py", line 84, in run
2022-07-20T03:20:19.612088+00:00 app[worker.1]: self.start()
2022-07-20T03:20:19.612090+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap
2022-07-20T03:20:19.612153+00:00 app[worker.1]: return loop.run_until_complete(coroutine)
2022-07-20T03:20:19.612155+00:00 app[worker.1]: File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
2022-07-20T03:20:19.612279+00:00 app[worker.1]: return future.result()
2022-07-20T03:20:19.612287+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/pyrogram/methods/utilities/start.py", line 58, in start
2022-07-20T03:20:19.612345+00:00 app[worker.1]: is_authorized = await self.connect()
2022-07-20T03:20:19.612346+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/pyrogram/methods/auth/connect.py", line 40, in connect
2022-07-20T03:20:19.612404+00:00 app[worker.1]: await self.load_session()
2022-07-20T03:20:19.612412+00:00 app[worker.1]: File "/usr/local/lib/python3.10/dist-packages/pyrogram/client.py", line 574, in load_session
2022-07-20T03:20:19.612527+00:00 app[worker.1]: raise AttributeError("The API key is required for new authorizations. "
2022-07-20T03:20:19.612538+00:00 app[worker.1]: AttributeError: The API key is required for new authorizations. More info: https://docs.pyrogram.org/start/auth
2022-07-20T03:20:20.260283+00:00 heroku[worker.1]: State changed from up to crashed
2022-07-20T03:20:20.211410+00:00 heroku[worker.1]: Process exited with status 1

Rclone not Found Error

bro i'm trying to use Upload To Drive option but getting this error

Rclone not Found, Unable to upload to drive

how i get rclone config ?
how i setup rclone ?

there is no instructions mention on post. please help me to solve this issue.

Issue while Video+Subtitles Merging

It cannot be Merge Video and Subtitles...It works till the Downloaing the inputs and Merging too but in final step it Results an Error πŸ”„ Renaming Video and strucks...It shows in logs

if UPLOAD_TO_DRIVE[f"{cb.from_user.id}"]:
NameError: name 'UPLOAD_TO_DRIVE' is not defined

I Kept upload as Telegram but it asking Upload to Drive
So, please resolve the bug... its an impressive work thank you sir

ffmpeg Error

I am getting this error after pressing Merge....
[Errno 2] No such file or directory: 'ffmpeg'.

Any help to overcome the issue is highly appreciated.

Request restart feature

As your repo support upstream repo to avoid redeploy, you need to add restart option otherwise it needs redeploy to change effect.

Feature Request

Plz Add Log Chennal, so we can store our video in one place & Can easily find out whenever need

Feature request

Plz Add mp3 merger
And add mp3 and mp4 joiner alsoπŸ˜‹

error

plugins/usettings.py", line 18, in
editable: Message, uid: int, fname: str | None, lname: str | None
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

File Merging Failed

2022-07-01T06:26:02.318884+00:00 app[worker.1]: transp = _UnixSubprocessTransport(self, protocol, args, shell,
2022-07-01T06:26:02.318884+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/asyncio/base_subprocess.py", line 36, in init
2022-07-01T06:26:02.318885+00:00 app[worker.1]: self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
2022-07-01T06:26:02.318885+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/asyncio/unix_events.py", line 799, in _start
2022-07-01T06:26:02.318885+00:00 app[worker.1]: self._proc = subprocess.Popen(
2022-07-01T06:26:02.318886+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/subprocess.py", line 969, in init
2022-07-01T06:26:02.318886+00:00 app[worker.1]: self._execute_child(args, executable, preexec_fn, close_fds,
2022-07-01T06:26:02.318886+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/subprocess.py", line 1845, in _execute_child
2022-07-01T06:26:02.318886+00:00 app[worker.1]: raise child_exception_type(errno_num, err_msg, err_filename)
2022-07-01T06:26:02.318887+00:00 app[worker.1]: FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

Here are some issues I found

1.Need restart command to fetch the latest commit from upstream repo
2.When extracting subs and audios it will be great if the file is renamed to the original file name plus audio name.
Ex:
Video name = test123.mkv
Assume video has 3 subtitle files
1.en
2.th
3.und
So extracting subtitles the subtitles shuld be renamed to test123.en.srt , test123.th.srt, test123.und.srt Same applies for the audio also.
3.Also forward the video send by the user to the bot to the log channel so admin can see what kind of video is the file.

Unable to merge WEBVTT subtitles files

[matroska,webm @ 0x563ef678a5c0] Unknown/unsupported AVCodecID S_TEXT/WEBVTT.
[matroska,webm @ 0x563ef678a5c0] Could not find codec parameters for stream 2 (S
ubtitle: none): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (500
0000) options
[matroska,webm @ 0x563ef678a5c0] Auto-inserting h264_mp4toannexb bitstream filte
r
[concat @ 0x563ef677f740] Could not find codec parameters for stream 2 (Unknown:
none): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (500
0000) options
Input #0, concat, from 'downloads/180233110/input.txt':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1280x720 [SA
R 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc
Metadata:
BPS : 896898
DURATION : 00:49:16.040000000
NUMBER_OF_FRAMES: 73901
NUMBER_OF_BYTES : 331408561
_STATISTICS_WRITING_APP: mkvmerge v66.0.0 ('Josie') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2023-10-20 11:54:25
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(tam): Audio: eac3, 48000 Hz, 5.1(side), fltp, 192 kb/s
Metadata:
title : CVA
BPS : 192000
DURATION : 00:49:16.064000000
NUMBER_OF_FRAMES: 92377
NUMBER_OF_BYTES : 70945536
_STATISTICS_WRITING_APP: mkvmerge v66.0.0 ('Josie') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2023-10-20 11:54:25
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2: Unknown: none
Cannot map stream #0:2 - unsupported type.
If you want unsupported types ignored instead of failing, please use the -ignore
_unknown option
If you want them copied, please use -copy_unknown

pyrogram

pyrogram which version work ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.