mirror of https://github.com/OpenVidu/openvidu.git
New composed_quick_start.sh logic to wait for the ffmpeg process to end
parent
f886ac72db
commit
d039f71fdb
|
@ -96,6 +96,9 @@ elif [[ "${COMPOSED_QUICK_START_ACTION}" == "--start-recording" ]]; then
|
|||
<./stop ffmpeg -y -f alsa -i pulse -f x11grab -draw_mouse 0 -framerate $FRAMERATE -video_size $RESOLUTION -i :$DISPLAY_NUM -c:a aac -c:v libx264 -preset ultrafast -crf 28 -refs 4 -qmin 4 -pix_fmt yuv420p -filter:v fps=$FRAMERATE "/recordings/$VIDEO_ID/$VIDEO_NAME.$VIDEO_FORMAT"
|
||||
fi
|
||||
|
||||
# Warn the stop thread about ffmpeg process being completed
|
||||
echo "ffmpeg-completed" > /tmp/$VIDEO_ID-completed.txt
|
||||
|
||||
} 2>&1 | tee -a /tmp/container-start-recording.log
|
||||
|
||||
elif [[ "${COMPOSED_QUICK_START_ACTION}" == "--stop-recording" ]]; then
|
||||
|
@ -109,10 +112,17 @@ elif [[ "${COMPOSED_QUICK_START_ACTION}" == "--stop-recording" ]]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# Stop and wait ffmpeg process to be stopped
|
||||
# Stop ffmpeg process
|
||||
FFMPEG_PID=$(pgrep ffmpeg)
|
||||
echo 'q' > stop && tail --pid=$FFMPEG_PID -f /dev/null
|
||||
|
||||
## Wait for the ffmpeg process to be finished
|
||||
until [ -f /tmp/$VIDEO_ID-completed.txt ]
|
||||
do
|
||||
# Check 20 times per second
|
||||
sleep 0.05
|
||||
done
|
||||
rm -f /tmp/$VIDEO_ID-completed.txt
|
||||
|
||||
### Generate video report file ###
|
||||
ffprobe -v quiet -print_format json -show_format -show_streams /recordings/$VIDEO_ID/$VIDEO_NAME.$VIDEO_FORMAT > /recordings/$VIDEO_ID/$VIDEO_ID.info
|
||||
|
|
Loading…
Reference in New Issue