Display static image if the input stream ends?
Created by: Kyrilasa
Hello!
I'm wondering if it is possible to make a program to act like this:
-from an RTMP input stream restream it to an output stream but if the input stream ends, display a static black image.
So i tried to do it such way that i overlay the input stream to a constant stream of black image. I've been trying to make it work and it is absolutely fine, until the overlayed stream(the input stream) ends, the ffmpeg will stop, and won't continue, no black static image either,it just froze.
Any ideas how to make it work? And if you have another solution to this problem please do not keep it for yourself :D
def start_ffmpeg_process2(in_filename, out_filename):
logger.info('Starting ffmpeg process2 output stream')
base = ffmpeg.input(STATIC_IMAGE)['v'] \
.filter('scale', size='{w}x{h}'.format(w=OVERLAY_STREAM_VIDEO_WIDTH,
h=OVERLAY_STREAM_VIDEO_HEIGHT))\
overlay = ffmpeg.input(in_filename)
# logger.info(center)
c_final = ffmpeg.overlay(base,overlay['v'],eof_action='pass')
args = (
ffmpeg
.output(c_final,overlay['a'],out_filename,format="flv",vcodec="libx264",
preset="ultrafast", pix_fmt='yuv420p',
tune="fastdecode,zerolatency",vb=1000*1500,
acodec="aac", ar=48000,maxrate='1M',bufsize='2M',max_muxing_queue_size=9999)
.global_args("-re")
.compile()# Here you can specify as cmd='ffmpeg' keyword arg what ffmpeg to use
)
return subprocess.Popen(args, stdin=subprocess.PIPE)