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

Prepend To Log Output For FFmpeg when using exec_push

Open davidplappert opened this issue 2 years ago • 0 comments

I currently have Nginx setup with nginx-rtmp-module and I use it to stream into the live application and then do some FFmpeg work on it into our hls application. My goal is to prepend the stream name to all FFmpeg's log output. In the past, I would just use unique log file names to solve this, but with Docker, it is easier to use a single file.

Here is an excerpt from the live application (non-working) exec_push ffmpeg -i rtmp://127.0.0.1:1935/live/$name -f flv rtmp://127.0.0.1:1935/hls/$name -loglevel repeat+level+debug 2> > (sed -u "s/^/FFMPEG: [${name}] /g" >>/proc/1/fd/1);

When I use an RTMP connection url like: rtmp://127.0.0.1/live/myTestName

My goal is to generate logs that look like:

FFMPEG: [myTestName] [info] ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
FFMPEG: [myTestName] [info]   built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
FFMPEG: [myTestName] [info]   configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
FFMPEG: [myTestName] [info]   libavutil      56. 31.100 / 56. 31.100
FFMPEG: [myTestName] [info]   libavcodec     58. 54.100 / 58. 54.100

Thank you for your help!

davidplappert avatar Mar 11 '22 18:03 davidplappert