nginx-rtmp-module
nginx-rtmp-module copied to clipboard
record path dynamically base on stream name
recording is so awesome..
but can the recorded file save in different path? let say the dynamic path base on stream name, something like this :
application {
live on;
# default recorder
record all;
record_path /var/rec;
recorder audio {
record audio;
record_suffix .audio.flv;
}
recorder chunked {
record all;
record_interval 15s;
record_path /var/rec/**%streamname**;
}
I want this because I have many rtmp publisher from different location, and I want each publisher record file save in their folder path in server
thank you
Have you found a solution?
You could do as I do and use exec_record_done to fire a script in the language of your choice to manage recordings as soon as they complete... Using this I create any needed directories on the fly, convert the flv's to mp4, and generate thumbnails... The script then check the mp4 exists, and if so deletes the flv version.
can u share with us ?
i create a shell like this:
-------/opt/ffshells/test.sh----------- #!bin/sh today=$(date +%Y%m%d) array=(${2//-/ }) streamname=${array[0]} echo today echo streamname mkdir -p /usr/local/nginx/html/record/$today/$streamname #trans to mp4 /opt/ffmpeg-git-20200211-amd64-static/ffmpeg -y -i $1 -vcodec copy -acodec copy /usr/local/nginx/html/record/$today/$streamname/$2.mp4 #create thumbnails /opt/ffmpeg-git-20200211-amd64-static/ffmpeg -i $1 -y -f mjpeg -t 1 -ss 3 -s 463x285 /usr/local/nginx/html/record/$today/$streamname/$2.jpg #notify curl "http://192.168.1.100:5020/record_done?uri=record/$today/$streamname&fileBaseName=$2"
#modify nginx.conf exec_record_done sh /opt/ffshells/test.sh $path $basename;
Have anybody found proper solution for this?