This repository is no longer maintained, please use bilibili-extractor instead.
converts downloaded bilibili videos into usable types. Note: This is created for linux and it is not guaranteed to work with other OSes. If you made it work with your OS please let me know.
bilibili store downloaded videos in their own folders with the video, audio and subtitles. bilibili-tools converts the subtitles into srt and combine it with the video and audio. It also package it in a format Plex server can read.
-
First take the downloads folder from bilibili and put it into your computer. You can find it inside
Android/data/com.bstar.intl/download
. Note: you should download the entire season first -
Go to the the folder where you left the download folder and start your terminal there.
-
When you open the downloads folder you will see random looking folders. Select one of it.
-
Run
git clone https://github.com/nanashi-1/bilibili-tools.git
This will download the tools into bilibili-tools
.
- Run
python bilibili-tools/jsontosrt.py download/${season_id}/*/subtitle.json
Remember to replace the ${season_id}
with the folder you selected earlier.
This will convert every subtitle.json
into subtitle.srt
.
- Run
for i in download/${season_id}/*/64; do ffmpeg -i $i/video.m4s -i $i/audio.m4s -i $i/../subtitle.srt -map 0 -map 1:a:0 -map 2 -codec copy $i.mkv; done;
This will combine video, audio and subtitles, though the subtitles are softsub. If you want hardsub you can use -vf
option instead. Replace 64 if you did not download it in 720p. See How To Burn Subtitles Into Video.
- Now all the videos are ready. You can take them one by one in
${season_id}/*/64.mkv
or you can run
python bilibili-tools/package.py -o . -v 64.mkv -e entry.json download/${season_id}/*
to package it automatically.