Skip to content

Docker: Filter and stop FFmpeg which started in container only #2818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Video/video.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
Loading