Closed Trauni closed 3 years ago
Heyo,
no probs :)
The error shows that you run it with python2, not python3.
Try to specifically start it with python3, e.g. sudo python3 rtmp_stream_delayer.py
Oh my gosh thanks. One more question, sometimes if I start the script, it says "True" but nothing happens. What is the correct order to initiate the delayer? (I did starting the script in screen, detached, then I started the stream to the stream directory, but I also tried to start the script afterwards). Best
the script waits for a file to appear in the directory you configure. So "nothing" should happen until there are files, or directly, if you start it after recordings are already there. Try running it with -v, there should be debug output when a file was found (all files with .flv are valid. Maybe you don't save as flv? [flv is able to be interrupted and does not corrupt when closed unintentionally])
The "True" was debug, I removed it again^^
Ah I understand its waiting for the delay time I set and then I will see the encoding process. The script wont do any ffmpeg settings right? So shit in is shit out? Its a 1 to 1 copy of the incoming stream.
exactly, copy codec ;)
https://github.com/sistason/rtmp_stream_delayer/blob/master/rtmp_stream_delayer.py#L103
It's usually what you want, as this is the delayer. Do you want to be sure that there is no transcoding, or do you want to suggest that to be configurable? If there is a use case for that, I'd implement it :)
I did a test run yesterday and recorded the delayed session. The quality check will be today, so I will see if there is no quality loss.
One more question, will this work for the settings: STREAM_DESTINATION = 'rtmp://148.251.247.165/delay/map'
I want to use the nginx application "delay" with the key "map" so I dont have to set up applications per delayer.
And one last question, how can I deny the deletion of source files after the delayer script is done.
you can stream to a DESTINATION with any URL your nginx can handle, so yes should work
The deletion of source files is handled in L#57. You can remove that command and replace it with "pass" or something
Sorrs forgot to click close :)
Hey sorry man, I am not the big brain in linux and python. I tried to add your script to my rtmp server but if I start the script I will get this error messages:
Tried to start with: sudo python rtmp_stream_delayer.py /home/trauni/record/cleanfeed/
Traceback (most recent call last): File "rtmp_stream_delayer.py", line 186, in
if check_running(PID_FILE):
File "rtmp_stream_delayer.py", line 166, in check_running
except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined
My config: delayer_settings:
STREAM_DESTINATION = 'rtmp://148.251.247.165/cf_delay' DELAY = 120 # Seconds SINGLE = True # Set to true to just delay a single stream and exit, no reconnecting/backup-streams BACKUPSTREAM_SHORT = '' # Show while intermission BACKUPSTREAM_LONG = '' # Show while longer downtime FFMPEG_EXECUTABLE = "ffmpeg" # Use avconv if you need
nginx.conf
rtmp { server { listen 1935; chunk_size 4096; allow play all; max_message 5M;
Cleanfeed Application
Delayer Script Application
}
Stream is running, flv file is generated and growing. I can also open the stream in VLC and see its running into the correct application.
Thanks for help