From 692b0238966fcde315daf1e288c691cdf1965997 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Mon, 5 May 2025 18:10:44 +0700 Subject: [PATCH] Docker: Filter and stop FFmpeg which started in container only Signed-off-by: Viet Nguyen Duc --- Video/video.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Video/video.sh b/Video/video.sh index 9acec00774..2c2657d8e6 100755 --- a/Video/video.sh +++ b/Video/video.sh @@ -142,12 +142,12 @@ function exit_on_max_session_reach() { function stop_ffmpeg() { while true; do - FFMPEG_PID=$(pgrep -f ffmpeg | tr '\n' ' ') + FFMPEG_PID=$(pgrep -f "ffmpeg -hide_banner" | tr '\n' ' ') if [ -n "$FFMPEG_PID" ]; then kill -SIGTERM $FFMPEG_PID wait $FFMPEG_PID fi - if ! pgrep -f ffmpeg >/dev/null; then + if ! pgrep -f "ffmpeg -hide_banner" >/dev/null; then break fi sleep ${poll_interval} @@ -169,7 +169,7 @@ function stop_recording() { } function check_if_ffmpeg_running() { - if pgrep -f ffmpeg >/dev/null; then + if pgrep -f "ffmpeg -hide_banner" >/dev/null; then return 0 fi return 1