Comments (2)
Hi @ZobaJakColbert, I am having the same question as you, and I just found a solution.
Because the 16:9 video has to be transformed into 9:16 before sending to Instagram, it is impossible to use the Custom RTMP on Restream for Instagram.
Instead you need some other softwares to achieve this:
- recording function settings in OBS
- ffmpeg (for transforming the video, to be more specific, using video filter of ffmpeg)
- local nginx RTMP server (for relaying signal from OBS to stunnel)
- stunnel (for relaying signal from nginx RTMP server to Instagram's RTMPS server, since IG has deprecated RTMP server and only supported RTMPS)
Below is a simple signal flow:
OBS recording -> local nginx rtmp server -> transforming from 16:9 to 9:16 using ffmpeg -> stunnel -> Instagram rtmps server
=============
After having download ffmpeg, nginx with RTMP module, and stunnel (not sure what operating system you are using, I am using OS X, so I download these softwares with homebrew), we have to tweak some config file.
Below are my config files for your reference:
# nginx.conf
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
exec_options on;
# to local stunnel server (with exec_push)
exec_push /usr/local/bin/ffmpeg -rtbufsize 256M -re -i 'rtmp://localhost:1935/live' -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 60 -r 30 -vf "scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1" -f flv 'rtmp://localhost:19350/rtmp/<your_ig_stream_key>';
}
}
}
As you can see, the ffmpeg is used in the exec_push
part of nginx.conf
. Lots of ffmpeg parameters setting are from Itsagramlive's sample code with the addition of padding 16:9 to 9:16 (reference)
Also, the IG streaming key got from Itsgramlive.start()
has to replace the <your_ig_stream_key>
in the above config file.
Next is stunnel.conf, which is much more simpler:
# stunnel.conf
[ig-live]
client = yes
accept = 127.0.0.1:19350
connect = live-upload.instagram.com:443
verifyChain = no
Last part is the OBS setting:
- Preference > Settings > Output > Recording Tab:
- set "Type" to "Custom Output FFmpeg"
- set "File path or URL" to "rtmp://localhost:1935/live" (which is our local nginx local server)
So with everything above being set, you can press "Start Recording" on OBS, so the signal can be streamed to Instagram successfully. It means that, you need to "Start Streaming" (to Restream) and "Start Recording" (to Instagram) at the same time.
kind of messy for all of these information. I've tried it and it worked. you can try googling "nginx rtmp, stunnel". Hope this helps.
Also I really appreciate the author of the Instagramlive
package, really helpful. Thank you!
from itsagramlive.
I believe that there are other libraries in Python that can manipulate the video as you wish, but that is not the focus of this project. Sorry.
from itsagramlive.
Related Issues (20)
- Except when ending stream
- Pin message? (question) HOT 5
- Bad password HOT 5
- the endpoint add_post_live_to_igtv no longer exists HOT 16
- Fullscreen live HOT 2
- Error "choose a challenge name" HOT 3
- ERROR(400): Can't comment for now. HOT 1
- Error on saving post to igtv HOT 2
- ffmpeg rtmps Resource temporarily unavailable HOT 1
- portrait live HOT 1
- ERROR(400) on login HOT 1
- LIVE STREAM ISSUE HOT 20
- Get Comments not list all comments
- Stream existing rtmp link to instagram
- tell me exact version of ffmpeg needed
- ffmpeg 3.3.0 (-deinterlace) command used in live_broadcast_ffmpeg.py is too old HOT 1
- read mp4 file from link & auto rotate videos for lanscape output live
- ANTIALIAS is deprecated HOT 1
- replace stream_key HOT 2
- login error 400 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itsagramlive.