nginx-rtmp-module icon indicating copy to clipboard operation
nginx-rtmp-module copied to clipboard

record path dynamically base on stream name

Open lesjaw opened this issue 7 years ago • 5 comments

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

lesjaw avatar Jul 29 '17 09:07 lesjaw

Have you found a solution?

berkutx avatar Nov 10 '17 17:11 berkutx

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.

UKNickyD avatar Nov 17 '17 00:11 UKNickyD

can u share with us ?

gdomod avatar Jun 25 '18 12:06 gdomod

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;

hudt avatar Mar 27 '20 05:03 hudt

Have anybody found proper solution for this?

jazib93 avatar May 10 '22 14:05 jazib93