[FFmpeg-devel] [SOLVED] movie Filter reload Option

TalkVideo at TalkVideo.net TalkVideo at TalkVideo.net
Fri May 10 21:32:12 EEST 2019


I am marking this as [SOLVED] as I found a command line combination that
does what I need. I think it is proper enough. I am testing it as follows,
and will respond with results.

Using 3 separate console windows:

1) A script like this is running: 
while :; do date +%s > live.txt; cp 1px-Alpha.png overlay.png ; sleep 1; cp Image.png overlay.png ; date +%s > live.txt; sleep 1; done

This creates a blinking image, and a 1-second clock.

2) From a directory with a bunch of FLV files of various lengths:
while :; do vid=`ls videos/*.flv | sort -R | head -n1`;  /usr/local/bin/ffmpeg -re -y -r 30 -i $vid -c:v libx264 -x264-params "nal-hrd=vbr" -qmin 1 -qmax 15  -c:a aac -b:a 128k -b:v 8M -maxrate 40M -bufsize 20M -g 15  -preset ultrafast -s 640x360 -t 7 -f flv "rtmp://localhost:1935/video_overlay/key";  done

I have nginx running on localhost, and video_overlay is an application that is just a relay: 
application video_overlay
{
	live on;
	record off;
}


3) The Big Boy:
/usr/local/bin/ffmpeg -y -re -r 30 -i Input.flv -re -r 30 -i  "rtmp://localhost:1935/video_overlay/key?listen&listen_timeout=15000"  -f image2 -loop 1 -r 30 -i /home/nginx/overlay.png  -c:v libx264 -x264-params "nal-hrd=vbr" -filter_complex 'overlay=100:main_h-overlay_h-50:repeatlast=0:eof_action=pass, overlay=100:main_h-overlay_h-600, drawtext=fontfile=/home/nginx/fonts/Live.ttf:textfile=/home/nginx/live.txt:reload=1:x=main_w/33:y=main_h/24:fontsize=h/20:fontcolor=white:borderw=3' -qmin 1 -qmax 15  -c:a aac -b:a 128k -b:v 8M -maxrate 40M -bufsize 20M -g 15  -preset ultrafast -s 1920x1080  -f mp4 out.mp4


Notes:
a) The first Input "Input.flv" is a file, but can be another nginx application, same as  the one above, that can be used 
to receive inbound RTMP from an app or a camera. This will be tested.

b) The second Input receives the stream from the script in 2).

c) To stream to YouTube, replace the "-f mp4 out.mp4" at the end of the command line with: "-f flv rtmp://a.rtmp.youtube.com/live2/<stream-key>".
likewise for some other RTMP Endpoint.

d) The "repeatlast=0:eof_action=pass" does not seem to work, but the workaround is to use a alpha-clear overlay intermittently in script 2) above.

e) The "loop" filter is not used with regard to the video overlay. Instead, that input comes via RTMP.

f) The main command line, 3) waits until it receives input from script in 2).
If you keep pressing "q" in the terminal window running script 2), the resulting video will capture 
the switch from video to video, very well.
If you do a "Ctrl-c" in the terminal running script 2, the main command line, 3) goes back to waiting.
If you do a "Ctrl-z" in the terminal running script 2, the main command waits where it is, until you
foreground the job again. If you type "q" in the window running 3), it will quit after 2) is foregrounded
again. Otherwise it goes back to receiving input via RTMP if it is there, or waiting for it to come in.
(The "Ctrl-z" test is to try to simulate network dropping).

g) There may be some sync issues. Checking. The audio dissync appears to be consistent.

For the above reasons, I am marking this as [SOLVED] because a reload option to the movie filter
appears to be the wrong place to look for what I wanted to accomplish.


This will be tested live on YouTube, and this thread will be updated when it is.

My FFMPEG Is as follows:
git branch
  master
* release/4.1

git log | head -n 1
commit 7211e1ca9367f7f1a4a04983a66c7b1e2c9a3c92

ffmpeg 2>&1 | grep configuration
  configuration: --extra-libs=-lpthread --extra-libs=-lm --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-nonfree --enable-fontconfig --enable-libfribidi --disable-stripping --enable-debug=3




More information about the ffmpeg-devel mailing list