N
N
nemurenai_yuki2020-12-21 08:59:54
Nginx
nemurenai_yuki, 2020-12-21 08:59:54

ffmpeg + rtmp + nginx continuous stream implementation with looping playback, automatic transitions. What am I doing wrong?

What you need to come up with:
Implement a continuous streaming ffmpeg that will take clips from a folder and spin them in a circle. It is important that the delay is minimal, the transitions between different videos in the same stream are automatic.
What was the problem:
I can catch the rtmp stream through VLC, but transitions work very poorly, high latency (frames are processed, but VLC catches the stream only after 10-20 seconds, and sometimes even freezes). To put it mildly, the broadcast works crookedly.

My configs:

1. Script to run ffmpeg + stream generation in rmtp:

cd /root/cnv_video
while [ true ]; do
for video in $( ls -1 --hide=`ls -d` ); do
while [ `fuser $video` ]; do
sleep 10
done
/usr/bin/ffmpeg -re -i $video -acodec copy -vcodec copy -tune zerolatency -strict experimental -f flv rtmp://xxxx/live/stream
done
done


2. rtmp branch in nginx:
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
}
}
}


PS: All this is needed in order to play 24/7 videos in honey. institution on several Raspberry Pi connected to TVs.
I would be grateful if someone points out my mistakes and tells me where to dig and what I made a mistake, and maybe even help with other config.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2020-12-21
@gbg

Your files are most likely shrunk by a two-pass algorithm that delivered I-frames (google what it is) too infrequently.
The playback of the broadcast can only be started from an I-frame, so the player has to wait until such a frame arrives.
Since you have static content, you don't need any RTMP streaming at all - convert your files to mp4 format and embed them in the browser using the tag, without any flash.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question