24/7 stream on youtube

Armond

n3wb
Joined
Apr 11, 2023
Messages
6
Reaction score
0
Location
Swe
Hi!

I just installed my IP camera and stream it to youtube (use ffmpeg on RPi).
But my question is how to stream 24/7, without interruption after 12 hours.
Is it any workaround for that?

Mayby already some thread about that in the forum?
 

TRLcam

Getting comfortable
Joined
Apr 16, 2014
Messages
298
Reaction score
1,097
Location
Nebraska!
So, it automatically turns off at 12 hours? I have many YouTube live streams running and have never noticed that happening. You can set up a bash or Python script that uses the IFSTAT utility that will monitor the bandwidth and restart your streaming script when the bandwidth decreases. If you do that, make sure your script kills the existing ffmpeg process using pkill or you will have multiple ffmpeg processes running. Or you can just do a cron job to kill ffmpeg and start your streaming script again every 11 hours.
 

TonyR

IPCT Contributor
Joined
Jul 15, 2014
Messages
16,842
Reaction score
39,182
Location
Alabama
Yeah, my bluebird box livestream to YT goes off every 12 hours and I've read conflicting info about their limit....some saying there is a 12 hour limit and some saying there is none.

Because I stream directly from a BI (Blue Iris) VMS server PC, I can use an HTTP command to restart the cam every 8 hours and that appears to keep it alive without stopping. I'm looking into using Windows Task Scheduler on that BI server to automate that restart command. Or maybe a curl or powershell script...still a work in progress.
 

Armond

n3wb
Joined
Apr 11, 2023
Messages
6
Reaction score
0
Location
Swe
Hi!
Thanks for the replys!
I am not very good at scripts, mayby I can search the web or if you can explain how to do it.
Or is there any other option instead of youtube?
 

Armond

n3wb
Joined
Apr 11, 2023
Messages
6
Reaction score
0
Location
Swe
Hi again!

"Or you can just do a cron job to kill ffmpeg and start your streaming script again every 11 hours."
I have searched the internet for a solution, but I dont get how to do it and where to put it?
 

Armond

n3wb
Joined
Apr 11, 2023
Messages
6
Reaction score
0
Location
Swe
Hi again!

"Or you can just do a cron job to kill ffmpeg and start your streaming script again every 11 hours."
I have searched the internet for a solution, but I dont get how to do it and where to put it?
 

TRLcam

Getting comfortable
Joined
Apr 16, 2014
Messages
298
Reaction score
1,097
Location
Nebraska!
The first step is to learn the basics about your Raspberry Pi. The Pi was designed to be an entry level computer for school children to learn programming, so there are many tutorials on the internet that cover the basics. Take some time to do a little studying.

Here is a basic tutorial on bash scripting and how to make your script executable. How to Write and Run a Shell Script on the Raspberry Pi

And a tutorial on Raspberry Pi cron How To Start Programs Automatically on the Raspberry Pi

Here is a bash script to kill ffmpeg. Save it as killffmpeg.sh .

#!/bin/bash
pkill -f ffmpeg
fi

And a script to kill ffmpeg and start your camera script. Save it as restart.sh. The bash script startup.sh is your existing ffmpeg streaming script.

#!/bin/sh
/home/pi/scripts/killffmpeg.sh
sleep 2s
/home/pi/scripts/startup.sh

Then put the restart.sh script in cron to start at whatever interval or whenever you like.

This is the absolute simplest way to restart your streaming server using a Raspberry Pi and bash scripting.
 

Armond

n3wb
Joined
Apr 11, 2023
Messages
6
Reaction score
0
Location
Swe
Hi again!

I should check this out.
I have now done some scripts to upload a picture every minute to my webpage from my IP camera.
So next will be the streaming to youtube.
Or do you know for example this , it is livestream 24/7, how they do it.
 

TRLcam

Getting comfortable
Joined
Apr 16, 2014
Messages
298
Reaction score
1,097
Location
Nebraska!
It's a livestream with a wireless internet connection?
 

Armond

n3wb
Joined
Apr 11, 2023
Messages
6
Reaction score
0
Location
Swe
Well, my question is how they livestrem 24/7 with "playback" 12 hr?
The Youtube live stream is just an example.
 

flatface

n3wb
Joined
Apr 29, 2023
Messages
14
Reaction score
7
Location
North America
There is a 12 hour limit on livestream length. I have watched many multi-day livestreams and they always end at 12hr exactly (if it ends while the streamer is sleeping). If they remember and want to stream while sleeping they restart the stream before going to bed.

That said, I don't know how to restart your stream automatically. I don't know enough to make a good suggestion, but the little bit I do know would have me try to use PyAutoGUI via VSCode to mouse click around to restart the YT stream.
 
Top