Skip to content

Commit 0424655

Browse files
authored
Update FFmpeg 7.0.1 (#2287)
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent 9acf128 commit 0424655

12 files changed

+58
-22
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
deploy:
3333
needs:
3434
- build-test
35-
if: contains(toJson(github.event.commits), '[deploy]') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true' && !failure() && !cancelled())
35+
if: (contains(toJson(github.event.commits), '[deploy]') || (github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true')) && !failure() && !cancelled()
3636
name: Deploy Docker images
3737
runs-on: ubuntu-latest
3838
permissions: write-all

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
deploy:
2121
needs:
2222
- build-test
23-
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && !failure() && !cancelled())
23+
if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && !failure() && !cancelled()
2424
name: Nightly build
2525
runs-on: ubuntu-latest
2626
permissions: write-all

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ BUILD_ARGS := $(BUILD_ARGS)
1717
MAJOR := $(word 1,$(subst ., ,$(TAG_VERSION)))
1818
MINOR := $(word 2,$(subst ., ,$(TAG_VERSION)))
1919
MAJOR_MINOR_PATCH := $(word 1,$(subst -, ,$(TAG_VERSION)))
20-
FFMPEG_TAG_VERSION := $(or $(FFMPEG_TAG_VERSION),$(FFMPEG_TAG_VERSION),ffmpeg-6.1.1)
20+
FFMPEG_TAG_PREV_VERSION := $(or $(FFMPEG_TAG_PREV_VERSION),$(FFMPEG_TAG_PREV_VERSION),ffmpeg-6.1.1)
21+
FFMPEG_TAG_VERSION := $(or $(FFMPEG_TAG_VERSION),$(FFMPEG_TAG_VERSION),ffmpeg-7.0.1)
2122
FFMPEG_BASED_NAME := $(or $(FFMPEG_BASED_NAME),$(FFMPEG_BASED_NAME),linuxserver)
22-
FFMPEG_BASED_TAG := $(or $(FFMPEG_BASED_TAG),$(FFMPEG_BASED_TAG),version-6.1.1-cli)
23+
FFMPEG_BASED_TAG := $(or $(FFMPEG_BASED_TAG),$(FFMPEG_BASED_TAG),7.0.1)
2324
PLATFORMS := $(or $(PLATFORMS),$(shell echo $$PLATFORMS),linux/amd64)
2425

2526
all: hub \

Video/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ USER root
1717
# Customize sources for apt-get
1818
#================================================
1919
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
20-
echo "deb http://archive.ubuntu.com/ubuntu jammy main universe\n" > /etc/apt/sources.list \
21-
&& echo "deb http://archive.ubuntu.com/ubuntu jammy-updates main universe\n" >> /etc/apt/sources.list \
22-
&& echo "deb http://security.ubuntu.com/ubuntu jammy-security main universe\n" >> /etc/apt/sources.list ; \
20+
echo "deb http://archive.ubuntu.com/ubuntu noble main universe\n" > /etc/apt/sources.list \
21+
&& echo "deb http://archive.ubuntu.com/ubuntu noble-updates main universe\n" >> /etc/apt/sources.list \
22+
&& echo "deb http://security.ubuntu.com/ubuntu noble-security main universe\n" >> /etc/apt/sources.list ; \
2323
fi
2424

2525
# No interactive frontend during docker build

Video/entry_point.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ SUPERVISOR_PID=$!
1717
function shutdown {
1818
echo "Trapped SIGTERM/SIGINT/x so shutting down supervisord..."
1919
kill -s SIGTERM ${SUPERVISOR_PID}
20+
wait `pgrep -f ffmpeg | tr '\n' ' '`
21+
wait `pgrep -f rclone | tr '\n' ' '`
2022
wait ${SUPERVISOR_PID}
2123
echo "Shutdown complete"
2224
}

Video/video.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,23 @@ function exit_on_max_session_reach() {
8787
fi
8888
}
8989

90+
function stop_ffmpeg() {
91+
while true; do
92+
FFMPEG_PID=$(pgrep -f ffmpeg | tr '\n' ' ')
93+
if [ -n "$FFMPEG_PID" ]; then
94+
kill -SIGTERM $FFMPEG_PID
95+
wait $FFMPEG_PID
96+
fi
97+
if ! pgrep -f ffmpeg > /dev/null; then
98+
break
99+
fi
100+
sleep 0.5
101+
done
102+
}
103+
90104
function stop_recording() {
91105
echo "$(date +%FT%T%Z) [${process_name}] - Stopping to record video"
92-
pkill -INT ffmpeg
106+
stop_ffmpeg
93107
recorded_count=$((recorded_count+1))
94108
recording_started="false"
95109
if [[ "${VIDEO_UPLOAD_ENABLED}" != "false" ]] && [[ -n "${UPLOAD_DESTINATION_PREFIX}" ]];
@@ -115,7 +129,7 @@ function graceful_exit() {
115129
send_exit_signal_to_uploader
116130
wait_util_uploader_shutdown
117131
rm -rf ${UPLOAD_PIPE_FILE} || true
118-
kill -INT "$(cat /var/run/supervisor/supervisord.pid)"
132+
kill -SIGTERM "$(cat /var/run/supervisor/supervisord.pid)"
119133
}
120134

121135
if [[ "${VIDEO_UPLOAD_ENABLED}" != "true" ]] && [[ "${VIDEO_FILE_NAME}" != "auto" ]] && [[ -n "${VIDEO_FILE_NAME}" ]]; then
@@ -133,7 +147,7 @@ if [[ "${VIDEO_UPLOAD_ENABLED}" != "true" ]] && [[ "${VIDEO_FILE_NAME}" != "auto
133147
done
134148

135149
# exec replaces the video.sh process with ffmpeg, this makes easier to pass the process termination signal
136-
exec ffmpeg -hide_banner -loglevel warning -flags low_delay -threads 1 -fflags nobuffer+genpts -strict experimental -y -f x11grab \
150+
exec ffmpeg -hide_banner -loglevel warning -flags low_delay -threads 2 -fflags nobuffer+genpts -strict experimental -y -f x11grab \
137151
-video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY_CONTAINER_NAME}:${DISPLAY_NUM}.0 -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p "$VIDEO_FOLDER/$VIDEO_FILE_NAME"
138152

139153
else
@@ -167,7 +181,7 @@ else
167181
recorded_count=0
168182

169183
echo "$(date +%FT%T%Z) [${process_name}] - Checking if node API responds"
170-
until curl -sk --request GET ${SE_SERVER_PROTOCOL}://${DISPLAY_CONTAINER_NAME}:${SE_NODE_PORT}/status || [[ $attempts = "$max_attempts" ]]
184+
until curl --noproxy "*" -sk --request GET ${SE_SERVER_PROTOCOL}://${DISPLAY_CONTAINER_NAME}:${SE_NODE_PORT}/status || [[ $attempts = "$max_attempts" ]]
171185
do
172186
if [ $(($attempts % 60)) -eq 0 ];
173187
then
@@ -181,7 +195,7 @@ else
181195
echo "$(date +%FT%T%Z) [${process_name}] - Can not reach node API, exiting."
182196
exit
183197
fi
184-
while curl -sk --request GET ${SE_SERVER_PROTOCOL}://${DISPLAY_CONTAINER_NAME}:${SE_NODE_PORT}/status > /tmp/status.json
198+
while curl --noproxy "*" -sk --request GET ${SE_SERVER_PROTOCOL}://${DISPLAY_CONTAINER_NAME}:${SE_NODE_PORT}/status > /tmp/status.json
185199
do
186200
session_id=$(jq -r '.[]?.node?.slots | .[0]?.session?.sessionId' /tmp/status.json)
187201
if [[ "$session_id" != "null" && "$session_id" != "" && "$recording_started" = "false" ]]
@@ -199,7 +213,7 @@ else
199213
then
200214
video_file="${VIDEO_FOLDER}/$video_file_name"
201215
echo "$(date +%FT%T%Z) [${process_name}] - Starting to record video"
202-
ffmpeg -hide_banner -loglevel warning -flags low_delay -threads 1 -fflags nobuffer+genpts -strict experimental -y -f x11grab \
216+
exec ffmpeg -hide_banner -loglevel warning -flags low_delay -threads 2 -fflags nobuffer+genpts -strict experimental -y -f x11grab \
203217
-video_size ${VIDEO_SIZE} -r ${FRAME_RATE} -i ${DISPLAY} -codec:v ${CODEC} ${PRESET} -pix_fmt yuv420p "$video_file" &
204218
recording_started="true"
205219
echo "$(date +%FT%T%Z) [${process_name}] - Video recording started"

Video/video_graphQLQuery.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,34 @@ if [ -z "${GRAPHQL_ENDPOINT}" ] && [ -n "${SE_NODE_GRID_URL}" ]; then
1414
fi
1515

1616
if [ -n "${GRAPHQL_ENDPOINT}" ]; then
17-
# Send GraphQL query
18-
curl --retry 3 -k -X POST \
19-
-H "Content-Type: application/json" \
20-
--data '{"query":"{ session (id: \"'${SESSION_ID}'\") { id, capabilities, startTime, uri, nodeId, nodeUri, sessionDurationMillis, slot { id, stereotype, lastStarted } } } "}' \
21-
-s "${GRAPHQL_ENDPOINT}" > /tmp/graphQL_${SESSION_ID}.json
17+
while true; do
18+
# Send GraphQL query
19+
curl --noproxy "*" --retry 3 -k -X POST \
20+
-H "Content-Type: application/json" \
21+
--data '{"query":"{ session (id: \"'${SESSION_ID}'\") { id, capabilities, startTime, uri, nodeId, nodeUri, sessionDurationMillis, slot { id, stereotype, lastStarted } } } "}' \
22+
-s "${GRAPHQL_ENDPOINT}" > /tmp/graphQL_${SESSION_ID}.json
23+
# Check if the response contains "capabilities"
24+
if jq -e '.data.session.capabilities' /tmp/graphQL_${SESSION_ID}.json > /dev/null; then
25+
break
26+
else
27+
sleep 0.5
28+
fi
29+
done
2230

31+
# Extract the values from the response
2332
RECORD_VIDEO=$(jq -r '.data.session.capabilities | fromjson | ."'${VIDEO_CAP_NAME}'"' /tmp/graphQL_${SESSION_ID}.json)
2433
TEST_NAME=$(jq -r '.data.session.capabilities | fromjson | ."'${TEST_NAME_CAP}'"' /tmp/graphQL_${SESSION_ID}.json)
2534
VIDEO_NAME=$(jq -r '.data.session.capabilities | fromjson | ."'${VIDEO_NAME_CAP}'"' /tmp/graphQL_${SESSION_ID}.json)
2635
fi
2736

37+
# Check if enabling to record video
2838
if [ "${RECORD_VIDEO,,}" = "false" ]; then
2939
RECORD_VIDEO=false
3040
else
3141
RECORD_VIDEO=true
3242
fi
3343

44+
# Check if video file name is set via capabilities
3445
if [ "${VIDEO_NAME}" != "null" ] && [ -n "${VIDEO_NAME}" ]; then
3546
TEST_NAME="${VIDEO_NAME}"
3647
elif [ "${TEST_NAME}" != "null" ] && [ -n "${TEST_NAME}" ]; then
@@ -39,13 +50,17 @@ else
3950
TEST_NAME=""
4051
fi
4152

53+
# Check if append session ID to the video file name suffix
4254
if [ -z "${TEST_NAME}" ]; then
4355
TEST_NAME="${SESSION_ID}"
4456
elif [ "${VIDEO_FILE_NAME_SUFFIX,,}" = "true" ]; then
4557
TEST_NAME="${TEST_NAME}_${SESSION_ID}"
4658
fi
4759

60+
# Normalize the video file name
4861
TEST_NAME="$(echo "${TEST_NAME}" | tr ' ' '_' | tr -dc "${VIDEO_FILE_NAME_TRIM}" | cut -c 1-251)"
4962

5063
return_array=("${RECORD_VIDEO}" "${TEST_NAME}")
64+
65+
# stdout the values for other scripts consuming
5166
echo "${return_array[@]}"

tests/docker-compose-v3-test-node-docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ services:
4747
- BINDING_VERSION=${BINDING_VERSION}
4848
- SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
4949
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
50-
command: ["./bootstrap.sh", "${NODE}"]
50+
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]

tests/docker-compose-v3-test-node-relay.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ services:
4343
- TEST_NODE_RELAY=${TEST_NODE_RELAY}
4444
- ANDROID_PLATFORM_API=${ANDROID_PLATFORM_API}
4545
- TEST_DELAY_AFTER_TEST=${TEST_DELAY_AFTER_TEST}
46-
command: ["./bootstrap.sh", "${NODE}"]
46+
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]
4747

4848
node-relay-emulator:
4949
profiles:

tests/docker-compose-v3-test-parallel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ services:
8787
- TEST_PARALLEL_HARDENING=${TEST_PARALLEL_HARDENING}
8888
- BINDING_VERSION=${BINDING_VERSION}
8989
- TEST_PLATFORMS=${PLATFORMS}
90-
command: ["./bootstrap.sh", "${NODE}"]
90+
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]

0 commit comments

Comments
 (0)