All Projects → chenxuuu → 24h Raspberry Live On Bilibili

chenxuuu / 24h Raspberry Live On Bilibili

Licence: gpl-3.0
🎦树莓派/VPS驱动的b站直播弹幕点播台,代码写得很烂,看之前请吃点降压药。已计划重写

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to 24h Raspberry Live On Bilibili

Bililive Go
一个直播录制工具
Stars: ✭ 529 (+21.89%)
Mutual labels:  bilibili, ffmpeg
Webm.js
JavaScript WebM converter
Stars: ✭ 428 (-1.38%)
Mutual labels:  ffmpeg
Mystiq
Qt5/C++ FFmpeg Media Converter
Stars: ✭ 393 (-9.45%)
Mutual labels:  ffmpeg
Bili Spider
📺 B 站全站视频信息爬虫
Stars: ✭ 414 (-4.61%)
Mutual labels:  bilibili
Mkvserver mk2
The streaming solution to end all streaming problems
Stars: ✭ 395 (-8.99%)
Mutual labels:  ffmpeg
Bilibili Mac Client
An unofficial bilibili client for mac
Stars: ✭ 3,967 (+814.06%)
Mutual labels:  bilibili
Monkey Dl
Bulk download your favourite anime episodes from your favourite anime websites
Stars: ✭ 382 (-11.98%)
Mutual labels:  ffmpeg
Ffmpegcore
A .NET FFMpeg/FFProbe wrapper for easily integrating media analysis and conversion into your C# applications
Stars: ✭ 429 (-1.15%)
Mutual labels:  ffmpeg
Pyqt5 Apps
📎Some useful apps based on PyQt5. | 谷歌翻译、bilibili视频下载、华科电费查询、猫耳FM音频下载、无损音乐下载、华科图书馆查询、词云生成器etc.
Stars: ✭ 424 (-2.3%)
Mutual labels:  ffmpeg
Ffmpeg Video Editor Android
Sample android project using ffmpeg for cutting and compressing video,reversing video,extracting image frames from video,extracting audio from video,add fade in fade out effect,create fast and slow motion video
Stars: ✭ 414 (-4.61%)
Mutual labels:  ffmpeg
Gohls
A server that exposes a directory for video streaming via web interface
Stars: ✭ 409 (-5.76%)
Mutual labels:  ffmpeg
Pibooth
The pibooth project provides a Photo Booth application out-of-the-box for Raspberry Pi and opencv compatible devices
Stars: ✭ 398 (-8.29%)
Mutual labels:  raspberrypi
Evilslive
This project is a SDK about video stream live
Stars: ✭ 420 (-3.23%)
Mutual labels:  ffmpeg
Ffmpegcommand
FFmpegCommand适用于Android的FFmpeg命令库,实现了对音视频相关的处理,能够快速的处理音视频,大概功能包括:音视频剪切,音视频转码,音视频解码原始数据,音视频编码,视频转图片或gif,视频添加水印,多画面拼接,音频混音,视频亮度和对比度,音频淡入和淡出效果等
Stars: ✭ 394 (-9.22%)
Mutual labels:  ffmpeg
Bilisoleil
An unofficial bilibili client for android --rxjava2+mvp+okhttp3+retrofit2+dagger2
Stars: ✭ 430 (-0.92%)
Mutual labels:  bilibili
Picluster
A Simplified Docker Swarm or Kubernetes Alternative to Container Scheduling and Orchestration
Stars: ✭ 390 (-10.14%)
Mutual labels:  raspberrypi
Awesome Video
A curated list of awesome streaming video tools, frameworks, libraries, and learning resources.
Stars: ✭ 397 (-8.53%)
Mutual labels:  ffmpeg
Xabe.ffmpeg
.NET Standard wrapper for FFmpeg. It allows to process media without know how FFmpeg works, and can be used to pass customized arguments to FFmpeg from dotnet core application.
Stars: ✭ 411 (-5.3%)
Mutual labels:  ffmpeg
Framework
Machine learning, computer vision, statistics and general scientific computing for .NET
Stars: ✭ 4,177 (+862.44%)
Mutual labels:  ffmpeg
Bilibili Live Helper
Bilibili直播弹幕库 for Mac / Windows / Linux
Stars: ✭ 430 (-0.92%)
Mutual labels:  bilibili

24h-raspberry-live-on-bilibili

All Contributors

树莓派驱动的b站直播点播台

demo:http://live.bilibili.com/16703

注意这个是新项目,查看旧版的代码请打开“old”分支查看(旧版为网页点歌版)

本项目有两个链接:

GitHub:https://github.com/chenxuuu/24h-raspberry-live-on-bilibili.git

git.osc:https://gitee.com/Young_For_You/24h-raspberry-live-on-bilibili.git


同时也可以去用smilecc大佬重构的版本:

blive-raspberry(https://github.com/smilecc/blive-raspberry)


本项目基本编写完毕,已经有的功能为:

  • 弹幕点歌
  • 弹幕点MV
  • 弹幕反馈(发送弹幕)
  • 旧版实现的视频推流功能
  • 自定义介绍字幕
  • 歌词滚动显示,同时滚动显示翻译歌词
  • 切歌
  • 显示排队播放歌曲,渲染视频
  • 通过弹幕获取实时cpu温度
  • 闲时随机播放预留歌曲
  • 播放音乐时背景图片随机选择
  • 可点播b站任意视频(会员限制除外,番剧根据b站规定,禁止点播)(接口暂时失效)
  • 已点播歌曲、视频自动进入缓存,无人点播时随机播放
  • 存储空间达到设定值时,自动按点播时间顺序删除音乐、视频来释放空间
  • 实时显示歌曲/视频长度
  • 根据投喂礼物的多少来决定是否允许点播

已知问题:

  • 换歌、视频时会闪断

食用方法:

我这里用的是树莓派3B,系统2017-09-07-raspbian-stretch.img,官方默认软件源,其他配置请自测

先准备餐具:

sudo apt-get update
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libtheora-dev libtool libvorbis-dev pkg-config texinfo wget zlib1g-dev

安装x264编码器(时间较长):

git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl --enable-shared
make
sudo make install
cd ..
rm -rf x264

libmp3lame:

sudo apt-get install libmp3lame-dev

libopus:

sudo apt-get install libopus-dev

libvpx:

sudo apt-get install libvpx-dev

libomxil-bellagio:

sudo apt-get install libomxil-bellagio-dev

编译并安装ffmpeg(时间较长,半小时左右):

wget http://ffmpeg.org/releases/ffmpeg-4.0.tar.bz2
tar jxvf ffmpeg-4.0.tar.bz2
cd ffmpeg-4.0
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libass --enable-libfreetype  --enable-omx --enable-omx-rpi --enable-encoder=h264_omx --enable-mmal --enable-hwaccel=h264_mmal --enable-decoder=h264_mmal
make -j4
sudo make install
cd ..

(以上有一部分代码参考自ffmpeg源码编译安装(Compile ffmpeg with source) Part 2 : 扩展安装 - 人脑之战 - 博客园

安装python3:

sudo apt-get install python3

安装pip3:

sudo apt-get install python3-pip

安装python3的mutagen库:

sudo pip3 install mutagen

安装python3的you-get库:

sudo pip3 install you-get

安装python3的moviepy库:

sudo pip3 install moviepy

安装python3的aiohttp库:

sudo pip3 install aiohttp

安装python3的numpy需要的库:

sudo apt-get install libatlas-base-dev

安装python3的requests库:

sudo pip3 install requests

安装screen:

sudo apt-get install screen

安装中文字体

sudo apt install fontconfig
sudo apt-get install ttf-mscorefonts-installer
sudo apt-get install -y --force-yes --no-install-recommends fonts-wqy-microhei
sudo apt-get install -y --force-yes --no-install-recommends ttf-wqy-zenhei
#可能有装不上的,应该问题不大

# 查看中文字体 --确认字体是否安装成功
fc-list :lang=zh-cn

(字体安装来自ubuntu下 bilibili直播推流 ffmpeg rtmp推送

设置显存

打开树莓派设置:

sudo raspi-config

选择Advanced Options,回车

选择Memory Split,回车

把数值改成256

回车,接着退出设置,重启树莓派

烹饪&摆盘:

下载本项目:

git clone https://github.com/chenxuuu/24h-raspberry-live-on-bilibili.git

git clone https://gitee.com/Young_For_You/24h-raspberry-live-on-bilibili.git

请修改下载里的var_set.py文件中的各种变量 其中,cookie需要使用小号(尽量使用小号,并且b站账户好像需要绑定手机号后才能发送弹幕)在直播间,打开浏览器审查元素,先发一条弹幕,再查看network选项卡,找到namesend的项目,Form data中的csrf_token即为csrf_token变量的值。注意设置后,账号不能点击网页上的“退出登陆”按键,换账号请直接清除当前cookie再刷新

接着,点击控制台(console),输入document.cookie然后回车,返回值即为cookie变量的值。

csrf_token请填写Request head中的csrf_token

post_dm.py文件的if(user == '接待喵'): #防止自循环请改为你的机器人的名字

标注#debug使用,请自己修改的代码请自行修改,此为debug用的代码

如有条件,请务必自己搭建php的下载链接解析服务,源码都在php文件夹内

default_mp3文件夹内放入mp3格式的音乐,在无人点歌时播放,请尽量保证文件名全英文(可要可不要,因为现在已经改为放点播过的缓存歌曲、视频了)

default_pic文件夹内放入jpg格式的图片,用于做为放音乐时的背景,请尽量保证文件名全英文,分辨率推荐统一处理为1280x720

所有配置完成后,开启直播,然后启动脚本即可:

screen python3 play.py
#按ctrl+a,按ctrl+d
screen python3 bilibiliClient.py
#按ctrl+a,按ctrl+d
#弹幕监控使用了弹幕姬python版:https://github.com/lyyyuna/bilibili_danmu
#感谢弹幕姬python版作者的分享

如有不对的地方,请提交issue,也欢迎各位改进脚本并pr

本程序协议为GPL

Contributors ✨

Thanks goes to these wonderful people (emoji key):

madoka
madoka

💻 🐛
Lvmoo
Lvmoo

💻 🐛
档100
档100

💻 🐛
luojiaquan0320
luojiaquan0320

🐛
寒曦朦
寒曦朦

🤔
Xuewan
Xuewan

🤔
a08381
a08381

🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].