scivision / PyLivestream

Pure Python FFmpeg-based live video / audio streaming to YouTube, Facebook, Periscope, Twitch, and more
Apache License 2.0
706 stars 156 forks source link

Facebook live videos #35

Closed seisdr closed 4 years ago

seisdr commented 4 years ago

How to install facebook live video

scivision commented 4 years ago

Facebook live using ffmpeg requires ffmpeg ≥ 4.2. you can copy and paste a command generated by pylivestream or that you find works.

seisdr commented 4 years ago

Can't find plugin to Handle Facebook $ livestreamer --plugins Loaded plugins: afreeca, afreecatv, aftonbladet, alieztv, ard_live, ard_mediathek, artetv, azubutv, bambuser, beattv, chaturbate, connectcast, crunchyroll, cybergame, dailymotion, disney_de, dmcloud, dmcloud_embed, dommune, douyutv, drdk, euronews, filmon, filmon_us, furstream, gaminglive, gomexp, goodgame, hitbox, itvplayer, letontv, livestation, livestream, media_ccc_de, mips, mlgtv, nhkworld, nos, npo, nrk, oldlivestream, periscope, picarto, rtve, sbsdiscovery, seemeplay, speedrunslive, ssh101, stream, streamingvideoprovider, streamlive, svtplay, tga, tv3cat, tv4play, tvcatchup, tvplayer, twitch, ustreamtv, vaughnlive, veetle, vgtv, viagame, viasat, viasat_embed, wattv, weeb, youtube, zdf_mediathek

seisdr commented 4 years ago

My ffmpeg can't deal with mpd format

scivision commented 4 years ago

I'm not sure-- the livestreamer program is not related to pyLivestream.

seisdr commented 4 years ago

Ops never noticed that thanks

seisdr commented 4 years ago

$ ScreenshareLivestream facebook Press Enter to go live on ['facebook'] Or Ctrl C to abort.

/data/data/com.termux/files/usr/bin/ffmpeg -loglevel error -f x11grab -s 640x480 -i :0.0+50,30 -f pulse -i default -codec:v libx264 -pix_fmt yuv420p -preset veryfast -b:v 500k -g 60 -codec:a aac -b:a 128k -ar 44100 -maxrate 500k -bufsize 250k -strict experimental -f flv rtmps://live-api-s.facebook.com:443/rtmp/https://www.facebook.com/dgray0/videos/556203295176588/?app=fbl

Unknown input format: 'x11grab'

seisdr commented 4 years ago

X11 ? Xserver?

seisdr commented 4 years ago

I'm trying to download the live video

scivision commented 4 years ago

Assuming you're on Linux, it could be that your FFmpeg version was compiled without x11grab support. The standard Ubuntu 18.04 FFmpeg 3.4 works, as well as this static build

ffmpeg version 4.2.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
seisdr commented 4 years ago

Yea but static build can't go in network I'm on termux

scivision commented 4 years ago

Hmm, I am not sure if that sort of setup can work. x11grab seems to be intended for a traditional full X11 desktop. x11grab doesn't seem to work from other operating systems like WSL using X11 on Windows.

seisdr commented 4 years ago

yep static build can go on network $ ffmpeg -i "https://google.com" ffmpeg version N-50859-g27c6c92534-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzimg libavutil 56. 36.100 / 56. 36.100 libavcodec 58. 62.100 / 58. 62.100 libavformat 58. 35.100 / 58. 35.100 libavdevice 58. 9.101 / 58. 9.101 libavfilter 7. 66.100 / 7. 66.100 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 [tcp @ 0x3b0bea90] Failed to resolve hostname google.com: Name or service not known https://google.com: Input/output error But it shows that

 /data/data/com.termux/files/usr/bin/ffmpeg -loglevel error -f x11grab -s 640x480 -i :0.0+50,30 -f pulse -i default -codec:v libx264 -pix_fmt yuv420p -preset veryfast -b:v 500k -g 60 -codec:a aac -b:a 128k -ar 44100 -maxrate 500k -bufsize 250k -strict experimental -f flv rtmps://live-api-s.facebook.com:443/rtmp/https://www.facebook.com/dgray0/videos/556203295176588/?app=fbl

[x11grab @ 0x15032aa0] Cannot open display :0.0+50,30, error 1.
:0.0+50,30: Input/output error

Why do I need x11grab or x11 server it's just getting direct link and download the video right?

scivision commented 4 years ago

The script you're running seems to indicate you want to share the screen, which is why -f x11grab is the default device. If you want to have another stream input source, I would refer to https://ffmpeg.org/ffmpeg-devices.html

seisdr commented 4 years ago

Ok now I'm on ubuntu bootstrap Everything is fine but when I open xserver app the command line freeze I still can't understand

seisdr commented 4 years ago

Screenshot_2019-12-03-18-05-02

seisdr commented 4 years ago
/usr/bin/ffmpeg -loglevel error -f x11grab -s 640x480 -i :0.0+50,30 -f pulse -i default -codec:v libx264 -pix_fmt yuv420p -preset veryfast -b:v 500k -g 60 -codec:a aac -b:a 128k -ar 44100 -maxrate 500k -bufsize 250k -strict experimental -f flv rtmps://live-api-s.facebook.com:443/rtmp/https://www.facebook.com/100004918847207/videos/1463624210478193/?app=fbl

[x11grab @ 0x300008dd50] Cannot get 614432 bytes of shared memory: Permission denied.
shared memfd open() failed: Function not implemented
default: No such process
root@localhost:~#
scivision commented 4 years ago

Hmm, I'm not sure as I don't use that kind of interesting setup myself. The way I made the existing PyLivestream setups work is first I figured them out using just the ffmpeg command line by itself, and then parameterizing that for PyLivestream. PyLivestream is sort of a fit to known scenarios, it doesn't try to "solve" problems, rather it just fits existing known situations and make a command line based on that.

seisdr commented 4 years ago

Hello is this fixed yet?

seisdr commented 4 years ago

This project is to stream videos not to Download what am I doing here