Hey everyone! After i saw the tutorial on youtube i tried to make a radion 24/7 on youtube stream with a looping mp4. So far so good, but with a problem. I rend a VPS from vultur with ubuntu 18.4 , 1cpu 2gb ram, everything works smoothly but even if the down/up speeds of vps are more than 300mbps, i cant get my bitrate to run more than 2200kbps on streams, and end up with buffering if i try to raise that or no stream at all. I run the exact code written on tutorial. Is there anything i can do about it? (2 days since i started the stream, 2 times a pipe error and something with header ended the stream after 18 continuous hours of play). Im a newbie on ffmpeg and linux but im learning fast! Since i connect remotely i noticed that if i copy paste all the code together it doesnt recognize the ffmpeg / command so i had to copy paste half and each line after the ffmpeg command to work to check the error, because i cant find a way to write a log of it… Thanks in advance!
#! /bin/bash
VBR=”2500k” FPS=”24″ QUAL=”superfast”
YOUTUBE_URL=”rtmp://a.rtmp.youtube.com/live2″ KEY=”key”
VIDEO_SOURCE=”/root/Desktop/cat.mp4″ AUDIO_SOURCE=”http://ip/radio/8000/radio.mp3″
ffmpeg \ -re -f lavfi -i “movie=filename=$VIDEO_SOURCE:loop=0, setpts=N/(FRAME_RATE*TB)” \ -thread_queue_size 512 -i “$AUDIO_SOURCE” \ -map 0:v:0 -map 1:a:0 \ -map_metadata:g 1:g \ -vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \ -acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \ -f flv “$YOUTUBE_URL/$KEY”
I was thinking if i can make the spotify as the audio input of the ffmpeg stream and then i could add an "Browser Source" that refresh itself constantly so it can scrobble song titles from Last fm. Spotify -> Last fm Scrobble -> Online Now Playing Pixel Chat (e.g https://pixel.chat/tOfLWMid82CRead more
I was thinking if i can make the spotify as the audio input of the ffmpeg stream and then i could add an “Browser Source” that refresh itself constantly so it can scrobble song titles from Last fm.
Spotify -> Last fm Scrobble -> Online Now Playing Pixel Chat (e.g https://pixel.chat/tOfLWMid82Cso06/8d9c8c05-2c53-4c33-b995-e703ec9e4d06) for the stream.
Thanks in advance!
See lessThis code will help you to loop the process. #! /bin/bash while true do VBR=”2500k” FPS=”24″ QUAL=”superfast” YOUTUBE_URL=”rtmp://a.rtmp.youtube.com/live2″ KEY=”key” VIDEO_SOURCE=”/root/Desktop/cat.mp4″ AUDIO_SOURCE=”http://ip/radio/8000/radio.mp3″ ffmpeg \ -re -f lavfi -i “movie=fiRead more
This code will help you to loop the process.
#! /bin/bash
while true
do
VBR=”2500k” FPS=”24″ QUAL=”superfast”
YOUTUBE_URL=”rtmp://a.rtmp.youtube.com/live2″ KEY=”key”
VIDEO_SOURCE=”/root/Desktop/cat.mp4″ AUDIO_SOURCE=”http://ip/radio/8000/radio.mp3″
ffmpeg \ -re -f lavfi -i “movie=filename=$VIDEO_SOURCE:loop=0, setpts=N/(FRAME_RATE*TB)” \ -thread_queue_size 512 -i “$AUDIO_SOURCE” \ -map 0:v:0 -map 1:a:0 \ -map_metadata:g 1:g \ -vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \ -acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \ -f flv “$YOUTUBE_URL/$KEY”
done
See lessYou can try to copy this code in to .sh file and execute it. For lagging problem, it can happen due to low processing power of the VPS. I will create a video to solve this issue.
You can try to copy this code in to .sh file and execute it. For lagging problem, it can happen due to low processing power of the VPS. I will create a video to solve this issue.
See lessThanks for the reply! I tried today on a google cloud vps ubuntu same OS with 2vcpu and 8gb ram, the problem is still the same. Il try the .sh method and il edit the comment here!
Thanks for the reply! I tried today on a google cloud vps ubuntu same OS with 2vcpu and 8gb ram, the problem is still the same. Il try the .sh method and il edit the comment here!
See lessHey, so i was testing the code and found out that if i increase the -bufsize command, i can maintain higher bitrate on my VPS, but the i have to change the thread_queue_size aswell, it wasnt so stable at first but im still testing to see the best results because rending a vps with that price and getRead more
Hey, so i was testing the code and found out that if i increase the -bufsize command, i can maintain higher bitrate on my VPS, but the i have to change the thread_queue_size aswell, it wasnt so stable at first but im still testing to see the best results because rending a vps with that price and getting only 2mpbs upload wasnt something i expecting.
One more thing. I Found out that you can make a text of current song that play now on livestream. I Have no experience with API and how to connect them with my ffmpeg output, but here is an example i found from another thread. I cant paste the code directly because variables with “@” command add random people registered on the site so i created 2 pastebin urls!
https://pastebin.com/TyiyEyXF
https://pastebin.com/Lh6TpQ9Y
Not sure how to make this work yet, but if anyone has a better experience with API’s, i would be so glad to leave a comment! Thanks once again!
See less