Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
yashoswalyo committed Sep 5, 2022
2 parents 33256ed + f6efbda commit 0f91bb7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Bugs should be reported at: [Telegram Group](https://t.me/yo_codes_support)

- FEATURES:
+ (new) Option to add multiple audio tracks to telegram video
+ Option to add multiple subtitles 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.
Expand All @@ -47,8 +47,10 @@ Add `HEROKU_EMAIL` <br>
Add `HEROKU_API_KEY` <br>
Add `HEROKU_APP_NAME` <br>
Add `CONFIG_FILE_URL` <br>
Goto `Actions > Manual Deplot To Heroku > Run Workflow`
Goto `Actions > Manual Deploy To Heroku > Run Workflow`

### OR
Coming soon
## Tutorial to get MongoDB URI:
[![Watch the video](https://img.youtube.com/vi/OfQ7xxMylV4/hqdefault.jpg)](https://youtu.be/OfQ7xxMylV4)

Expand All @@ -61,9 +63,10 @@ Goto `Actions > Manual Deplot To Heroku > Run Workflow`
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
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
Expand All @@ -73,6 +76,7 @@ settings - User Settings to manage different modes
help - How to use Bot
about - About the bot
login - Access bot
log - (admin only) Get log file from server
broadcast - (admin only) Broadcast message to bot users
stats - (admin only) check bots stats
```
Expand All @@ -81,15 +85,15 @@ stats - (admin only) check bots stats
```sh
$ git clone https://github.com/yashoswalyo/MERGE-BOT.git
$ cd MERGE-BOT
$ sudo apt-get install python3-pip ffmpeg
$ sudo apt-get install python3 python3-pip ffmpeg
$ pip3 install -U pip
$ pip3 install -U -r requirements.txt
# <fill config.py correctly>
# <fill config.env correctly by looking at sample_config.env>
$ bash start.sh
```

## License
```sh
```
Merge Bot, Telegram Video Merge Bot
Copyright (c) 2021 Yash Oswal <https://github.com/yashoswalyo>
Expand Down
8 changes: 5 additions & 3 deletions helpers/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def MergeSub(filePath: str, subPath: str, user_id):
subTrack += 1
LOGGER.info("Sub muxing")
subprocess.call(
f"ffmpeg -hide_banner {input_files}-map 0:v:0 -map 0:a -map 0:s? {maps}{metadata}-c:v copy -c:a copy -c:s srt './downloads/{str(user_id)}/[@yashoswalyo]_softmuxed_video.mkv' ",
f"ffmpeg -hide_banner {input_files}-map 0:v:0 -map 0:a:? -map 0:s:? {maps}{metadata}-c:v copy -c:a copy -c:s srt './downloads/{str(user_id)}/[@yashoswalyo]_softmuxed_video.mkv' ",
shell=True,
)
orgFilePath = shutil.move(
Expand Down Expand Up @@ -126,7 +126,7 @@ def MergeSubNew(filePath: str, subPath: str, user_id, file_list):
subTrack += 1
LOGGER.info("Sub muxing")
subprocess.call(
f"ffmpeg -hide_banner {input_files}-map 0:v:0 -map 0:a -map 0:s? {maps}{metadata}-c:v copy -c:a copy -c:s srt './downloads/{str(user_id)}/[@yashoswalyo]_softmuxed_video.mkv'",
f"ffmpeg -hide_banner {input_files}-map 0:v:0 -map 0:a:? -map 0:s:? {maps}{metadata}-c:v copy -c:a copy -c:s srt './downloads/{str(user_id)}/[@yashoswalyo]_softmuxed_video.mkv'",
shell=True,
)
return f"./downloads/{str(user_id)}/[@yashoswalyo]_softmuxed_video.mkv"
Expand All @@ -137,19 +137,21 @@ def MergeAudio(videoPath:str,files_list:list,user_id):
inputfiles = ""
maps = ""
metadata = ""
rmDispositions = ""
videoData = ffmpeg.probe(filename=videoPath)
videoStreamsData = videoData.get("streams")
audioTracks = 0
for i in range(len(videoStreamsData)):
if videoStreamsData[i]["codec_type"] == "audio":
rmDispositions += f"-disposition:a:{audioTracks} 0 "
audioTracks+=1
for i in files_list:
inputfiles += f"-i '{i}' "
for j in range(1,len(files_list)):
maps += f"-map {j}:a "
LOGGER.info("Merging files now")
subprocess.call(
f"ffmpeg -hide_banner {inputfiles}-map 0:v:0 -map 0:a:? {maps}-map 0:s:? -c:v copy -c:a copy -c:s copy './downloads/{str(user_id)}/[@yashoswalyo]_export.mkv'",
f"ffmpeg -hide_banner {inputfiles}-map 0:v:0 -map 0:a:? {maps}-map 0:s:? -c:v copy -c:a copy -c:s copy {rmDispositions}-disposition:a:{audioTracks} default './downloads/{str(user_id)}/[@yashoswalyo]_export.mkv'",
shell=True
)
return f"./downloads/{str(user_id)}/[@yashoswalyo]_export.mkv"
Expand Down

0 comments on commit 0f91bb7

Please sign in to comment.